APM实战(1):下载和编译Ardupilot项目

APM和PX4是唯二的目前主流的开源飞控。相比较PX4,APM项目代码较为简洁高效,同时也符合目前开源飞控的一些主流协议。了解APM可以从下载和建造它的开源飞控项目开始。选择的系统为Ubuntu 22.04。

参考链接:
https://blog.csdn.net/w8www/article/details/148705284
https://github.com/ArduPilot/ardupilot/blob/master/BUILD.md

1 项目下载

从GitHub下载开源项目,在命令行输入

$ git clone --recursive https://github.com/ArduPilot/ardupilot

需要较长时间,其中包含多个子项目,如果考虑到网络连接稳定性,也可以采用分步的方式下载,如下

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

最后一个命令可以多次执行,以保证每一个子项目下载完整。

2 项目编译

进入到项目目录

$ cd ardupilot

目前ardupilot项目通过waf命令来进行编译,通常的编译顺序示例如下

$ ./waf config --board CubeBlack
$ ./waf copter

先对编译进行设置,–board CubeBlack 表示适配的板卡类型,常用的板卡类型有

./waf configure --board bebop --static # Bebop or Bebop2
./waf configure --board edge           # emlid edge
./waf configure --board fmuv3          # 3DR Pixhawk 2 boards
./waf configure --board navio2         # emlid navio2
./waf configure --board Pixhawk1       # Pixhawk1
./waf configure --board CubeBlack      # Hex/ProfiCNC Cube Black (formerly known as Pixhawk 2.1)
./waf configure --board Pixracer       # Pixracer
./waf configure --board skyviper-v2450 # SkyRocket's SkyViper GPS drone using ChibiOS
./waf configure --board sitl           # software-in-the-loop simulator
./waf configure --board sitl --debug   # software-in-the-loop simulator with debug symbols

其中,sitl是一个很有用的选项,用于建立用于仿真环境的程序,在后面会介绍到。
后面的waf命令正式编译项目,copter为编译选项,表示编译生成多旋翼飞行器的飞行控制程序。也有多种类型可以选择。

./waf copter                            # All multirotor types
./waf heli                              # Helicopter types
./waf plane                             # Fixed wing airplanes including VTOL
./waf rover                             # Ground-based rovers and surface boats
./waf sub                               # ROV and other submarines
./waf antennatracker                    # Antenna trackers
./waf AP_Periph                         # AP Peripheral

这样就编译完成,编译完成后,会在项目的

build/[board_type]/bin

子目录中产生相应的飞控程序,其中board_type表示板卡类型,如CubeBlack、fmuv3、sitl等

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值