mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 01:13:35 +08:00
Introduce checkAndFixCovarianceUpdate(KHP) function
This commit is contained in:
committed by
Mathieu Bresciani
parent
5c4a3d4576
commit
89bfcc2167
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user