Ubuntu18.04创建存放mavros的工作空间

mkdir -p ~/mavros_ws/src
cd ~/mavros_ws
catkin init
wstool init src

rosinstall_generator --rosdistro melodic mavlink | tee /tmp/mavros.rosinstall
rosinstall_generator --upstream mavros | tee -a /tmp/mavros.rosinstall

wstool merge -t src /tmp/mavros.rosinstall
wstool update -t src -j
rosdep install --from-paths src --ignore-src -y

安装geographiclib_datasets
sudo ./src/mavros/mavros/scripts/install_geographiclib_datasets.sh

编译工作空间中的源码

catkin build

如果缺少包
rosinstall_generator --rosdistro kinetic "所缺的包" | tee -a /tmp/mavros.rosinstall
每次添加一个新的包,必须执行如下三步去更新

wstool merge -t src /tmp/mavros.rosinstall
wstool update -t src -j
rosdep install --from-paths src --ignore-src -y

如果需要下载的包很多,这一步会一直卡在前几个源
可以通过临时修改
src/.rosinstall
来更新指定数据源

建议参考
https://blog.csdn.net/qq_43414059/article/details/104065219

原文地址:https://www.cnblogs.com/zhangxuechao/p/14951698.html