2 ******************************************************************************
3 * @addtogroup LibrePilotModules LibrePilot Modules
5 * @addtogroup FixedWing CONTROL interface class
6 * @brief CONTROL interface class for pathfollower fixed wing fly controller
9 * @file fixedwingautotakeoffcontroller.h
10 * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
11 * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2015.
12 * @brief Executes CONTROL for fixed wing fly objectives
14 * @see The GNU Public License (GPL) Version 3
16 *****************************************************************************/
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 3 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful, but
24 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
25 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #ifndef FIXEDWINGAUTOTAKEOFFCONTROLLER_H
33 #define FIXEDWINGAUTOTAKEOFFCONTROLLER_H
34 #include "fixedwingflycontroller.h"
36 // AutoTakeoff state machine
38 FW_AUTOTAKEOFF_STATE_INACTIVE
= 0,
39 FW_AUTOTAKEOFF_STATE_LAUNCH
,
40 FW_AUTOTAKEOFF_STATE_CLIMB
,
41 FW_AUTOTAKEOFF_STATE_HOLD
,
42 FW_AUTOTAKEOFF_STATE_ABORT
,
43 FW_AUTOTAKEOFF_STATE_SIZE
44 } FixedWingAutoTakeoffControllerState_T
;
46 class FixedWingAutoTakeoffController
: public FixedWingFlyController
{
48 static FixedWingAutoTakeoffController
*p_inst
;
51 static FixedWingFlyController
*instance()
54 p_inst
= new FixedWingAutoTakeoffController();
59 void UpdateAutoPilot(void);
63 FixedWingAutoTakeoffControllerState_T state
;
68 void setState(FixedWingAutoTakeoffControllerState_T setstate
);
69 void setAttitude(bool unsafe
);
70 float getAirspeed(void);
72 void run_inactive(void);
73 void run_launch(void);
77 void init_inactive(void);
78 void init_launch(void);
79 void init_climb(void);
81 void init_abort(void);
82 void(FixedWingAutoTakeoffController::*const runFunctionTable
[FW_AUTOTAKEOFF_STATE_SIZE
]) (void) = {
83 &FixedWingAutoTakeoffController::run_inactive
,
84 &FixedWingAutoTakeoffController::run_launch
,
85 &FixedWingAutoTakeoffController::run_climb
,
86 &FixedWingAutoTakeoffController::run_hold
,
87 &FixedWingAutoTakeoffController::run_abort
89 void(FixedWingAutoTakeoffController::*const initFunctionTable
[FW_AUTOTAKEOFF_STATE_SIZE
]) (void) = {
90 &FixedWingAutoTakeoffController::init_inactive
,
91 &FixedWingAutoTakeoffController::init_launch
,
92 &FixedWingAutoTakeoffController::init_climb
,
93 &FixedWingAutoTakeoffController::init_hold
,
94 &FixedWingAutoTakeoffController::init_abort
98 #endif // FIXEDWINGAUTOTAKEOFFCONTROLLER_H