A Gazebo transport API is exposed to allow starting and stopping the simulation. It's possible to call this API using the command line or through the GUI.
To repeat this demo, run the default
world:
Transport API
When Gazebo is run headless, this is an easy way to start the simulation.
To pause and play over the transport API, we should call the service /world/<world_name>/control
and fill the request message type gz.msgs.WorldControl
. This service returns a gz.msgs.Boolean
with the status of the request (true means everything was fine, false otherwise).
The WorldControl
message contains a pause
field for starting and stopping the simulation.
To start the simulation:
To pause the simulation:
When paused, time will stop in Gazebo, and the physics will not be running.
To check the current state of the simulator, check the paused
field in /stats
like so:
If the simulator is currently paused but was running before, we would see something similar to this:
GUI
We included a button in the World Control
plugin allowing to start and stop the simulation from the GUI.