Installation
ROS2 installation is out of scope for this guide, you should follow the official installation instructions.
Note
This guide is tested on the ROS2 Kilted release. But it is likely that your release will have quite similar set of commands.
Dependencies
Most of the ROS dependencies are supported and installed by rosdep, including external
libraries such as ASIO, Eigen and GeographicLib.
Since GeographicLib requires certain datasets so to fulfill certain calculations, these need to be installed manually by the user.
Warning
The geoid dataset is mandatory to allow the conversion between heights in order to respect ROS API. Not having the dataset available will shutdown the UAS node.
Binary package (deb)
ROS repository has binary packages for Ubuntu amd64 and aarch64.
Just use apt for installation:
Then install GeographicLib datasets using helper script:
Or alternative one-liner script:
curl -LsSf https://raw.githubusercontent.com/mavlink/mavros/ros2/mavros/scripts/install_geographiclib_datasets.sh | sudo bash
Build from source
Use vcs utility for retrieving sources and colcon tool for build.
Install vcs tool and rosinstall_generator
Create the workspace (unneeded if you already have it)
Get MAVLink and MAVROS repos
rosinstall_generator --format repos mavlink | tee /tmp/mavlink.repos
rosinstall_generator --format repos --upstream mavros | tee /tmp/mavros.repos
Note
--upstream - tells to use upstream git instead of git-buildpackage one.
Note
You may use --upstream-development to pull latest sources (ros2 branch).
Clone repos to workspace
Install dependencies
Note
If rosdep update fails due to permission issues in your environment, rerun it with sudo.
Install GeographicLib datasets
Build
Update environment
Verify installation
Note
Make sure that you use setup.bash or setup.zsh from workspace.
Otherwise ros2 run can't find nodes.
Devcontainer (optional)
You can use the provided devcontainer for a reproducible ROS 2 environment.
Open the folder in VS Code / VSCodium and run Dev Containers: Reopen in Container.
Available configs:
- default: .devcontainer/devcontainer.json (mounts only this repository)
- full workspace: .devcontainer/whole-workspace/devcontainer.json (expects repository at <workspace>/src/mavros)
After container creation, dependencies and tools are bootstrapped automatically by .devcontainer/post-create.sh.