ROS 2 with Gazebo

Once ROS2 is correctly installed and running sitl, we can integrate Ardupilot with Gazebo.

First, install Gazebo Garden <>.

Next, set up all the necessary ROS 2 packages in the workspace.

We will clone the required repositories using vcstool <> and a ros2.repos files:

cd ~/ros2_ws/src
vcs import --recursive < ros2_gz.repos

Set the gazebo version

export GZ_VERSION=garden

Update ROS dependencies:

cd ~/ros2_ws
source /opt/ros/humble/setup.bash
sudo apt update
rosdep update
rosdep install --rosdistro $ROS_DISTRO --from-paths src -i -r -y


cd ~/ros2_ws
colcon build --cmake-args -DBUILD_TESTING=ON

If you’d like to test your installation, run:

cd ~/ros2_ws
source ./install/setup.bash
colcon test --packages-select ardupilot_sitl ardupilot_dds_tests ardupilot_gazebo ardupilot_gz_applications ardupilot_gz_description ardupilot_gz_gazebo ardupilot_gz_bringup
colcon test-result --all --verbose

Finally, you can source the workspace and launch one of the example Gazebo simulations:

source ~/ros2_ws/install/
ros2 launch ardupilot_gz_bringup

For more information regarding the ardupilot_gz package refer to ardupilot_gz/

Examples available

  • Iris Runway (Copter)

ros2 launch ardupilot_gz_bringup
  • Iris Maze (Copter)

ros2 launch ardupilot_gz_bringup

Here is a demo video of Ardupilot working with ROS 2 and Gazebo: