Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROS Jazzy support #6378

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions dev/source/docs/ros2-gazebo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,28 @@ Ensure you have the prerequisites complete and working before beginning this Gaz
Install Gazebo
==============

First, install `Gazebo Harmonic (recommended) <https://gazebosim.org/docs/harmonic/install>`__ or `Gazebo Garden <https://gazebosim.org/docs/garden/install>`__.
First, install `Gazebo Harmonic (recommended) <https://gazebosim.org/docs/harmonic/install>`__ or `Gazebo Garden <https://gazebosim.org/docs/garden/install>`__. Please check the `Compatibility Matrix between ROS and Gazebo versions <https://gazebosim.org/docs/latest/ros_installation/#summary-of-compatible-ros-and-gazebo-combinations>`__.

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

We will clone the required repositories using `vcstool <https://github.com/dirk-thomas/vcstool>`__ and a `ros2.repos` files:
We will clone the required repositories using `vcstool <https://github.com/dirk-thomas/vcstool>`__ and a `.repos` files:

.. code-block:: bash
.. tabs::

.. tab:: Jazzy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. tab:: Jazzy
.. tab:: ROS 2 Jazzy


.. code-block:: bash

cd ~/ardu_ws
vcs import --input https://raw.githubusercontent.com/ArduPilot/ardupilot_gz/main/jazzy_gz.repos --recursive src

.. tab:: Humble
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. tab:: Humble
.. tab:: ROS 2 Humble


.. code-block:: bash

cd ~/ardu_ws
vcs import --input https://raw.githubusercontent.com/ArduPilot/ardupilot_gz/main/humble_gz.repos --recursive src
Comment on lines +28 to +40
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for ardupilot_gz, we could separate branches Jazzy and Humble, but since most of the development team is still on Humble that might cause headaches syncing the two branches. Simply having two .repos files is proposed instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy with either approach. In a few other repos in Github, I started using mergify.io, so the work to maintain multiple branches is very low.


cd ~/ardu_ws
vcs import --input https://raw.githubusercontent.com/ArduPilot/ardupilot_gz/main/ros2_gz.repos --recursive src

Set the Gazebo version to either ``harmonic`` (recommended) or ``garden``.
It's recommended to set this in your `~/.bashrc` file.
Expand All @@ -40,7 +52,7 @@ Update ROS dependencies:
.. code-block:: bash

cd ~/ardu_ws
source /opt/ros/humble/setup.bash
source /opt/ros/$ROS_DISTRO/setup.bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert. ROS_DISTRO is not set until AFTER you run this.
Consider doing it like source /opt/ros/<your_ros_distro>/setup.bash

sudo apt update
rosdep update
rosdep install --from-paths src --ignore-src -r
Expand Down
15 changes: 8 additions & 7 deletions dev/source/docs/ros2-sitl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,27 @@ You will need to run this command on every new shell you open to have access to

.. tabs::

.. group-tab:: ArduPilot 4.5
.. group-tab:: ArduPilot 4.6 and later

.. code-block:: bash

source /opt/ros/humble/setup.bash
source /opt/ros/$ROS_DISTRO/setup.bash
cd ~/ardu_ws/
colcon build --packages-up-to ardupilot_sitl
source install/setup.bash
ros2 launch ardupilot_sitl sitl_dds_udp.launch.py transport:=udp4 refs:=$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/dds_xrce_profile.xml synthetic_clock:=True wipe:=False model:=quad speedup:=1 slave:=0 instance:=0 defaults:=$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/copter.parm,$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/dds_udp.parm sim_address:=127.0.0.1 master:=tcp:127.0.0.1:5760 sitl:=127.0.0.1:5501

ros2 launch ardupilot_sitl sitl_dds_udp.launch.py transport:=udp4 synthetic_clock:=True wipe:=False model:=quad speedup:=1 slave:=0 instance:=0 defaults:=$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/copter.parm,$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/dds_udp.parm sim_address:=127.0.0.1 master:=tcp:127.0.0.1:5760 sitl:=127.0.0.1:5501

.. group-tab:: ArduPilot 4.6 and later
.. group-tab:: ArduPilot 4.5

.. code-block:: bash

source /opt/ros/humble/setup.bash
source /opt/ros/$ROS_DISTRO/setup.bash
cd ~/ardu_ws/
colcon build --packages-up-to ardupilot_sitl
source install/setup.bash
ros2 launch ardupilot_sitl sitl_dds_udp.launch.py transport:=udp4 synthetic_clock:=True wipe:=False model:=quad speedup:=1 slave:=0 instance:=0 defaults:=$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/copter.parm,$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/dds_udp.parm sim_address:=127.0.0.1 master:=tcp:127.0.0.1:5760 sitl:=127.0.0.1:5501
ros2 launch ardupilot_sitl sitl_dds_udp.launch.py transport:=udp4 refs:=$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/dds_xrce_profile.xml synthetic_clock:=True wipe:=False model:=quad speedup:=1 slave:=0 instance:=0 defaults:=$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/copter.parm,$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/dds_udp.parm sim_address:=127.0.0.1 master:=tcp:127.0.0.1:5760 sitl:=127.0.0.1:5501


Comment on lines +13 to +33
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes the tab order so that ArduPilot's newest version appears first. Seems intuitive

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree on that change! Now that 4.6 is in beta.




Expand Down
65 changes: 44 additions & 21 deletions dev/source/docs/ros2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,49 +17,59 @@ Prerequisites

