fw pos ctrl: handle takeoff detection when switching to takeoff mode while in air

- simplify takeoff reset method
- removes _last_manual variable in favor of _skipping_takeoff_detection, which is handled in the control mode setter
- takeoff detection (both launch and runway) is skipped if entering takeoff mode from any other mode while having already been in the air
- added method to runway takeoff class for force setting the fly state when we want to skip the takeoff detection
This commit is contained in:
Thomas Stastny
2022-07-18 10:49:27 -04:00
committed by Daniel Agar
parent 8cc6d02af3
commit ddeca2538c
3 changed files with 44 additions and 36 deletions
@@ -272,8 +272,7 @@ private:
RunwayTakeoff _runway_takeoff;
// true if the last iteration was in manual mode (used to determine when a reset is needed)
bool _last_manual{false};
bool _skipping_takeoff_detection{false};
/* throttle and airspeed states */
@@ -578,7 +577,7 @@ private:
float get_auto_airspeed_setpoint(const float control_interval, const float pos_sp_cru_airspeed,
const Vector2f &ground_speed);
void reset_takeoff_state(bool force = false);
void reset_takeoff_state();
void reset_landing_state();
bool using_npfg_with_wind_estimate() const;