Introduce checkAndFixCovarianceUpdate(KHP) function

This commit is contained in:
kamilritz
2020-07-16 18:25:06 +02:00
committed by Mathieu Bresciani
parent 5c4a3d4576
commit 89bfcc2167
8 changed files with 44 additions and 123 deletions
+14
View File
@@ -848,6 +848,20 @@ void Ekf::fixCovarianceErrors(bool force_symmetry)
}
}
// if the covariance correction will result in a negative variance, then
// the covariance matrix is unhealthy and must be corrected
bool Ekf::checkAndFixCovarianceUpdate(const SquareMatrix24f& KHP) {
bool healthy = true;
for (int i = 0; i < _k_num_states; i++) {
if (P(i, i) < KHP(i, i)) {
P.uncorrelateCovarianceSetVariance<1>(i, 0.0f);
healthy = false;
}
}
return healthy;
}
void Ekf::resetMagRelatedCovariances()
{
resetQuatCov();