Install MAVROS
cd ~/ros_catkin_ws
Attention
Use kinetic in the following command, even if your ROS distro is newer.
rosinstall_generator --rosdistro kinetic mavlink | tee /tmp/mavros.rosinstall
rosinstall_generator --upstream mavros | tee -a /tmp/mavros.rosinstall
Attention
If rosdep fails to install dependencies, because they are not available in the repositories, install them via rosinstall_generator and wstool.
wstool merge -t src /tmp/mavros.rosinstall
wstool update -t src -j4
sudo apt update
rosdep install --from-paths src --ignore-src -y
So if your console output of rosdep install is
1ERROR: the following packages/stacks could not have their rosdep keys resolved
2to system dependencies:
3mavros: No definition of [geographic_msgs] for OS [debian]
4mavros_extras: No definition of [urdf] for OS [debian]
5test_mavros: No definition of [control_toolbox] for OS [debian]
6mavros_msgs: No definition of [geographic_msgs] for OS [debian]
7Continuing to install resolvable dependencies...
Execute
rosinstall_generator urdf control_toolbox geographic_msgs | tee /tmp/mavros_deps.rosinstall
and
wstool merge -t src /tmp/mavros_deps.rosinstall
wstool update -t src -j4
rerun rosdep install and make sure all dependecies get resolved.
Note
It might be necessary to do some iterations of rosdep install and the manual installation of dependecies until everything compiles successfully.
Build the code:
sudo catkin build --cmake-args -DCMAKE_BUILD_TYPE=Release
After the build process has finished cleanly, you might have to execute the geographiclib install script:
sudo ./src/mavros/mavros/scripts/install_geographiclib_datasets.sh