一.开发环境
Ubuntu Kylin 14.04
代码查阅工具
Qt Creator 以及Vim
二.具体步骤
官网永远是一个埋藏着宝藏的地方,在官网中给出了如何添加一种新的飞行模式
http://www.ardupilot.org/dev/docs/apmcopter-adding-a-new-flight-mode.html
但是由于固件不断在更新,所以添加一种新的飞行模式与官网的介绍稍微有一些不同
(1)首先是在define.h中添加一个新的宏定义如:
POSHOLD = 16, // automatic position hold with manual override, with automatic throttle
BRAKE = 17, // full-brake using inertial/GPS system, no pilot input
THROW = 18, // throw to launch mode using inertial/GPS system, no pilot input
NEWFLIGHTMODE = 19
(2)
新建一个control_xxxx.cpp的文件中,在文件中包含Copter.h头文件
文件中主要是一个xxxx_init()和xxxx_run()函数
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#include "Copter.h"