Gazebo | Ignition | Community
Ask Your Question

Shared variable between two instance of the same model plugin

asked 2018-12-06 05:20:18 -0500

kincurt gravatar image


I have a model plugin for a robot that use a controller in order to control the robot. The scenario i am working on needs to have two robots walking in the same world. So i am inserting the models with the same model plugin.

The sad thing is that this controller haven't been made with the usual c++ precautions. For instance, there are some variables that are declared outside the classes. And however it would be the best solution, i am not able to alter its code to fix this kind of mistake.

Therefore, when I am starting the simulation, some variables are edited by both robots and that prevents them from walking correctly.

So i was wondering if there is a way of executing both plugins "separatly" so that even if the controller have been badly coded they can't share any variables.

Thanks for your help!

PS: I am working on gazebo 9 with ubuntu 16.04 I am using catking to build the plugins

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-12-06 10:05:47 -0500

nkoenig gravatar image

Plugins are loaded into the same process, and there is no mechanism to alter this behavior. Unless there is someone with a creative idea, then I think the only solution is to fix the plugin.

edit flag offensive delete link more


Thanks for your reply. Yep, that's quite annoying, i though that gazebo implemented a way to compute plugins in parallel. It would have been really useful to speed computation time when you use several models with heavy controllers.

kincurt gravatar imagekincurt ( 2018-12-17 05:17:11 -0500 )edit

Question Tools

1 follower


Asked: 2018-12-06 05:20:18 -0500

Seen: 187 times

Last updated: Dec 06 '18