Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Gazebo Topics disappear

I am trying to control a robot in Gazebo through the messaging system. For this I have a model plugin and four different topics. The model plugin subscribes to two of the topics and advertises on the other two. This works fine for one robot.

Now I want to do this with more than one robot in one world. I.e. I want to have two robot models in Gazebo, each with a model plugin and each with its own set of topics.

The problem I have is that some of the topics I create for the first robot seem to disappear once I create the topics for the second robot.

For each robot I create an instance of a controller class that subscribes and advertises to topics (which are named based on the robots' names). After the constructor for the first robot is done, I can see all four topics by opening the Gazebo Topic selector window (Ctrl + T). If I then let the constructor of the second constructor run, two of the four topics of the first robot are no longer listed in the Gazebo Topic selector window. Specifically, the topics that the model plugin subscribes to (i.e. the ones that are advertised in the controller class) disappear.

One thing that I could see being a problem is that each controller object has its own node, i.e. the constructor does

gazebo::transport::NodePtr node(new gazebo::transport::Node());
node->Init();

Is it a problem that the don't both use the same node? If so, how should I avoid this? Otherwise, what else could be the problem?