Ubuntu18.04下MAVROS源码安装教程

该文介绍了如何在Ubuntu18.04系统中安装ROSMelodic,包括依赖项的安装、MAVROS源码的获取与编译,以及环境变量的设置。在安装过程中,特别提到了解决gitclone可能遇到的网络问题和GeographicLib数据集的安装。
摘要由CSDN通过智能技术生成

一、ROS安装

        与Ubuntu18.04系统适配的ROS版本为Melodic,详细安装方法请参考http://wiki.ros.org/melodic/Installation/Ubuntu

二、依赖项安装

        在终端运行:

sudo apt-get install python-catkin-tools python-rosinstall-generator -y

三、MAVROS源码安装

        1. 创建MAVROS源码安装的工作空间并进行初始化。在终端依次运行:

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

        2. 在mavros_catkin_ws目录下获取MAVLINK。在终端运行:

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

        3.在mavros_catkin_ws/src目录下获取MAVROS。在终端依次运行:

rosinstall_generator --upstream mavros | tee -a /tmp/mavros.rosinstall
git clone https://github.com/mavlink/mavros.git

        可能会由于网络问题导致git clone失败,可尝试在终端运行: 

git clone https://ghproxy.com/https://github.com/mavlink/mavros.git

        4. 返回mavros_catkin_ws目录下安装MAVROS。在终端依次运行:

wstool merge -t src /tmp/mavros.rosinstall
wstool update -t src -j4

        在更新时,终端可能会报:

        选择d,终端可能会报:

        解决办法是在mavros_catkin_ws/src目录下按CTRL+H,找到并编辑.rosinstall隐藏文件,分别将mavlink和mavros下载的uri网址前面添加https://ghproxy.com/,保存退出。例如:https://ghproxy.com/https://github.com/mavlink/mavros.git

        更新成功后,mavros_catkin_ws/src目录下会有mavlink,mavros两个文件夹。

        5. 继续在mavros_catkin_ws目录下,在终端运行:

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

        6. 安装GeographicLib数据集。在终端运行:

sudo ./src/mavros/mavros/scripts/install_geographiclib_datasets.sh

        7. 编译源码。在mavros_catkin_ws目录下,在终端运行:

catkin build

        8. 添加环境变量,在终端运行:

sudo gedit ~/.bashrc

        在.bashrc文件最后添加:

source ~/mavros_catkin_ws/devel/setup.bash

        保存后退出,在终端运行:

source ~/.bashrc

        测试MAVROS环境是否配置成功。在终端运行:

roscd mavros

        若终端显示:~/mavros_catkin_ws/src/mavros/mavros,则表示MAVROS环境配置成功。

  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值