EKF: Only reset necessary terms when mag fusion covariance reset required

Only the quaternion and mag fusion state covariances are used in the mag fusion calculations.
This commit is contained in:
Paul Riseborough
2016-06-08 11:58:33 +10:00
parent 381d99aed6
commit 99b34f0df4
3 changed files with 25 additions and 6 deletions
+16
View File
@@ -778,3 +778,19 @@ void Ekf::fixCovarianceErrors()
makeSymmetrical(P,22,23);
}
}
void Ekf::resetMagCovariance()
{
// set the quaternion covariance terms to zero
zeroRows(P,0,3);
zeroCols(P,0,3);
// set the magnetic field covariance terms to zero
zeroRows(P,16,21);
zeroCols(P,16,21);
// set the field state variance to the observation variance
for (uint8_t rc_index=16; rc_index <= 21; rc_index ++) {
P[rc_index][rc_index] = sq(_params.mag_noise);
}
}