Vagrant上运行SITL
打算给Tower加个手机遥控的功能,用运行于vagrant sitl来联合调试,在公司的网络条件很好的情况下没出任何错,都是根据http://ardupilot.org/dev/docs/setting-up-sitl-using-vagrant.html运行,但家里就不行,先是vagrant的box下载不下来,然后是ubuntu的apt源还是官方的,太慢,接着就是pip2也不行,在此把解决的方案记录下来,方便大家避开这些坑。
1.ardupilot只clone 最后一次commit
git clone --depth=1 https://github.com/ArduPilot/ardupilot.git
2.vagrant box 改为本地
box先用迅雷下载,地址在第一次执行vagrant up的时候有显示
ardupilot目录下Vagrantfile中找到 config.vm.box行下面加入 config.vm.box_url = "../../../../Downloads/artful-server-cloudimg-i386-vagrant.box"
3.apt源改为国内镜像
执行vagrant up --no-provision 不执行provison中配置的脚本
启动后vagrant ssh进入虚拟机
备份原来的源 sudo mv /etc/apt/sources.list /etc/apt/souces.list.bak
新建源 sudo vi /etc/apt/sources.list
拷入
deb http://mirrors.ustc.edu.cn/ubuntu/ artful main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ artful-security main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ artful-updates main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ artful-proposed main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ artful-backports main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ artful main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ artful-security main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ artful-updates main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ artful-proposed main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ artful-backports main restricted universe multiverse
4.改pip源
打开/ardupilot/Tools/scripts/install-prereqs-ubuntu.sh
找到sudo pip2那一行 改为
sudo pip2 -q install -U -i https://pypi.tuna.tsinghua.edu.cn/simple $PYTHON_PKGS
5.jsbsim 只clone最后一次commit
打开/ardupilot/Tools/scripts/build-jsbsim.sh
找到git clone 改为 git clone --depth=1 https://github.com/tridge/jsbsim.git
6./usr/bin/env: ‘python\r’: No such file or directory
git clone前执行 git config --global core.autocrlf false