飞控开发linux
基本架构。git
ArduPilot的基本架构被分红5个主要部分:
vehicle directories。
AP_HAL。
libraries。
tools directories。
external support code。
github
vehicle directories(模型类型)。web
当前共有4种模型:ArduPlane, ArduCopter, APMrover2 和 AntennaTracker。
架构
AP_HAL(硬件抽象层)。
该AP_HAL层(硬件抽象层)是咱们如何让ArduPilot移植到许多不一样的平台。有一个在库一个顶级AP_HAL/ AP_HAL定义的代码的其他部分有特定板的功能接口,而后有一个AP_HAL_XXX子目录每块板的类型,例如用于AP_HAL_AVR基于AVR板,AP_HAL_PX4的PX4板和AP_HAL_Linux基于Linux的板。工具
tools directories(工具目录)。
这些工具目录是杂项支持目录。好比自动测试和日志回放工具oop
external support code(外部支持代码)。
在一些平台上,咱们须要外部支持的代码,以提供额外的功能的支持。目前,外部支持代码:测试
PX4NuttX – the core NuttX RTOS used on PX4 boards (PX4NuttX – NuttX RTOS的内核。)
PX4Firmware PX4Firmware – PX4中间层固件和驱动程序。
uavcan uavcan – can通讯协议。
mavlinkmavlink – mavlink协议。ui
The build system is based around make, but also supports the old arduino IDE for AVR builds. The makefiles are in the mk/ directory, and define build rules for each type of supported boardspa
To build a vehicle or other ‘sketch’ for a particular board target you would type “make TARGET”, where TARGET is the board type. The following board types are currently available:
make apm1 – the APM1 board
make apm2 – the APM2 board
make px4-v1 – the PX4v1
make px4-v2 – the Pixhawk (and Arsov AUAV-X2)
make pxf – the BBB+PXF cape combination
make navio – the RaspberryPi+NavIO cape combination
make linux – a generic Linux build
make flymaple – the FlyMaple board
make vrbain – the VRBrain boards
make sitl – the SITL software in the loop simulation
More ports are being added all the time, so check “make help” file for new targets.
For each of these builds you can add additional qualifiers, and on some you can do a parallel build to speed things up. For example, in the Copter directory you could do:
make apm2-octa -j8
meaning do a build for OctaCopter on apm2 with an 8 way parallel build. You should also look into enabling ccache for faster builds.
Some boards also support upload of firmware directly from make. For example:
make px4-v2-upload
will build and upload a sketch on a Pixhawk.
There are also helper make targets for specific boards, such as:
make clean – clean the build for non-px4 targets
make px4-clean – completely clean the build for PX4 targets
make px4-cleandep – cleanup just dependencies for PX4 targets