Skip to content

Commit

Permalink
add ros2-gazebo page
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-fuoco committed Aug 15, 2023
1 parent dfb8e05 commit cf62a7b
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev/source/docs/ros.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ These pages will show you how to:
ROS with SITL <ros-sitl>
ROS 2 with SITL <ros2-sitl>
ROS with SITL in Gazebo <ros-gazebo>
ROS 2 with SITL in Gazebo <ros2-gazebo>
ROS with distance sensors <ros-distance-sensors>
ROS with Aruco Boards detection <ros-aruco-detection>
ROS with Apriltag Boards detection <ros-apriltag-detection>
Expand Down
56 changes: 56 additions & 0 deletions dev/source/docs/ros2-gazebo.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.. _ros2-gazebo:

=================
ROS 2 with Gazebo
=================

Once ROS2 is correctly :ref:`installed <ros2>` and running :ref:`sitl <ros2-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 <https://github.com/ArduPilot/ardupilot_gz#ardupilot_gz>`__.

0 comments on commit cf62a7b

Please sign in to comment.