June 15, 2025

ROS2 Jazzy Tutorial: Develop and Control Gazebo Model of Mobile Robot in ROS2 and C++

In this Robot Operating System 2 (ROS2) Jazzy tutorial, we explain how to develop a Gazebo model of a 2D mobile robot and how to write a C++ ROS2 program for controlling the simulation. We explain how to write the complete ROS2 package and all supporting files from scratch.

More precisely, in this tutorial, we explain

  1. How to install Gazebo Harmonic in ROS2 Jazzy.
  2. How to write a ROS2 package from scratch.
  3. How to model a mobile robot and its dynamics in Gazebo.
  4. How to connect ROS2 and Gazebo topics, and how to send information between Gazebo and ROS2, and vice-versa.
  5. How to write a C++ ROS2 code for controlling the robot motion in Gazebo.

YouTube tutorial is given below.