From f2608089fd2b018f45d78e238b02983838fad034 Mon Sep 17 00:00:00 2001 From: Marco Hauswirth Date: Tue, 17 Mar 2026 17:19:33 +0100 Subject: [PATCH] fix(commander): decouple heading preflight check from attitude mode requirement --- .../checks/estimatorCheck.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/modules/commander/HealthAndArmingChecks/checks/estimatorCheck.cpp b/src/modules/commander/HealthAndArmingChecks/checks/estimatorCheck.cpp index b1bce851a6..4c274c78a6 100644 --- a/src/modules/commander/HealthAndArmingChecks/checks/estimatorCheck.cpp +++ b/src/modules/commander/HealthAndArmingChecks/checks/estimatorCheck.cpp @@ -136,15 +136,23 @@ void EstimatorChecks::checkAndReport(const Context &context, Report &reporter) void EstimatorChecks::checkEstimatorStatus(const Context &context, Report &reporter, const estimator_status_s &estimator_status, NavModes required_groups) { + // Heading is required to arm for all modes that need any form of local position, plus FW AUTO_TAKEOFF + const NavModes heading_required_groups = (NavModes)( + reporter.failsafeFlags().mode_req_local_position | + reporter.failsafeFlags().mode_req_local_position_relaxed | + (1u << vehicle_status_s::NAVIGATION_STATE_AUTO_TAKEOFF)); + if (!context.isArmed() && estimator_status.pre_flt_fail_innov_heading) { /* EVENT + * @description + * Recalibrate compass or perform manual heading reset. */ - reporter.armingCheckFailure(required_groups, health_component_t::local_position_estimate, + reporter.armingCheckFailure(heading_required_groups, health_component_t::local_position_estimate, events::ID("check_estimator_heading_not_stable"), - events::Log::Error, "Heading estimate not stable"); + events::Log::Error, "Heading estimate invalid"); if (reporter.mavlink_log_pub()) { - mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: heading estimate not stable"); + mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: heading estimate invalid"); } } else if (!context.isArmed() && estimator_status.pre_flt_fail_innov_vel_horiz) {