Gazebo | Ignition | Community
Ask Your Question

Running code in loop inside gazebo-ros plugin

asked 2019-06-25 02:17:51 -0500

kumpakri gravatar image

Any time I have used gazebo-ros plugin of any type, I would always define an update function that is called on every world update and but the code I need to run there.

this->updateConnection = event::Events::ConnectWorldUpdateBegin(
                                boost::bind(&MyPlugin::onUpdate, this));

But now I need the code to be run even if the simulation is paused. What can I use to achieve this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-06-25 06:20:58 -0500

chapulina gravatar image

Gazebo doesn't offer any periodic callbacks on the server which work on paused mode. But you should be able to implement your own by spinning a new thread which has a while loop. Just be careful not to call any physics functions from that thread, especially non-const functions.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-06-25 02:17:51 -0500

Seen: 196 times

Last updated: Jun 25 '19