Start simulation with given parameters from external script
Posted: 25 Aug 2022, 12:40
Please how do I set the simulation parameters from an external script (ZMQ api)?
I have the following for instance from an external python script:
which starts the simulation, waits for 2 secs (I really don't want this, I only do it because the simulator doesn't respond to external stimulus until after its environment has been prepared), sets the wait time and velocity of a human and then sets the wait time and velocity of a robot.
Wait time refers to the amount of time the robot or human should wait before going into motion.
Note: setParameters function is already defined from the objects' child scripts.
e.g.
I have the following for instance from an external python script:
Code: Select all
sim.startSimulation()
time.sleep(2)
sim.callScriptFunction("setParameters@Bill", sim.scripttype_childscript, timestepprime, velprime)
sim.callScriptFunction("setParameters@LBR_iiwa_7_R800", sim.scripttype_childscript, timestep, vel)
Wait time refers to the amount of time the robot or human should wait before going into motion.
Note: setParameters function is already defined from the objects' child scripts.
e.g.
Code: Select all
function setParameters(timestep, vel)
print("Robot parameters set!!!")
waitTime = timestep
speed = vel
end
What I want in essence, is to set waitTime and speed at the EXACT time that I am starting the simulator.