From 79b1d3018d5c19400bf6df16f578870e8f9c121c Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Wed, 12 Oct 2016 16:21:12 +1100 Subject: [PATCH] EKF: Fix magnetometer innovation test ratio reporting bug --- EKF/mag_fusion.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/EKF/mag_fusion.cpp b/EKF/mag_fusion.cpp index 561c6b6793..07a0d6454a 100644 --- a/EKF/mag_fusion.cpp +++ b/EKF/mag_fusion.cpp @@ -155,6 +155,9 @@ void Ekf::fuseMag() } } + // we are no longer using heading fusion so set the reported test level to zero + _yaw_test_ratio = 0.0f; + // if any axis fails, abort the mag fusion if (!healthy) { return; @@ -608,6 +611,9 @@ void Ekf::fuseHeading() // innovation test ratio _yaw_test_ratio = sq(_heading_innov) / (sq(math::max(_params.heading_innov_gate, 1.0f)) * _heading_innov_var); + // we are no longer using 3-axis fusion so set the reported test levels to zero + memset(_mag_test_ratio, 0, sizeof(_mag_test_ratio)); + // set the magnetometer unhealthy if the test fails if (_yaw_test_ratio > 1.0f) { _innov_check_fail_status.flags.reject_yaw = true;