Some helpful resources to consider:

https://classic.gazebosim.org/tutorials?tut=ros_gzplugins

This website have some examples on Gazebo Plugin, However it is outdated.

https://github.com/ros-simulation/gazebo_ros_pkgs/tree/ros2/gazebo_plugins/include/gazebo_plugins

This folder in GitHub have good examples for various Gazebo Plugins and we will use it in this section.


What is a Gazebo Plugin

A Gazebo plugin is a piece of code that extends the functionality of Gazebo by interacting with simulation elements such as robots, sensors, and the environment. Plugins are written in C++ and can be used to control robot behavior, process sensor data, or modify the physics engine. They are categorized into different types, including world plugins, model plugins, sensor plugins, and system plugins.

Types of Gazebo Plugins:

  1. World Plugins – Modify and control the simulation environment (e.g., changing gravity, spawning models dynamically).
  2. Model Plugins – Attach to a robot or object to control its behavior (e.g., adding a custom controller).
  3. Sensor Plugins – Process and manipulate sensor data in real-time (e.g., modifying LiDAR output).
  4. System Plugins – Affect the entire simulation, such as managing physics properties.

Using Gazebo Plugins to Control a Robot


The Gazebo Plugin that we are going to use is called Differential Drive. Following the below link shows us a code example: