2019-01-15 13:46:13 -04:00
|
|
|
#pragma once
|
|
|
|
|
2019-05-04 06:56:07 -03:00
|
|
|
#include <AP_Param/AP_Param.h>
|
2019-10-09 23:46:46 -03:00
|
|
|
#include <AP_Common/Location.h>
|
2019-01-15 13:46:13 -04:00
|
|
|
#include <stdint.h>
|
2019-06-05 15:25:40 -03:00
|
|
|
#include <AP_Common/Location.h>
|
2020-09-16 04:46:56 -03:00
|
|
|
#include <AP_Soaring/AP_Soaring.h>
|
2020-09-22 14:00:39 -03:00
|
|
|
#include <AP_ADSB/AP_ADSB.h>
|
2020-09-16 04:47:59 -03:00
|
|
|
#include <AP_Vehicle/ModeReason.h>
|
2019-01-15 13:46:13 -04:00
|
|
|
|
|
|
|
class Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
/* Do not allow copies */
|
|
|
|
Mode(const Mode &other) = delete;
|
|
|
|
Mode &operator=(const Mode&) = delete;
|
|
|
|
|
|
|
|
// Auto Pilot modes
|
|
|
|
// ----------------
|
2019-10-17 00:49:32 -03:00
|
|
|
enum Number : uint8_t {
|
2019-01-15 13:46:13 -04:00
|
|
|
MANUAL = 0,
|
|
|
|
CIRCLE = 1,
|
|
|
|
STABILIZE = 2,
|
|
|
|
TRAINING = 3,
|
|
|
|
ACRO = 4,
|
|
|
|
FLY_BY_WIRE_A = 5,
|
|
|
|
FLY_BY_WIRE_B = 6,
|
|
|
|
CRUISE = 7,
|
|
|
|
AUTOTUNE = 8,
|
|
|
|
AUTO = 10,
|
|
|
|
RTL = 11,
|
|
|
|
LOITER = 12,
|
2019-05-04 06:56:07 -03:00
|
|
|
TAKEOFF = 13,
|
2019-01-15 13:46:13 -04:00
|
|
|
AVOID_ADSB = 14,
|
|
|
|
GUIDED = 15,
|
|
|
|
INITIALISING = 16,
|
|
|
|
QSTABILIZE = 17,
|
|
|
|
QHOVER = 18,
|
|
|
|
QLOITER = 19,
|
|
|
|
QLAND = 20,
|
|
|
|
QRTL = 21,
|
|
|
|
QAUTOTUNE = 22,
|
|
|
|
QACRO = 23,
|
2020-09-16 04:46:56 -03:00
|
|
|
THERMAL = 24,
|
2019-01-15 13:46:13 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
Mode();
|
|
|
|
|
|
|
|
// enter this mode, always returns true/success
|
|
|
|
bool enter();
|
|
|
|
|
|
|
|
// perform any cleanups required:
|
|
|
|
void exit();
|
|
|
|
|
|
|
|
// returns a unique number specific to this mode
|
|
|
|
virtual Number mode_number() const = 0;
|
|
|
|
|
|
|
|
// returns full text name
|
|
|
|
virtual const char *name() const = 0;
|
|
|
|
|
|
|
|
// returns a string for this flightmode, exactly 4 bytes
|
|
|
|
virtual const char *name4() const = 0;
|
|
|
|
|
|
|
|
//
|
|
|
|
// methods that sub classes should override to affect movement of the vehicle in this mode
|
|
|
|
//
|
|
|
|
|
|
|
|
// convert user input to targets, implement high level control for this mode
|
|
|
|
virtual void update() = 0;
|
|
|
|
|
2019-04-01 14:54:34 -03:00
|
|
|
// true for all q modes
|
|
|
|
virtual bool is_vtol_mode() const { return false; }
|
2020-08-24 13:44:50 -03:00
|
|
|
virtual bool is_vtol_man_throttle() const;
|
2020-07-26 11:35:51 -03:00
|
|
|
virtual bool is_vtol_man_mode() const { return false; }
|
2020-09-22 14:00:39 -03:00
|
|
|
// guided or adsb mode
|
|
|
|
virtual bool is_guided_mode() const { return false; }
|
2019-04-01 14:54:34 -03:00
|
|
|
|
2020-07-07 09:25:21 -03:00
|
|
|
// true if mode can have terrain following disabled by switch
|
|
|
|
virtual bool allows_terrain_disable() const { return false; }
|
|
|
|
|
2020-08-19 04:51:00 -03:00
|
|
|
// subclasses override this if they require navigation.
|
|
|
|
virtual void navigate() { return; }
|
2020-07-29 12:01:34 -03:00
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
// subclasses override this to perform checks before entering the mode
|
|
|
|
virtual bool _enter() { return true; }
|
|
|
|
|
|
|
|
// subclasses override this to perform any required cleanup when exiting the mode
|
|
|
|
virtual void _exit() { return; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ModeAcro : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Mode::Number mode_number() const override { return Mode::Number::ACRO; }
|
|
|
|
const char *name() const override { return "ACRO"; }
|
|
|
|
const char *name4() const override { return "ACRO"; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeAuto : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::AUTO; }
|
|
|
|
const char *name() const override { return "AUTO"; }
|
|
|
|
const char *name4() const override { return "AUTO"; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
2020-08-19 04:51:00 -03:00
|
|
|
void navigate() override;
|
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
void _exit() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ModeAutoTune : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::AUTOTUNE; }
|
|
|
|
const char *name() const override { return "AUTOTUNE"; }
|
|
|
|
const char *name4() const override { return "ATUN"; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
void _exit() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeGuided : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::GUIDED; }
|
|
|
|
const char *name() const override { return "GUIDED"; }
|
|
|
|
const char *name4() const override { return "GUID"; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
2020-08-19 04:51:00 -03:00
|
|
|
void navigate() override;
|
|
|
|
|
2020-09-22 14:00:39 -03:00
|
|
|
virtual bool is_guided_mode() const override { return true; }
|
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeCircle: public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::CIRCLE; }
|
|
|
|
const char *name() const override { return "CIRCLE"; }
|
|
|
|
const char *name4() const override { return "CIRC"; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeLoiter : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::LOITER; }
|
|
|
|
const char *name() const override { return "LOITER"; }
|
|
|
|
const char *name4() const override { return "LOIT"; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
2020-08-19 04:51:00 -03:00
|
|
|
void navigate() override;
|
|
|
|
|
2019-06-07 12:08:28 -03:00
|
|
|
bool isHeadingLinedUp(const Location loiterCenterLoc, const Location targetLoc);
|
2020-01-28 00:14:43 -04:00
|
|
|
bool isHeadingLinedUp_cd(const int32_t bearing_cd);
|
2019-06-05 15:25:40 -03:00
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeManual : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::MANUAL; }
|
|
|
|
const char *name() const override { return "MANUAL"; }
|
|
|
|
const char *name4() const override { return "MANU"; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
void _exit() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ModeRTL : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::RTL; }
|
|
|
|
const char *name() const override { return "RTL"; }
|
|
|
|
const char *name4() const override { return "RTL "; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
2020-08-19 04:51:00 -03:00
|
|
|
void navigate() override;
|
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeStabilize : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::STABILIZE; }
|
|
|
|
const char *name() const override { return "STABILIZE"; }
|
|
|
|
const char *name4() const override { return "STAB"; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeTraining : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::TRAINING; }
|
|
|
|
const char *name() const override { return "TRAINING"; }
|
|
|
|
const char *name4() const override { return "TRAN"; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeInitializing : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::INITIALISING; }
|
|
|
|
const char *name() const override { return "INITIALISING"; }
|
|
|
|
const char *name4() const override { return "INIT"; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override { }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeFBWA : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::FLY_BY_WIRE_A; }
|
|
|
|
const char *name() const override { return "FLY_BY_WIRE_A"; }
|
|
|
|
const char *name4() const override { return "FBWA"; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeFBWB : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::FLY_BY_WIRE_B; }
|
|
|
|
const char *name() const override { return "FLY_BY_WIRE_B"; }
|
|
|
|
const char *name4() const override { return "FBWB"; }
|
|
|
|
|
2020-07-07 09:25:21 -03:00
|
|
|
bool allows_terrain_disable() const override { return true; }
|
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeCruise : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::CRUISE; }
|
|
|
|
const char *name() const override { return "CRUISE"; }
|
|
|
|
const char *name4() const override { return "CRUS"; }
|
|
|
|
|
2020-07-07 09:25:21 -03:00
|
|
|
bool allows_terrain_disable() const override { return true; }
|
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
2020-08-19 04:51:00 -03:00
|
|
|
void navigate() override;
|
|
|
|
|
2020-08-03 15:22:00 -03:00
|
|
|
bool get_target_heading_cd(int32_t &target_heading);
|
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
2020-08-03 15:22:00 -03:00
|
|
|
|
|
|
|
bool locked_heading;
|
|
|
|
int32_t locked_heading_cd;
|
|
|
|
uint32_t lock_timer_ms;
|
2019-01-15 13:46:13 -04:00
|
|
|
};
|
|
|
|
|
2020-09-22 14:00:39 -03:00
|
|
|
#if HAL_ADSB_ENABLED
|
2019-01-15 13:46:13 -04:00
|
|
|
class ModeAvoidADSB : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::AVOID_ADSB; }
|
|
|
|
const char *name() const override { return "AVOID_ADSB"; }
|
|
|
|
const char *name4() const override { return "AVOI"; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
2020-08-19 04:51:00 -03:00
|
|
|
void navigate() override;
|
2020-09-22 14:00:39 -03:00
|
|
|
|
|
|
|
virtual bool is_guided_mode() const override { return true; }
|
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
2020-09-22 14:00:39 -03:00
|
|
|
#endif
|
2019-01-15 13:46:13 -04:00
|
|
|
|
|
|
|
class ModeQStabilize : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::QSTABILIZE; }
|
|
|
|
const char *name() const override { return "QSTABILIZE"; }
|
|
|
|
const char *name4() const override { return "QSTB"; }
|
|
|
|
|
2019-04-01 14:54:34 -03:00
|
|
|
bool is_vtol_mode() const override { return true; }
|
2020-07-07 21:22:56 -03:00
|
|
|
bool is_vtol_man_throttle() const override { return true; }
|
2020-07-26 11:35:51 -03:00
|
|
|
virtual bool is_vtol_man_mode() const override { return true; }
|
2019-04-01 14:54:34 -03:00
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
// used as a base class for all Q modes
|
|
|
|
bool _enter() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeQHover : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::QHOVER; }
|
|
|
|
const char *name() const override { return "QHOVER"; }
|
|
|
|
const char *name4() const override { return "QHOV"; }
|
|
|
|
|
2019-04-01 14:54:34 -03:00
|
|
|
bool is_vtol_mode() const override { return true; }
|
2020-07-26 11:35:51 -03:00
|
|
|
virtual bool is_vtol_man_mode() const override { return true; }
|
2019-04-01 14:54:34 -03:00
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeQLoiter : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::QLOITER; }
|
|
|
|
const char *name() const override { return "QLOITER"; }
|
|
|
|
const char *name4() const override { return "QLOT"; }
|
|
|
|
|
2019-04-01 14:54:34 -03:00
|
|
|
bool is_vtol_mode() const override { return true; }
|
2020-07-26 11:35:51 -03:00
|
|
|
virtual bool is_vtol_man_mode() const override { return true; }
|
2019-04-01 14:54:34 -03:00
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeQLand : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::QLAND; }
|
|
|
|
const char *name() const override { return "QLAND"; }
|
|
|
|
const char *name4() const override { return "QLND"; }
|
|
|
|
|
2019-04-01 14:54:34 -03:00
|
|
|
bool is_vtol_mode() const override { return true; }
|
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeQRTL : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::QRTL; }
|
|
|
|
const char *name() const override { return "QRTL"; }
|
|
|
|
const char *name4() const override { return "QRTL"; }
|
|
|
|
|
2019-04-01 14:54:34 -03:00
|
|
|
bool is_vtol_mode() const override { return true; }
|
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeQAcro : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::QACRO; }
|
|
|
|
const char *name() const override { return "QACO"; }
|
|
|
|
const char *name4() const override { return "QACRO"; }
|
|
|
|
|
2019-04-01 14:54:34 -03:00
|
|
|
bool is_vtol_mode() const override { return true; }
|
2020-07-07 21:22:56 -03:00
|
|
|
bool is_vtol_man_throttle() const override { return true; }
|
2019-04-01 14:54:34 -03:00
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModeQAutotune : public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::QAUTOTUNE; }
|
|
|
|
const char *name() const override { return "QAUTOTUNE"; }
|
|
|
|
const char *name4() const override { return "QATN"; }
|
|
|
|
|
2019-04-01 14:54:34 -03:00
|
|
|
bool is_vtol_mode() const override { return true; }
|
2020-07-26 11:35:51 -03:00
|
|
|
virtual bool is_vtol_man_mode() const override { return true; }
|
2019-04-01 14:54:34 -03:00
|
|
|
|
2019-01-15 13:46:13 -04:00
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
bool _enter() override;
|
2019-04-30 01:43:10 -03:00
|
|
|
void _exit() override;
|
2019-01-15 13:46:13 -04:00
|
|
|
};
|
2019-05-04 06:56:07 -03:00
|
|
|
|
|
|
|
|
|
|
|
class ModeTakeoff: public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ModeTakeoff();
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::TAKEOFF; }
|
|
|
|
const char *name() const override { return "TAKEOFF"; }
|
|
|
|
const char *name4() const override { return "TKOF"; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
2020-08-19 04:51:00 -03:00
|
|
|
void navigate() override;
|
|
|
|
|
2019-05-04 06:56:07 -03:00
|
|
|
// var_info for holding parameter information
|
|
|
|
static const struct AP_Param::GroupInfo var_info[];
|
|
|
|
|
|
|
|
protected:
|
|
|
|
AP_Int16 target_alt;
|
|
|
|
AP_Int16 target_dist;
|
|
|
|
AP_Int16 level_alt;
|
|
|
|
AP_Int8 level_pitch;
|
|
|
|
|
|
|
|
bool takeoff_started;
|
2019-10-09 23:46:46 -03:00
|
|
|
Location start_loc;
|
2019-05-04 06:56:07 -03:00
|
|
|
|
|
|
|
bool _enter() override;
|
|
|
|
};
|
2020-09-16 04:46:56 -03:00
|
|
|
|
2020-09-23 05:16:45 -03:00
|
|
|
#if HAL_SOARING_ENABLED
|
2020-09-16 04:46:56 -03:00
|
|
|
|
|
|
|
class ModeThermal: public Mode
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Number mode_number() const override { return Number::THERMAL; }
|
|
|
|
const char *name() const override { return "THERMAL"; }
|
|
|
|
const char *name4() const override { return "THML"; }
|
|
|
|
|
|
|
|
// methods that affect movement of the vehicle in this mode
|
|
|
|
void update() override;
|
|
|
|
|
2020-10-07 06:54:33 -03:00
|
|
|
// Update thermal tracking and exiting logic.
|
|
|
|
void update_soaring();
|
|
|
|
|
2020-09-16 04:46:56 -03:00
|
|
|
void navigate() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2020-09-16 04:47:59 -03:00
|
|
|
bool exit_heading_aligned() const;
|
|
|
|
void restore_mode(const char *reason, ModeReason modereason);
|
|
|
|
|
2020-09-16 04:46:56 -03:00
|
|
|
bool _enter() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|