ScriptController

Controller defined through a Lua script.

Runs the script defined in the file defined by script_file, which is relative to the folder of the scone scenario. See also LuaModel, LuaBody, LuaDof, LuaActuator, LuaMuscle, LuaFrame. Example of a Lua controller script:

function init( model, par, side )
    -- This function is called at the start of the simulation
    -- 'model' can be used to initialize the desired actuators (see LuaModel)
    -- 'par' can be used to define parameters for optimization (see LuaPar)
    -- 'side' denotes if the controller is for a specific side (-1 = left, 0 = any, 1 = right)
end

function update( model )
    -- This function is called at each simulation timestep
    -- Use it to update the actuator inputs
    return false -- change to 'return true' to terminate the simulation early
end

function store_data( current_frame )
    -- This function is called at each simulation timestep
    -- 'current_frame' can be used to store values for analysis (see LuaFrame)
end

See Tutorial 6a and 6b for more information.

Inherits from Controller.

Public Attributes

Parameter Type Description
script_file path filename of the Lua script, path is relative to the .scone file
start_time TimeInSeconds Time [s] at which Controller becomes active; default = 0.
stop_time TimeInSeconds Time [s] at which Controller becomes inactive; default = until simulation ends.
name String Name of the controller, uses as a prefix for the control parameters; empty by default.
signature_prefix String Prefix signature with custom string. Special tags: DATE_TIME, DATE_TIME_EXACT, SCONE_VERSION.
signature_postfix String Append custom string to signature. Special tags: DATE_TIME, DATE_TIME_EXACT, SCONE_VERSION.

Converted from doxygen using dokugen

  • (external edit)