APM代码学习笔记3:执行过程

以Linux平台ArduPlane为例

\ArduPlane\Plane.cpp 定义Plane类 继承自AP_HAL::HAL::Callbacks ,获取hal对象。

\ArduPlane\ArduPlane.cpp 实现setup和loop函数 放置main函数

\libraries\AP_HAL\AP_HAL_Main.h 预处理定义了两种main函数 一种默认setup loop回调,给example用的。另一种需传入AP_HAL::HAL::Callbacks的子类 如Copter、Plane。main函数仅一行就是执行hal.run方法

\libraries\AP_HAL_Linux\HAL_Linux_Class.cpp 实现hal.run方法 初始化i2c spi uart 执行setup、loop

 

posted @ 2016-04-15 18:11  kakain  阅读(323)  评论(0编辑  收藏  举报