-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
Overlay functions cannot be added to a DOF's overlay list from Lua. Attempting to do so results in attribute errors. Mapping between lua<->python objects is at cause here. A potential workaround is to add add_overlay() and remove_overlay() methods to DOF and Expression classes...
Example Lua script:
function my_overlay(dofpos, dof)
if UI:is_key_pressed("space") then
return -0.5
else
return dofpos
end
end
function setup()
-- Called once, when the script is started
UI:init()
UI:add_key("up")
UI:add_key("down")
UI:add_key("space")
Hardware:servo_init()
Hardware:servo_neutral()
Expression.dofs["r_e_lid"].overlays:append(my_overlay)
Expression:set_emotion_val_ar(0.0, 0.0)
Expression.update()
Hardware:servo_enable()
end
function loop()
-- Called repeatedly, put your main program here
if rising_edge("up", UI:is_key_pressed("up")) then
print("up")
Expression:set_emotion_r_phi(1.0, 30, true, 1.5)
end
if rising_edge("down", UI:is_key_pressed("down")) then
print("down")
Expression:set_emotion_r_phi(1.0, 200, true, 1.5)
end
Expression.update()
end
function quit()
-- Called when the script is stopped
Hardware:servo_disable()
end
Reactions are currently unavailable