mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-02 10:23:25 +08:00
AP_NavEKF3: use FinishFusion in FuseOptFlow
This commit is contained in:
committed by
Andrew Tridgell
parent
5495683d10
commit
5964a0d113
@@ -692,33 +692,9 @@ void NavEKF3_core::FuseOptFlow(const of_elements &ofDataDelayed, bool really_fus
|
||||
}
|
||||
}
|
||||
|
||||
// Check that we are not going to drive any variances negative and skip the update if so
|
||||
bool healthyFusion = true;
|
||||
for (uint8_t i= 0; i<=stateIndexLim; i++) {
|
||||
if (KHP[i][i] > P[i][i]) {
|
||||
healthyFusion = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (healthyFusion) {
|
||||
// update the covariance matrix
|
||||
for (uint8_t i= 0; i<=stateIndexLim; i++) {
|
||||
for (uint8_t j= 0; j<=stateIndexLim; j++) {
|
||||
P[i][j] = P[i][j] - KHP[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
// correct the state vector
|
||||
for (uint8_t j= 0; j<=stateIndexLim; j++) {
|
||||
statesArray[j] = statesArray[j] - Kfusion[j] * flowInnov[obsIndex];
|
||||
}
|
||||
stateStruct.quat.normalize();
|
||||
|
||||
// force the covariance matrix to be symmetrical and limit the variances to prevent ill-conditioning.
|
||||
ForceSymmetry();
|
||||
ConstrainVariances();
|
||||
} else {
|
||||
// record bad axis
|
||||
// finish fusion from KHP and Kfusion
|
||||
if (FinishFusion(flowInnov[obsIndex])) {
|
||||
// fault, record bad axis
|
||||
if (obsIndex == 0) {
|
||||
faultStatus.bad_xflow = true;
|
||||
} else if (obsIndex == 1) {
|
||||
|
||||
Reference in New Issue
Block a user