- Learn to use ArduPilot first by following the relevant wiki for `Rover <https://ardupilot.org/rover/index.html>`__, `Copter <https://ardupilot.org/copter/index.html>`__ or `Plane <https://ardupilot.org/plane/index.html>`__.
- In particular, make sure the vehicle works well in Manual and Autonomous modes like Guided and Auto before trying to use ROS.
- Learn how to use ROS 2 by reading the `beginner tutorials <https://docs.ros.org/en/humble/Tutorials.html>`__. In the case of a problem with ROS, it is best to ask on ROS community forums first (or google your error).
- Learn how to use ROS 2 by reading the `beginner tutorials <https://docs.ros.org/en/rolling/Tutorials.html>`__. In the case of a problem with ROS, it is best to ask on ROS community forums first (or google your error).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer to use ROS Rolling when linking to generic documentation. Since we now support multiple ROS 2 versions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, can you add a note to select the right version in the dropdown?


We are keen to improve ArduPilot's support of ROS 2 so if you find issues (such as commands that do not seem to be supported), please report them in the `ArduPilot issues list <https://github.com/ArduPilot/ardupilot/issues>`__. A maintainer can add the `ROS` tag.

First, make sure that you have successfully installed `ROS 2 Humble <https://docs.ros.org/en/humble/Installation.html>`__ .
Currently, ROS 2 Humble is the only version supported.
First, make sure that you have successfully installed and configured your ROS 2 environment. ArduPilot supports ROS 2 `Humble <https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html>`__ and `Jazzy <https://docs.ros.org/en/jazzy/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html>`__.

You are about to create a new `ROS 2 workspace <https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Creating-A-Workspace/Creating-A-Workspace.html#id4>`__.
This page assumes that your workspace is named `ardu_ws` in your home directory, but feel free to adjust to your preferred location.

Before anything else, make sure that you have `sourced your ROS 2 environment <https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html#source-the-setup-files>`__
and check if it is `configured correctly <https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html#check-environment-variables>`__.

Finally, ensure you have `set up your ArduPilot build environment <https://ardupilot.org/dev/docs/building-the-code.html#setting-up-the-build-environment>`__.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pain point in the current installation instructions. The ArduPilot build environment should be built inside the ROS 2 workspace. If we tell the user to set it up here it might be confusing. So I moved this instruction further down.

This document suggests creating a new ROS 2 workspace from scratch, named `ardu_ws`, located in your home folder. If you already have a working ROS 2 workspace, feel free to adapt the instructions to your needs.

Installation (Ubuntu)
=====================

To make installation easy, we will clone the required repositories using `vcs` and a `ros2.repos` files:
To make installation easy, we will clone the required repositories using `vcs` and a `.repos` files:

.. code-block:: bash
.. tabs::

mkdir -p ~/ardu_ws/src
cd ~/ardu_ws
vcs import --recursive --input https://raw.githubusercontent.com/ArduPilot/ardupilot/master/Tools/ros2/ros2.repos src
.. tab:: Jazzy

.. code-block:: bash

mkdir -p ~/ardu_ws/src
cd ~/ardu_ws
vcs import --recursive --input https://raw.githubusercontent.com/ArduPilot/ardupilot/master/Tools/ros2/jazzy.repos src

.. tab:: Humble

.. code-block:: bash

mkdir -p ~/ardu_ws/src
cd ~/ardu_ws
vcs import --recursive --input https://raw.githubusercontent.com/ArduPilot/ardupilot/master/Tools/ros2/humble.repos src

This will take a few minutes to clone all the repositories your first time.

Now update all dependencies:
.. warning::
The `ardupilot` repository will be cloned in the `~/ardu_ws/src` folder during this process. Before proceeding, `set up your ArduPilot build environment <https://ardupilot.org/dev/docs/building-the-code.html#setting-up-the-build-environment>`__ inside the ROS 2 workspace.
If you already have a working ArduPilot build environment, you may move it inside the workspace instead, but be sure to change all script references too. It might be a good idea to check your `.bashrc` and `.profile`.

Now update all dependencies using `rosdep`:

.. code-block:: bash

cd ~/ardu_ws
sudo apt update
rosdep update
source /opt/ros/humble/setup.bash
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be unnecessary, the instructions assume that the ROS environment is setup and this is explicitly stated at the start

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not required for people to add this to your ~/.bashrc. I have tried to make the commands as foolproof as possible, and becuase of that, our support load has decreased a lot.

rosdep install --from-paths src --ignore-src -r -y

Installing the `MicroXRCEDDSGen` build dependency:

.. code-block:: bash

sudo apt install default-jre
# Gradle 7.6 is not supported by java versions >= 20
# https://docs.gradle.org/current/userguide/compatibility.html
sudo apt install openjdk-17-jre
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this available on Ubuntu 22?

cd ~/ardu_ws
git clone --recurse-submodules https://github.com/ardupilot/Micro-XRCE-DDS-Gen.git
cd Micro-XRCE-DDS-Gen
Expand Down Expand Up @@ -133,10 +143,23 @@ Installation (MacOS)

To make installation easy, we will install the required packages using `vcs` and a `ros2_macos.repos` files:

.. code-block:: bash
.. tabs::

cd ~/ardu_ws
vcs import --recursive --input https://raw.githubusercontent.com/ArduPilot/ardupilot/master/Tools/ros2/ros2_macos.repos src
.. tab:: Jazzy

.. code-block:: bash

mkdir -p ~/ardu_ws/src
cd ~/ardu_ws
vcs import --recursive --input https://raw.githubusercontent.com/ArduPilot/ardupilot/master/Tools/ros2/jazzy_macos.repos src

.. tab:: Humble

.. code-block:: bash

mkdir -p ~/ardu_ws/src
cd ~/ardu_ws
vcs import --recursive --input https://raw.githubusercontent.com/ArduPilot/ardupilot/master/Tools/ros2/humble_macos.repos src

Now update all dependencies:

Expand Down