Skip to content

Gazebo Topic Naming Conventions

Giuseppe Silano edited this page Feb 5, 2019 · 4 revisions

Overview

Although the topic naming system between Gazebo and ROS looks similar, there are a few subtle yet important differences. It is important to get this right to make sure your messages get routed to the right place, and the entire system is scalable and modular when more robots get added to the environment.

Gazebo publishers and subscribers are associated with a containing node.

A tilde (~) in the topic name is shorthand for the default world. This normally expands to /gazebo/default/.

Conventions For rotors_simulator Plugins

All topics published and subscribed to by CrazyS Gazebo plugins use (they use the same convention of RotorS) the default namespace (i.e. they create a node with myNode.Init(), without passing in a string). This usually defaults to the /gazebo/default/ namespace.

Model plugins always prepend topic names with a unique name for the model. Note that this is not the model_ string which gets passed into the Load() method of a plugin! Instead, a unique name is provided by the robotNamespace parameter from the SDF file. This is obtained through the following code:

if (_sdf->HasElement("robotNamespace"))
  namespace_ = _sdf->GetElement("robotNamespace")->Get<std::string>();
else
  gzerr << "[gazebo_odometry_plugin] Please specify a robotNamespace.\n";
Clone this wiki locally