From a3725e25810dda5d91709f7c11ad7c3c58805245 Mon Sep 17 00:00:00 2001 From: Paul Riseborough Date: Thu, 9 Apr 2020 09:57:51 +1000 Subject: [PATCH] AP_NavEKF3: Fix bug in calculation of rotation order --- libraries/AP_NavEKF3/AP_NavEKF3_MagFusion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_NavEKF3/AP_NavEKF3_MagFusion.cpp b/libraries/AP_NavEKF3/AP_NavEKF3_MagFusion.cpp index b2d337bada..2cce3e4caf 100644 --- a/libraries/AP_NavEKF3/AP_NavEKF3_MagFusion.cpp +++ b/libraries/AP_NavEKF3/AP_NavEKF3_MagFusion.cpp @@ -287,7 +287,7 @@ void NavEKF3_core::SelectMagFusion() // A 321 rotation order is best conditioned because the X axis is closer to horizontal than the Y axis yawAngDataDelayed.yawAng = atan2f(prevTnb[0][1], prevTnb[0][0]); yawAngDataDelayed.type = 2; - } else if (yawAngDataDelayed.type == 1) { + } else { // A 312 rotation order is best conditioned because the Y axis is closer to horizontal than the X axis yawAngDataDelayed.yawAng = atan2f(-prevTnb[0][1], prevTnb[1][1]); yawAngDataDelayed.type = 1;