mavros ArduSub SITL Ubuntu环境搭建

ArduSub SITL Ubuntu环境搭建

第一步:
http://ardupilot.org/dev/docs/building-setup-linux.html#building-setup-linux
Setting up the Build Environment (Linux/Ubuntu)
如果已经有git了。可以忽略页面中git相关的步骤。

git clone https://github.com/ArduPilot/ardupilot
cd ardupilot
git submodule update --init --recursive

Tools/environment_install/install-prereqs-ubuntu.sh -y  
(安装耗时很长,需要权限, 可能报错,报错再根据提示或根据经验进行修正)
. ~/.profile

找到你的路径,根据你的路径修改环境变量,例如:
export PATH=$PATH:$HOME/ardupilot/Tools/autotest
export PATH=/usr/lib/ccache:$PATH

安装交叉编译工具
cd TARGET_DIR
tar -xjvf gcc-arm-none-eabi-4_9-2015q3-20150921-linux.tar.bz2

export PATH=$PATH:TARGET_DIR/gcc-arm-none-eabi-4_9-2015q3/bin

sudo apt-get install ccache

cd /usr/lib/ccache
sudo ln -s /usr/bin/ccache arm-none-eabi-g++
sudo ln -s /usr/bin/ccache arm-none-eabi-gcc

第二步:
http://ardupilot.org/dev/docs/setting-up-sitl-on-linux.html
启动SITL

$ sim_vehicle.py -v ArduSub

当显示
.....
APM: EKF2 IMU0 is using GPS
APM: EKF2 IMU1 is using GPS
Flight battery 100 percent
就成功了。
按ctrl+C。再启动sim_vehicle.py

ardupilot/Tools/autotest$ sim_vehicle.py -L RATBeach --out=udp:0.0.0.0:14550 --map –console -v ArduSub

第三步,安装运行mavros相关软件包
$sudo apt-get install ros-kinetic-mavros*

修改apm.launch
<launch>
    <!-- vim: set ft=xml noet : -->
    <!-- example launch script for ArduPilot based FCU's 

    <arg name="fcu_url" default="/dev/ttyACM0:57600" />
-->
    <arg name="fcu_url" default="udp://127.0.0.1:14550@" />
    <arg name="gcs_url" default="" />
    <arg name="tgt_system" default="1" />
    <arg name="tgt_component" default="1" />
    <arg name="fcu_protocol" default="v2.0" />
    <arg name="respawn_mavros" default="false" />

    <include file="$(find mavros)/launch/node.launch">
        <arg name="pluginlists_yaml" value="$(find mavros)/launch/apm_pluginlists.yaml" />
        <arg name="config_yaml" value="$(find mavros)/launch/apm_config.yaml" />

        <arg name="fcu_url" value="$(arg fcu_url)" />
        <arg name="gcs_url" value="$(arg gcs_url)" />
        <arg name="tgt_system" value="$(arg tgt_system)" />
        <arg name="tgt_component" value="$(arg tgt_component)" />
        
        <arg name="fcu_protocol" value="$(arg fcu_protocol)" />
        <arg name="respawn_mavros" default="$(arg respawn_mavros)" />
    </include>
</launch>
运行修改后的apm.launch。
开始SITL了。

可能报错:
File not readable /usr/share/GeographicLib/geoids/egm96-5.pgm | 
Run install_geographiclib_dataset.sh script in order to install Geoid Model dataset!
解决方法:从github下mavros源码。源码中找到install_geographiclib_dataset.sh  使用root用户执行此脚本。
$ find . -name install*
./mavros/scripts/install_geographiclib_datasets.sh

安装时间很长。安装好之后,再次遇到同样的错误。发现安装目录在/usr/local/share/GeographicLib/ 而 launch读取路径是/usr/share/GeographicLib。拷贝一份到/usr/share/GeographicLib路径下。OK。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值