ref:lua_model

LuaModel

Model type for use in lua scripting.

See ScriptController and ScriptMeasure for details on scripting.

Function Description
LuaNumber time() get the current simulation time [s]
LuaNumber delta_time() get the previous simulation delta time [s]
LuaNumber max_duration() get the max_duration of the simulation objective
LuaVec3 com_pos() get the current com position [m]
LuaVec3 com_vel() get the current com velocity [m/s]
LuaNumber mass() get the model mass [kg]
LuaVec3 gravity() get the gravitational pull [m/s2]
void set_gravity(LuaVec3 g) get the gravitational pull [m/s2]
LuaActuator actuator(int index) get the actuator at index (starting at 1)
LuaActuator find_actuator(LuaString name) find an actuator with a specific name
int actuator_count() number of actuators
LuaDof dof(int index) get the muscle at index (starting at 1)
LuaDof find_dof(LuaString name) find a muscle with a specific name
int dof_count() number of dofs
LuaMuscle muscle(int index) get the muscle at index (starting at 1)
LuaMuscle find_muscle(LuaString name) find a muscle with a specific name
int muscle_count() number of muscles
LuaBody body(int index) get the body at index (starting at 1)
LuaBody find_body(LuaString name) find a body with a specific name
int find_body_index(LuaString name) find a body index with a specific name
int body_count() number of bodies
LuaBody ground_body() get the ground (static) body
LuaJoint joint(int index) get the joint at index (starting at 1)
LuaJoint find_joint(LuaString name) find a joint with a specific name
int joint_count() number of joints
LuaSpring get_interaction_spring() get the model interaction spring
void set_custom_value(LuaString name, LuaNumber value) store a custom value that can be accessed in other scripts
LuaNumber get_custom_value(LuaString name) retrieve a specific custom value that has previously been set
bool has_custom_value(LuaString name) check a specific custom value exists
LuaNumber find_two_way_neural_delay(LuaString name) get two-way neural delay from the neural_delays section in the model, returns zero if not found
LuaNumber find_one_way_neural_delay(LuaString name) get one-way neural delay from the neural_delays section in the model, returns zero if not found
LuaSensor create_muscle_force_sensor(LuaString name) create a sensor for delayed muscle force
LuaSensor create_muscle_length_sensor(LuaString name) create a sensor for delayed muscle length
LuaSensor create_muscle_velocity_sensor(LuaString name) create a sensor for delayed muscle velocity
LuaSensor create_muscle_activation_sensor(LuaString name) create a sensor for delayed muscle activation
LuaDelayedSensor create_delayed_muscle_force_sensor(LuaString muscle, LuaNumber delay) create a sensor for delayed muscle force
LuaDelayedSensor create_delayed_muscle_length_sensor(LuaString muscle, LuaNumber delay) create a sensor for delayed muscle length
LuaDelayedSensor create_delayed_muscle_velocity_sensor(LuaString muscle, LuaNumber delay) create a sensor for delayed muscle velocity
LuaDelayedSensor create_delayed_muscle_activation_sensor(LuaString muscle, LuaNumber delay) create a sensor for delayed muscle activation
LuaDelayedActuator create_delayed_muscle_actuator(LuaString muscle, LuaNumber delay) create an actuator with neural delay

Converted from doxygen using dokugen