OP-1900 added deceleration check to autotakeoff failsafe
[librepilot.git] / flight / modules / PathFollower / inc / pathfollowerfsm.h
blob0188cc71c8e319bcb184be29317e6af7c8b9d751
1 /**
2 ******************************************************************************
3 * @addtogroup OpenPilotModules OpenPilot Modules
4 * @{
5 * @addtogroup PathFollower FSM interface class
6 * @brief FSM interface class for pathfollower goal fsm implementations
7 * @{
9 * @file pathfollowerfsm.h
10 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2015.
11 * @brief Interface class for PathFollower FSMs
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 PATHFOLLOWERFSM_H
32 #define PATHFOLLOWERFSM_H
34 extern "C" {
35 #include <stabilizationdesired.h>
37 #include <pidcontroldowncallback.h>
39 typedef enum {
40 PFFSM_STATE_INACTIVE = 0, // Inactive state is the initialised state on startup
41 PFFSM_STATE_ACTIVE,
42 PFFSM_STATE_DISARMED,
43 PFFSM_STATE_ABORT // Abort on error
44 } PathFollowerFSMState_T;
46 class PathFollowerFSM : public PIDControlDownCallback {
47 public:
48 // PathFollowerFSM() {};
49 virtual void Inactive(void) {}
50 virtual void Activate(void) {}
51 virtual void Update(void) {}
52 virtual void SettingsUpdated(void) {}
53 virtual void BoundThrust(__attribute__((unused)) float &ulow, __attribute__((unused)) float &uhigh) {}
54 virtual PathFollowerFSMState_T GetCurrentState(void)
56 return PFFSM_STATE_INACTIVE;
58 virtual void ConstrainStabiDesired(__attribute__((unused)) StabilizationDesiredData *stabDesired) {}
59 virtual float BoundVelocityDown(float velocity)
61 return velocity;
63 virtual void CheckPidScaler(__attribute__((unused)) pid_scaler *scaler) {}
64 virtual void GetYaw(bool &yaw_attitude, float &yaw_direction)
66 yaw_attitude = false; yaw_direction = 0.0f;
68 virtual void Abort(void) {}
69 virtual uint8_t ManualThrust(void)
71 return false;
73 virtual uint8_t PositionHoldState(void)
75 return false;
78 // virtual ~PathFollowerFSM() = 0;
81 #endif // PATHFOLLOWERFSM_H