From 34423a6c927075a87c4135acb5c2d59b832787f0 Mon Sep 17 00:00:00 2001 From: bresch Date: Fri, 23 Dec 2022 12:05:23 +0100 Subject: [PATCH] commander: do not check dead-reckoning flag to send GPS invalid msg The dead-reckoning flag comes from EKF2 and isn't in sync with the other commander flags. This can lead to the message not being printed because EKF2 can take a bit more time to stop the GPS fusion and set the DR flag. --- src/modules/commander/Commander.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp index ce9bd471d2..a9f0ecd121 100644 --- a/src/modules/commander/Commander.cpp +++ b/src/modules/commander/Commander.cpp @@ -4461,14 +4461,12 @@ void Commander::estimator_check() } if (condition_gps_position_was_valid && !_vehicle_status_flags.gps_position_valid) { - PX4_DEBUG("GPS no longer valid"); // report GPS failure if flying and the global position estimate is still valid - if (!_vehicle_land_detected.landed && _vehicle_status_flags.global_position_valid - && _vehicle_status_flags.dead_reckoning) { - mavlink_log_warning(&_mavlink_log_pub, "GPS no longer valid, switching to dead-reckoning\t"); + if (!_vehicle_land_detected.landed && _vehicle_status_flags.global_position_valid) { + mavlink_log_warning(&_mavlink_log_pub, "GPS no longer valid\t"); events::send(events::ID("commander_gps_lost"), {events::Log::Critical, events::LogInternal::Info}, - "GPS no longer valid, switching to dead-reckoning"); + "GPS no longer valid"); } } else if (!condition_gps_position_was_valid && _vehicle_status_flags.gps_position_valid) {