AP_NavEKF: Scale divergence check with covariance

This provides consistent behaviour for a range of gyro bias process
noise settings and automatically adjusts sensitivity as filter learns bias
This commit is contained in:
priseborough 2014-05-16 21:13:30 +10:00 committed by Andrew Tridgell
parent 0337d44b2e
commit a19015ed61

View File

@ -3398,7 +3398,8 @@ void NavEKF::checkDivergence()
Vector3f tempVec = state.gyro_bias - lastGyroBias; Vector3f tempVec = state.gyro_bias - lastGyroBias;
float tempLength = tempVec.length(); float tempLength = tempVec.length();
if (tempLength != 0.0f) { if (tempLength != 0.0f) {
scaledDeltaGyrBiasLgth = 5e4f*tempVec.length()/dtIMU; float temp = constrain_float((P[10][10] + P[11][11] + P[12][12]),1e-12f,1e-8f);
scaledDeltaGyrBiasLgth = (2e-6f / temp) * tempVec.length() / dtIMU;
} }
bool divergenceDetected = (scaledDeltaGyrBiasLgth > 1.0f); bool divergenceDetected = (scaledDeltaGyrBiasLgth > 1.0f);
lastGyroBias = state.gyro_bias; lastGyroBias = state.gyro_bias;