Controlling gazebo timing?
Hey all :)
I'm trying to train a neural network to teach my robot how to do things for a research project. Ideally I'd like to:
- Send an action command ("move forward", "move left", etc.) to the robot/simulation.
- Wait some time (e.g. 50 in-simulation milliseconds) to let the physics do their thing.
- Retrieve the new world state.
I have nodes that listen to action commands (such as setting wheel velocity), so I can send commands just by publishing the right messages.
I also have nodes in place that publish relevant world information (mainly the fitness function).
My question is, how is it possible to configure Gazebo to make this work as fast as possible? If my computer can run 10 seconds of simulation time in 1 second of real-world time, the whole process should not take much more than 1 second.
I managed to set Gazebo to run as fast as possible, ignoring real-world time, but in my python code (the one sending out commands) how should I know how long to wait for before checking the world state resulting from the command I just sent? Ideally there'd be a function "sleepForSimulationMilliseconds(ms)", but I doubt it exists!
Any help would be greatly appreciated... If any parts seem vague/confusing I'd happily try to elaborate. Thank you a lot for the help! :)