Robotics StackExchange | Archived questions

Plugin order of execution

I'm trying to use Boost IPC mechanisms to communicate between an external application and some gazebo plugins. I'm not using the transport layer because speed is critical for my application, and IPC mechanisms give me about a 2x increase in simulation speed over using topics. We're going to be running many, many thousands of simulations inside a Monte Carlo method, and a 2x speed increase will potentially shave days off the running time.

Getting the IPC synchronization correct for this is tricky, of course, and I'm running into issues that have to do with the order in which the plugins are executed. My questions:

1) is there any way to specify an order of execution for multiple plugins?

2) Do the plugins execute in the same thread? If I (for instance) block on a mutex inside one plugin, will the entire simulation halt, or do the other plugins run?

Asked by GlenH on 2017-02-02 12:16:20 UTC

Comments

Answers

1) I believe plugins (of the same type) are loaded in the order they're specified in the SDF file, but I could be mistaken.

2) Functions such as Plugin::Load run directly in the physics thread, and therefore have the potential for blocking simulation, as stated in the documentation.

If you are connected to any events, such as the world update event for example, that will also be blocking.

I believe that the best way to not block some Gazebo thread is to spin your own thread from the plugin, or to use a standalone program instead of a plugin.

Asked by chapulina on 2017-02-02 13:12:50 UTC

Comments