DroneKit-python入门教程教程-安装SITL(linux)
DroneKit-python入门教程教程-安装SITL(linux)
说明:
- 介绍如何在linux下安装DroneKit-sitl
Apt 安装步骤:
- 安装dronekit-sitl
pip install dronekit-sitl -UI
- 测试运行Copter
dronekit-sitl copter
- SITL会开始并等待其他设备通过TCP连接到127.0.0.1:5760
- 可以选择不同机型和版本,以及相关参数,位置等
dronekit-sitl plane-3.3.0 --home=-35.363261,149.165230,584,353
- 更多命令可以查看
dronekit-sitl -h #List all parameters to dronekit-sitl.
dronekit-sitl copter -h #List additional parameters for the specified vehicle (in this case "copter").
dronekit-sitl --list #List all available vehicles.
dronekit-sitl --reset #Delete all downloaded vehicle binaries.
dronekit-sitl ./path [args...] #Start SITL instance at target file location.
- 可以通过DroneKit-Python脚本连接到SITL
vehicle = connect('tcp:127.0.0.1:5760', wait_ready=True)
- 想了解更多SITL的接口
源码安装SITL
- 安装依赖
sudo apt-get update
sudo apt-get install git
sudo apt-get install gitk git-gui
- 下载ardupilot
git clone https://github.com/your-github-userid/ardupilot
cd ardupilot
git submodule update --init --recursive
- 基于ubuntu环境,安装相关依赖
Tools/environment_install/install-prereqs-ubuntu.sh -y
- 重新加载环境变量
. ~/.profile
- 添加环境变量到bashrc
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
测试启动SITL
cd ardupilot/ArduCopter
$ sim_vehicle.py -v ArduSubAPM: 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
成功安装之后, 就包含了mavproxy,SITL。
安装MAVProxy和pymavlink
pip install --upgrade pymavlink MAVProxy --user
参考:
- https://dronekit-python.readthedocs.io/en/latest/develop/sitl_setup.html
- https://ardupilot.org/dev/docs/setting-up-sitl-on-linux.html
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号