ubuntu 安装mavros和mavlink

创建mavros_install.sh脚本,复制一下内容:

#!/bin/bash
# MAVROS: https://dev.px4.io/en/ros/mavros_installation.html
## Create catkin workspace
mkdir -p ~/catkin_mav/src
cd ~/catkin_mav

## Install dependencies
sudo apt-get install python-wstool python-rosinstall-generator python-catkin-tools -y

## Initialise wstool
wstool init ~/catkin_mav/src

## Build MAVROS
### Get source (upstream - released)
rosinstall_generator --upstream mavros | tee /tmp/mavros.rosinstall
### Get latest released mavlink package
rosinstall_generator mavlink | tee -a /tmp/mavros.rosinstall
### Setup workspace & install deps
wstool merge -t src /tmp/mavros.rosinstall
wstool update -t src
rosdep install --from-paths src --ignore-src --rosdistro kinetic -y

./src/mavros/mavros/scripts/install_geographiclib_datasets.sh
## Build!
catkin build
## Re-source environment to reflect new packages/build environment
echo "source ~/catkin_mav/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

sudo apt-get install ros-kinetic-rqt ros-kinetic-rqt-common-plugins ros-kinetic-rqt-robot-plugins -y

 

然后执行 souurce mavros_install.sh

如果在安装过程中出现下边的错误:

Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml)>

将:151.101.76.133 raw.githubusercontent.com 加入到/etc/hosts中,重新执行安装命令

你可能感兴趣的:(mavros)