fix(commander): decouple heading preflight check from attitude mode requirement

This commit is contained in:
Marco Hauswirth
2026-03-17 17:19:33 +01:00
committed by Marco Hauswirth
parent c7c0e830f1
commit f2608089fd
@@ -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) {