Skip to content

Commit

Permalink
tecs_status.msg: directly add underspeed ratio to msg instead of boolean
Browse files Browse the repository at this point in the history
Signed-off-by: Silvan Fuhrer <[email protected]>
  • Loading branch information
sfuhrer authored and Thomas Stastny committed Nov 7, 2023
1 parent 8741a97 commit a47b684
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion msg/TecsStatus.msg
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion src/lib/tecs/TECS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ class TECS
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.
Expand Down
2 changes: 1 addition & 1 deletion src/modules/fw_pos_control/FixedwingPositionControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit a47b684

Please sign in to comment.