From 0056827698c42d278f9c485df471aeaafa97c2e7 Mon Sep 17 00:00:00 2001 From: Balduin Date: Tue, 22 Jul 2025 17:44:46 +0200 Subject: [PATCH] fake position_invalid_relaxed --- .../HealthAndArmingChecks/checks/estimatorCheck.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/commander/HealthAndArmingChecks/checks/estimatorCheck.cpp b/src/modules/commander/HealthAndArmingChecks/checks/estimatorCheck.cpp index 2b90f78c84..82ea8e1f89 100644 --- a/src/modules/commander/HealthAndArmingChecks/checks/estimatorCheck.cpp +++ b/src/modules/commander/HealthAndArmingChecks/checks/estimatorCheck.cpp @@ -743,6 +743,14 @@ void EstimatorChecks::setModeRequirementFlags(const Context &context, bool pre_f !checkPosVelValidity(now, xy_valid, lpos.eph, lpos_eph_threshold_relaxed, lpos.timestamp, _last_lpos_relaxed_fail_time_us, !failsafe_flags.local_position_invalid_relaxed); + // !!! Hack for reproducing failure, remove before merge !!! + // In nav_state 18 (auto land), pretend to have valid relaxed local pos. + if (context.status().nav_state == 18) { + // happens anyway when EKF2_GPS_CTRL=0 + // failsafe_flags.local_position_invalid = true; + failsafe_flags.local_position_invalid_relaxed = false; + } + failsafe_flags.local_velocity_invalid = !checkPosVelValidity(now, v_xy_valid, lpos.evh, _param_com_vel_fs_evh.get(), lpos.timestamp, _last_lvel_fail_time_us, !failsafe_flags.local_velocity_invalid);