From c0352027fb9f7cbacedae65f40c7563fbb2ef520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 23 Jan 2020 13:29:42 +0100 Subject: [PATCH] mc_pos_control: do not warn when going into failsafe while disarmed It's possible to get invalid or no setpoints from navigator while disarmed. --- src/modules/mc_pos_control/mc_pos_control_main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modules/mc_pos_control/mc_pos_control_main.cpp b/src/modules/mc_pos_control/mc_pos_control_main.cpp index 4747130569..10e5991e1f 100644 --- a/src/modules/mc_pos_control/mc_pos_control_main.cpp +++ b/src/modules/mc_pos_control/mc_pos_control_main.cpp @@ -254,7 +254,7 @@ private: * to true, the failsafe will be initiated immediately. */ void failsafe(vehicle_local_position_setpoint_s &setpoint, const PositionControlStates &states, const bool force, - const bool warn); + bool warn); /** * Reset setpoints to NAN @@ -921,8 +921,13 @@ MulticopterPositionControl::limit_thrust_during_landing(vehicle_attitude_setpoin void MulticopterPositionControl::failsafe(vehicle_local_position_setpoint_s &setpoint, const PositionControlStates &states, - const bool force, const bool warn) + const bool force, bool warn) { + // do not warn while we are disarmed, as we might not have valid setpoints yet + if (!_control_mode.flag_armed) { + warn = false; + } + _failsafe_land_hysteresis.set_state_and_update(true, hrt_absolute_time()); if (!_failsafe_land_hysteresis.get_state() && !force) {