Browse Source

AP_NavEKF: Corrected height update timeout error

master
Paul Riseborough 11 years ago committed by Andrew Tridgell
parent
commit
4a7f81e50a
  1. 14
      libraries/AP_NavEKF/NavEKF.cpp
  2. 2
      libraries/AP_NavEKF/NavEKF.h

14
libraries/AP_NavEKF/NavEKF.cpp

@ -118,18 +118,22 @@ void SelectVelPosFusion()
fuseVelData = false; fuseVelData = false;
fusePosData = false; fusePosData = false;
} }
// Fuse height measurements with GPS measurements for efficiency // Fuse height measurements at the same time as GPS measurements for efficiency
// Don't wait longer than HGTmsecTgt msec between height fusion steps // Don't wait longer than HGTmsecTgt msec between height updates
if (statesInitialised && (newDataGps || ((IMUmsec - HGTmsecPrev) >= HGTmsecTgt))) if (statesInitialised && (newDataGps || ((IMUmsec - HGTmsecPrev) >= HGTmsecTgt)))
{ {
HGTmsecPrev = IMUmsec;
fuseHgtData = true; fuseHgtData = true;
readHgtData(); readHgtData();
} }
else else
{ {
fuseHgtData = false; fuseHgtData = false;
// protect against wrap-around
if(IMUmsec < HGTmsecPrev) HGTmsecPrev = IMUmsec;
} }
FuseVelposNED(); FuseVelPosNED();
fuseHgtData = false; fuseHgtData = false;
} }
@ -1050,7 +1054,7 @@ void CovariancePrediction()
zeroCols(nextP,16,17); zeroCols(nextP,16,17);
} }
// If the total position variance exceds 1E6 (1000m), then stop covariance // If the total position variance exceeds 1E6 (1000m), then stop covariance
// growth by setting the predicted to the previous values // growth by setting the predicted to the previous values
// This prevent an ill conditioned matrix from occurring for long periods // This prevent an ill conditioned matrix from occurring for long periods
// without GPS // without GPS
@ -1079,7 +1083,7 @@ void CovariancePrediction()
} }
} }
void FuseVelposNED() void FuseVelPosNED()
{ {
// declare variables used by fault isolation logic // declare variables used by fault isolation logic

2
libraries/AP_NavEKF/NavEKF.h

@ -63,7 +63,7 @@ void UpdateStrapdownEquationsNED();
void CovariancePrediction(); void CovariancePrediction();
void FuseVelposNED(); void FuseVelPosNED();
void FuseMagnetometer(); void FuseMagnetometer();

Loading…
Cancel
Save