EKF: Don't use magnetometer with optical flow only nav if GPS checks are failing

This commit is contained in:
Paul Riseborough
2018-06-09 22:23:55 +02:00
committed by Lorenz Meier
parent 84516760c0
commit 0160aaa568
4 changed files with 29 additions and 3 deletions
+7 -1
View File
@@ -675,7 +675,13 @@ void Ekf::fuseHeading()
measured_hdg = wrap_pi(measured_hdg);
// calculate the innovation
_heading_innov = predicted_hdg - measured_hdg;
if (_mag_use_inhibit) {
// The magnetomer cannot be trusted but we need to fuse a heading to prevent a badly
// conditoned covariance matrix developing over time.
_heading_innov = 0.0f;
} else {
_heading_innov = predicted_hdg - measured_hdg;
}
// wrap the innovation to the interval between +-pi
_heading_innov = wrap_pi(_heading_innov);