Gazebo | Ignition | Community
Ask Your Question

Stepping ignition from a ROS node

asked 2020-10-16 05:43:28 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hello community!

I'm creating reinforcement learning system using Ignition as simulator. For this purpose I need to step physics in the simulation from within a ROS node and further more it would be nice to be able to reset the simulation too. I'm using Ubuntu 20.04, with ROS Noetic and Ignition Dome. How is the most effective and simple way to do this? Solution involving C++ or Python is fine in case I need to create a service from scratch.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-10-16 20:55:14 -0500

chapulina gravatar image

You can run simulation paused and call to the /world/world_name/control Ignition service to step the simulation. Note that this is an Ignition Transport service, not a ROS service.

While running the simulation, I suggest you inspect this service using the command line, i.e.:

$ ign service -l

And check the service info with

$ ign service -i -s /world/default/control

Resetting the simulation is not fully supported yet. Some systems can be reset, but physics can't. See this issue.

edit flag offensive delete link more


I can see that some like ( in my case) "ign service -r -i -s /world/diff_drive/control --reqtype ignition.msgs.WorldControl --reptype ignition.msgs.Boolean --timeout 1000 --req 'step:true'" allows me to unpause the simualtion. But what if I just want to just take 1 step? Maybe I can unpause and pause it in some smart way?

Nitrow gravatar imageNitrow ( 2020-10-17 05:23:00 -0500 )edit

Try pause: true, multi_step: 1, that should do one step and continue paused.

chapulina gravatar imagechapulina ( 2020-10-17 12:08:03 -0500 )edit

Thank you, that works!

Nitrow gravatar imageNitrow ( 2020-10-17 21:09:29 -0500 )edit

Question Tools

1 follower


Asked: 2020-10-16 05:43:28 -0500

Seen: 373 times

Last updated: Oct 16 '20