飛控開發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