OP-1900 added deceleration check to autotakeoff failsafe
[librepilot.git] / flight / modules / PathFollower / inc / fixedwingflycontroller.h
bloba78c7c503ccf4e6c07b633d65d1c1a21e19e5a1b
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 fixedwingflycontroller.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 FIXEDWINGFLYCONTROLLER_H
32 #define FIXEDWINGFLYCONTROLLER_H
33 #include "pathfollowercontrol.h"
35 class FixedWingFlyController : public PathFollowerControl {
36 protected:
37 static FixedWingFlyController *p_inst;
38 FixedWingFlyController();
41 public:
42 static FixedWingFlyController *instance()
44 if (!p_inst) {
45 p_inst = new FixedWingFlyController();
47 return p_inst;
50 int32_t Initialize(FixedWingPathFollowerSettingsData *fixedWingSettings);
51 void Activate(void);
52 void Deactivate(void);
53 void SettingsUpdated(void);
54 void UpdateAutoPilot(void);
55 void ObjectiveUpdated(void);
56 uint8_t IsActive(void);
57 uint8_t Mode(void);
58 void AirspeedStateUpdatedCb(__attribute__((unused)) UAVObjEvent * ev);
60 protected:
61 FixedWingPathFollowerSettingsData *fixedWingSettings;
63 uint8_t mActive;
64 uint8_t mMode;
65 // correct speed by measured airspeed
66 float indicatedAirspeedStateBias;
67 private:
68 void resetGlobals();
69 uint8_t updateAutoPilotFixedWing();
70 void updatePathVelocity(float kFF, bool limited);
71 uint8_t updateFixedDesiredAttitude();
72 bool correctCourse(float *C, float *V, float *F, float s);
73 int32_t lastAirspeedUpdate;
75 struct pid PIDposH[2];
76 struct pid PIDposV;
77 struct pid PIDcourse;
78 struct pid PIDspeed;
79 struct pid PIDpower;
82 #endif // FIXEDWINGFLYCONTROLLER_H