Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tutorials:script [2019/12/04 11:57]
tgeijten
tutorials:script [2019/12/04 11:58] (current)
tgeijten
Line 77: Line 77:
 === Jump Measure === === Jump Measure ===
 The actual measure is defined in ''​data/​ScriptMeasureJump.lua''​. It defines the following functions: The actual measure is defined in ''​data/​ScriptMeasureJump.lua''​. It defines the following functions:
-  * ''​function init( model, par )'',​ which is called at the beginning of the simulation. The first parameter is a [[ref:​lua_model]],​ which can be used to access [[ref::​lua_body]],​ [[ref:​lua_actuator]],​ etc. Unlike controllers,​ Measures are not allowed to create parameters, since they should evaluate parameter instances instead.+  * ''​function init( model, par )'',​ which is called at the beginning of the simulation. The first parameter is a [[ref:​lua_model]],​ which can be used to access ​any [[ref::​lua_body]],​ [[ref:​lua_actuator]],​ etc, which can be used during the simulation. Unlike controllers,​ Measures are not allowed to create parameters, since they should evaluate parameter instances instead.
   * ''​function update( model )'',​ which is called at each time step during the simulation. This function is optional, and can be used to do some internal bookkeeping,​ depending on the type of a measure. It is not allowed to generate actuator inputs here. Returning ''​true''​ will terminate the simulation.   * ''​function update( model )'',​ which is called at each time step during the simulation. This function is optional, and can be used to do some internal bookkeeping,​ depending on the type of a measure. It is not allowed to generate actuator inputs here. Returning ''​true''​ will terminate the simulation.
   * ''​function result( model )'',​ which is called at the end of the simulation, and should return the final result.   * ''​function result( model )'',​ which is called at the end of the simulation, and should return the final result.
  • by tgeijten