give me an I!
[librepilot.git] / flight / modules / PathFollower / inc / fixedwingautotakeoffcontroller.h
blobc45202b3790fff4ea7e66e2a1c1e0c2adb62bd70
1 /**
2 ******************************************************************************
3 * @addtogroup OpenPilotModules OpenPilot Modules
4 * @{
5 * @addtogroup FixedWing CONTROL interface class
6 * @brief CONTROL interface class for pathfollower fixed wing fly controller
7 * @{
9 * @file fixedwingautotakeoffcontroller.h
10 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2015.
11 * @brief Executes CONTROL for fixed wing fly objectives
13 * @see The GNU Public License (GPL) Version 3
15 *****************************************************************************/
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 3 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful, but
23 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 * for more details.
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #ifndef FIXEDWINGAUTOTAKEOFFCONTROLLER_H
32 #define FIXEDWINGAUTOTAKEOFFCONTROLLER_H
33 #include "fixedwingflycontroller.h"
35 // AutoTakeoff state machine
36 typedef enum {
37 FW_AUTOTAKEOFF_STATE_INACTIVE = 0,
38 FW_AUTOTAKEOFF_STATE_LAUNCH,
39 FW_AUTOTAKEOFF_STATE_CLIMB,
40 FW_AUTOTAKEOFF_STATE_HOLD,
41 FW_AUTOTAKEOFF_STATE_ABORT,
42 FW_AUTOTAKEOFF_STATE_SIZE
43 } FixedWingAutoTakeoffControllerState_T;
45 class FixedWingAutoTakeoffController : public FixedWingFlyController {
46 public:
47 void Activate(void);
48 void UpdateAutoPilot(void);
50 private:
51 // variables
52 FixedWingAutoTakeoffControllerState_T state;
53 float initYaw;
54 float maxVelocity;
56 // functions
57 void setState(FixedWingAutoTakeoffControllerState_T setstate);
58 void setAttitude(bool unsafe);
59 float getAirspeed(void);
60 bool isUnsafe(void);
61 void run_inactive(void);
62 void run_launch(void);
63 void run_climb(void);
64 void run_hold(void);
65 void run_abort(void);
66 void init_inactive(void);
67 void init_launch(void);
68 void init_climb(void);
69 void init_hold(void);
70 void init_abort(void);
71 void(FixedWingAutoTakeoffController::*const runFunctionTable[FW_AUTOTAKEOFF_STATE_SIZE]) (void) = {
72 &FixedWingAutoTakeoffController::run_inactive,
73 &FixedWingAutoTakeoffController::run_launch,
74 &FixedWingAutoTakeoffController::run_climb,
75 &FixedWingAutoTakeoffController::run_hold,
76 &FixedWingAutoTakeoffController::run_abort
78 void(FixedWingAutoTakeoffController::*const initFunctionTable[FW_AUTOTAKEOFF_STATE_SIZE]) (void) = {
79 &FixedWingAutoTakeoffController::init_inactive,
80 &FixedWingAutoTakeoffController::init_launch,
81 &FixedWingAutoTakeoffController::init_climb,
82 &FixedWingAutoTakeoffController::init_hold,
83 &FixedWingAutoTakeoffController::init_abort
87 #endif // FIXEDWINGAUTOTAKEOFFCONTROLLER_H