diff --git a/dev/source/docs/ros.rst b/dev/source/docs/ros.rst index a32da61710..1259c41e6d 100644 --- a/dev/source/docs/ros.rst +++ b/dev/source/docs/ros.rst @@ -35,6 +35,7 @@ These pages will show you how to: ROS with SITL ROS 2 with SITL ROS with SITL in Gazebo + ROS 2 with SITL in Gazebo ROS with distance sensors ROS with Aruco Boards detection ROS with Apriltag Boards detection diff --git a/dev/source/docs/ros2-gazebo.rst b/dev/source/docs/ros2-gazebo.rst new file mode 100644 index 0000000000..6f115b84a1 --- /dev/null +++ b/dev/source/docs/ros2-gazebo.rst @@ -0,0 +1,56 @@ +.. _ros2-gazebo: + +================= +ROS 2 with Gazebo +================= + +Once ROS2 is correctly :ref:`installed ` and running :ref:`sitl `, we can integrate Ardupilot with Gazebo. For that, we will need some ROS 2 packages. + +We will install the required packages using `vcs` and a `ros2.repos` files: + +.. code-block:: bash + + cd ~/ros2_ws/src + wget https://raw.githubusercontent.com/ArduPilot/ardupilot_gz/main/ros2_gz.repos + vcs import --recursive < ros2_gz.repos + +Set the gazebo version + +.. code-block:: bash + + export GZ_VERSION=garden + +Update ROS dependencies: + +.. code-block:: bash + + 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 + +Build: + +.. code-block:: bash + + cd ~/ros2_ws + colcon build --cmake-args -DBUILD_TESTING=ON + +If you'd like to test your installation, run: + +.. code-block:: bash + + 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: + +.. code-block:: bash + + source ~/ros2_ws/install/setup.sh + ros2 launch ardupilot_gz_bringup iris_runway.launch.py + +To see all the exemples available, as well as more information regarding the package in general, refer to `ardupilot_gz/README.md `__. \ No newline at end of file