Stepping ignition from a ROS node
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.
Asked by Nitrow on 2020-10-16 05:43:28 UTC
Answers
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
...
/world/default/control
...
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.
Asked by chapulina on 2020-10-16 20:55:14 UTC
Comments
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?
Asked by Nitrow on 2020-10-17 05:23:00 UTC
Try pause: true, multi_step: 1
, that should do one step and continue paused.
Asked by chapulina on 2020-10-17 12:08:03 UTC
Thank you, that works!
Asked by Nitrow on 2020-10-17 21:09:29 UTC
Comments