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.
This commit is contained in:
Beat Küng
2020-01-23 13:29:42 +01:00
committed by Lorenz Meier
parent d68e595514
commit c0352027fb

View File

@@ -254,7 +254,7 @@ private:
* to true, the failsafe will be initiated immediately. * to true, the failsafe will be initiated immediately.
*/ */
void failsafe(vehicle_local_position_setpoint_s &setpoint, const PositionControlStates &states, const bool force, void failsafe(vehicle_local_position_setpoint_s &setpoint, const PositionControlStates &states, const bool force,
const bool warn); bool warn);
/** /**
* Reset setpoints to NAN * Reset setpoints to NAN
@@ -921,8 +921,13 @@ MulticopterPositionControl::limit_thrust_during_landing(vehicle_attitude_setpoin
void void
MulticopterPositionControl::failsafe(vehicle_local_position_setpoint_s &setpoint, const PositionControlStates &states, 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()); _failsafe_land_hysteresis.set_state_and_update(true, hrt_absolute_time());
if (!_failsafe_land_hysteresis.get_state() && !force) { if (!_failsafe_land_hysteresis.get_state() && !force) {