User Tools

Writing Gazebo Plugins

This section will cover how to write gazebo plugins and how to integrate them with ROS. There are a number of tutorials online as well as examples in the robosub simulator repo but it can all be a little hard to find. Thus I'll mostly just be gathering all the resources here and giving a few tips.

For an overview of writing gazebo plugins see here.

To see how ROS integration works with gazebo plugins go here.

The best resource to see examples of gazebo plugins in action is our robosub_simulator repo, especially these files:

A couple things to note when working with plugins:

  • Your GAZEBO_PLUGIN_PATH must contain the path where your plugins are compiled to. By default compiled libraries are put in your ros_workspace/devel/lib folder. This path (and others) are set up in the simulator repo's package.xml.
  • Gazebo does not automatically reload plugins when they are recompiled. Unfortunately this means you will have to restart gazebo every time you make a change.
  • The update loop of the plugin (setup here and defined here) is run every single frame (50+ times/second) so make sure it is optimized.