mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 10:33:35 +08:00
Introduce checkAndFixCovarianceUpdate(KHP) function
This commit is contained in:
committed by
Mathieu Bresciani
parent
5c4a3d4576
commit
89bfcc2167
+2
-14
@@ -177,21 +177,9 @@ void Ekf::fuseAirspeed()
|
||||
}
|
||||
}
|
||||
|
||||
// if the covariance correction will result in a negative variance, then
|
||||
// the covariance matrix is unhealthy and must be corrected
|
||||
bool healthy = true;
|
||||
_fault_status.flags.bad_airspeed = false;
|
||||
const bool healthy = checkAndFixCovarianceUpdate(KHP);
|
||||
|
||||
for (int i = 0; i < _k_num_states; i++) {
|
||||
if (P(i,i) < KHP(i,i)) {
|
||||
P.uncorrelateCovarianceSetVariance<1>(i, 0.0f);
|
||||
|
||||
healthy = false;
|
||||
|
||||
_fault_status.flags.bad_airspeed = true;
|
||||
|
||||
}
|
||||
}
|
||||
_fault_status.flags.bad_airspeed = !healthy;
|
||||
|
||||
if (healthy) {
|
||||
// apply the covariance corrections
|
||||
|
||||
Reference in New Issue
Block a user