AP_NavEKF2: Don't declare ready to do aiding unless gyro bias is learned

This commit is contained in:
priseborough 2016-07-06 15:33:29 +10:00 committed by Andrew Tridgell
parent 169cd6625d
commit 280395afa1
4 changed files with 11 additions and 12 deletions

View File

@ -164,7 +164,7 @@ void NavEKF2_core::setAidingMode()
if (!isAiding) { if (!isAiding) {
// Don't allow filter to start position or velocity aiding until the tilt and yaw alignment is complete // Don't allow filter to start position or velocity aiding until the tilt and yaw alignment is complete
// and IMU gyro bias estimates have stabilised // and IMU gyro bias estimates have stabilised
bool filterIsStable = tiltAlignComplete && yawAlignComplete && imuCalCompleted(); bool filterIsStable = tiltAlignComplete && yawAlignComplete && checkGyroCalStatus();
// If GPS usage has been prohiited then we use flow aiding provided optical flow data is present // If GPS usage has been prohiited then we use flow aiding provided optical flow data is present
bool useFlowAiding = (frontend->_fusionModeGPS == 3) && optFlowDataPresent(); bool useFlowAiding = (frontend->_fusionModeGPS == 3) && optFlowDataPresent();
// Start aiding if we have a source of aiding data and the filter attitude algnment is complete // Start aiding if we have a source of aiding data and the filter attitude algnment is complete
@ -327,17 +327,15 @@ void NavEKF2_core::recordYawReset()
} }
} }
// return true when IMU calibration completed // return true and set the class variable true if the delta angle bias has been learned
bool NavEKF2_core::imuCalCompleted(void) bool NavEKF2_core::checkGyroCalStatus(void)
{ {
// check delta angle bias variances // check delta angle bias variances
const float delAngBiasVarMax = sq(radians(0.1f * dtEkfAvg)); const float delAngBiasVarMax = sq(radians(0.1f * dtEkfAvg));
bool gyroCalComplete = (P[9][9] <= delAngBiasVarMax) && delAngBiasLearned = (P[9][9] <= delAngBiasVarMax) &&
(P[10][10] <= delAngBiasVarMax) && (P[10][10] <= delAngBiasVarMax) &&
(P[11][11] <= delAngBiasVarMax); (P[11][11] <= delAngBiasVarMax);
return delAngBiasLearned;
return gyroCalComplete;
} }
// Commands the EKF to not use GPS. // Commands the EKF to not use GPS.

View File

@ -459,14 +459,13 @@ void NavEKF2_core::getFilterStatus(nav_filter_status &status) const
{ {
// init return value // init return value
status.value = 0; status.value = 0;
bool doingFlowNav = (PV_AidingMode == AID_RELATIVE) && flowDataValid; bool doingFlowNav = (PV_AidingMode == AID_RELATIVE) && flowDataValid;
bool doingWindRelNav = !tasTimeout && assume_zero_sideslip(); bool doingWindRelNav = !tasTimeout && assume_zero_sideslip();
bool doingNormalGpsNav = !posTimeout && (PV_AidingMode == AID_ABSOLUTE); bool doingNormalGpsNav = !posTimeout && (PV_AidingMode == AID_ABSOLUTE);
bool someVertRefData = (!velTimeout && useGpsVertVel) || !hgtTimeout; bool someVertRefData = (!velTimeout && useGpsVertVel) || !hgtTimeout;
bool someHorizRefData = !(velTimeout && posTimeout && tasTimeout) || doingFlowNav; bool someHorizRefData = !(velTimeout && posTimeout && tasTimeout) || doingFlowNav;
bool optFlowNavPossible = flowDataValid && (frontend->_fusionModeGPS == 3); bool optFlowNavPossible = flowDataValid && (frontend->_fusionModeGPS == 3) && delAngBiasLearned;
bool gpsNavPossible = !gpsNotAvailable && gpsGoodToAlign; bool gpsNavPossible = !gpsNotAvailable && gpsGoodToAlign && delAngBiasLearned;
bool filterHealthy = healthy() && tiltAlignComplete && (yawAlignComplete || (!use_compass() && (PV_AidingMode == AID_NONE))); bool filterHealthy = healthy() && tiltAlignComplete && (yawAlignComplete || (!use_compass() && (PV_AidingMode == AID_NONE)));
// If GPS height usage is specified, height is considered to be inaccurate until the GPS passes all checks // If GPS height usage is specified, height is considered to be inaccurate until the GPS passes all checks
bool hgtNotAccurate = (frontend->_altSource == 2) && !validOrigin; bool hgtNotAccurate = (frontend->_altSource == 2) && !validOrigin;

View File

@ -262,6 +262,7 @@ void NavEKF2_core::InitialiseVariables()
yawInnovAtLastMagReset = 0.0f; yawInnovAtLastMagReset = 0.0f;
quatAtLastMagReset = stateStruct.quat; quatAtLastMagReset = stateStruct.quat;
magFieldLearned = false; magFieldLearned = false;
delAngBiasLearned = false;
// zero data buffers // zero data buffers
storedIMU.reset(); storedIMU.reset();

View File

@ -586,8 +586,8 @@ private:
// Assess GPS data quality and return true if good enough to align the EKF // Assess GPS data quality and return true if good enough to align the EKF
bool calcGpsGoodToAlign(void); bool calcGpsGoodToAlign(void);
// return true when IMU calibration completed // return true and set the class variable true if the delta angle bias has been learned
bool imuCalCompleted(void); bool checkGyroCalStatus(void);
// update inflight calculaton that determines if GPS data is good enough for reliable navigation // update inflight calculaton that determines if GPS data is good enough for reliable navigation
void calcGpsGoodForFlight(void); void calcGpsGoodForFlight(void);
@ -801,6 +801,7 @@ private:
bool magFieldLearned; // true when the magnetic field has been learned bool magFieldLearned; // true when the magnetic field has been learned
Vector3f earthMagFieldVar; // NED earth mag field variances for last learned field (mGauss^2) Vector3f earthMagFieldVar; // NED earth mag field variances for last learned field (mGauss^2)
Vector3f bodyMagFieldVar; // XYZ body mag field variances for last learned field (mGauss^2) Vector3f bodyMagFieldVar; // XYZ body mag field variances for last learned field (mGauss^2)
bool delAngBiasLearned; // true when the gyro bias has been learned
Vector3f outputTrackError; Vector3f outputTrackError;