Skip to content

ROS Interface Plugin

Giuseppe Silano edited this page Apr 7, 2019 · 3 revisions

Overview

The ROS interface plugin (gazebo_ros_interface_plugin.cpp/.hpp) serves as a message communication interface between the Gazebo and ROS frameworks.

Connection Messages

Connection messages are the way of dynamically setting up Gazebo topic to ROS topic routing, and vice-versa.

Note that "connection" messages must be sent to the ROS interface plugin AFTER it has been loaded. Because the plugin loading order is somewhat arbitrary, this means that the connection messages cannot be sent in the Load() method of other plugins. Instead, they have to be sent in the OnUpdate() method.

You will see the following syntax in many plugins:

void GazeboPlugin::OnUpdate(const common::UpdateInfo& _info) {

  if(!pubs_and_subs_created_) {
    CreatePubsAndSubs();
    pubs_and_subs_created_ = true;
  }
}
Clone this wiki locally