-
- Recommended: Install Google Cartographer with rosdep
Clone this repository into your ros2 workspace alongside ardupilot_gz:
cd ~/ros2_ws/src
git clone git@github.com:ardupilot/ardupilot_ros.gitIf using a non-default Gazebo version for your ROS distro (e.g. Gazebo Harmonic with ROS 2 Humble),
add Gazebo's rosdep sources so package.xml dependencies such as ros_gz_sim resolve correctly.
See the Gazebo rosdep guide
for details:
sudo wget https://raw.githubusercontent.com/osrf/osrf-rosdep/master/gz/00-gazebo.list -O /etc/ros/rosdep/sources.list.d/00-gazebo.list
rosdep updateInstall dependencies using rosdep:
cd ~/ros2_ws
rosdep install --from-paths src --ignore-src -r --skip-keys gazebo-ros-pkgsBuild it with colcon build:
cd ~/ros2_ws
source /opt/ros/humble/setup.bash
colcon build --packages-up-to ardupilot_ros ardupilot_gz_bringup
Refer to individual package READMEs for detailed usage instructions:
- ardupilot_cartographer: Instructions to run Cartographer SLAM.
The ardupilot_gui contains a simple ROS2 GUI for viewing and controlling the vehicle. It can be
launched via:
cd ~/ros2_ws
source /opt/ros/humble/setup.bash
source ./install/setup.sh
ros2 launch ardupilot_gui ardupilot_gui.launch.pyBy default the GUI will connect to the vehicle with a System ID of 1 (Ardupilot default when using DDS_USE_NS=1)
If using a different System ID, use arguments to specify:
# Connect to vehicle with System ID 2
ros2 launch ardupilot_gui ardupilot_gui.launch.py sysid:=2For usage with older versions of ArduPilot that do not have the DDS_USE_NS parameter, use a sysid of 0:
# Connect to vehicle that doesn't use the DDS_USE_NS parameter
ros2 launch ardupilot_gui ardupilot_gui.launch.py sysid:=0- Ensure the pre-commit hooks pass locally before creating your pull request by installing the hooks before committing.
pre-commit install git commit
- See the ArduPilot Contributing Guide