diff --git a/msg/TecsStatus.msg b/msg/TecsStatus.msg index 8b220703cf..ae6835dc52 100644 --- a/msg/TecsStatus.msg +++ b/msg/TecsStatus.msg @@ -26,4 +26,4 @@ float32 throttle_sp # Current throttle setpoint [-] float32 pitch_sp_rad # Current pitch setpoint [rad] float32 throttle_trim # estimated throttle value [0,1] required to fly level at equivalent_airspeed_sp in the current atmospheric conditions -bool underspeed_mode_enabled # System has detected a low airspeed and takes measures to avoid stalling the plane +float32 underspeed_ratio # 0: no underspeed, 1: maximal underspeed. Controller takes measures to avoid stall proportional to ratio if >0. diff --git a/src/lib/tecs/TECS.hpp b/src/lib/tecs/TECS.hpp index 43b1cc3889..49b4a72ede 100644 --- a/src/lib/tecs/TECS.hpp +++ b/src/lib/tecs/TECS.hpp @@ -646,7 +646,7 @@ public: float get_throttle_setpoint() {return _control.getThrottleSetpoint();} uint64_t timestamp() { return _update_timestamp; } - bool underspeed_detected() { return _control.getRatioUndersped() > 0.f; } + float get_underspeed_ratio() { return _control.getRatioUndersped(); } private: TECSControl _control; ///< Control submodule. diff --git a/src/modules/fw_pos_control/FixedwingPositionControl.cpp b/src/modules/fw_pos_control/FixedwingPositionControl.cpp index 93d7e9c912..e9b88ba70f 100644 --- a/src/modules/fw_pos_control/FixedwingPositionControl.cpp +++ b/src/modules/fw_pos_control/FixedwingPositionControl.cpp @@ -506,7 +506,7 @@ FixedwingPositionControl::tecs_status_publish(float alt_sp, float equivalent_air tecs_status.throttle_sp = _tecs.get_throttle_setpoint(); tecs_status.pitch_sp_rad = _tecs.get_pitch_setpoint(); tecs_status.throttle_trim = throttle_trim; - tecs_status.underspeed_mode_enabled = _tecs.underspeed_detected(); + tecs_status.underspeed_ratio = _tecs.get_underspeed_ratio(); tecs_status.timestamp = hrt_absolute_time();