mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-08 17:08:28 -04:00
AP_NavEKF3: consolidate extNav height source timeouts
This commit is contained in:
parent
6989a28bfc
commit
e4ccd21dd7
@ -992,6 +992,7 @@ void NavEKF3_core::selectHeightForFusion()
|
||||
baroDataToFuse = storedBaro.recall(baroDataDelayed, imuDataDelayed.time_ms);
|
||||
|
||||
bool rangeFinderDataIsFresh = (imuSampleTime_ms - rngValidMeaTime_ms < 500);
|
||||
const bool extNavDataIsFresh = (imuSampleTime_ms - extNavMeasTime_ms < 500);
|
||||
// select height source
|
||||
if (extNavUsedForPos && (frontend->_altSource == 4)) {
|
||||
// always use external navigation as the height source if using for position.
|
||||
@ -1043,14 +1044,14 @@ void NavEKF3_core::selectHeightForFusion()
|
||||
activeHgtSource = HGT_SOURCE_GPS;
|
||||
} else if ((frontend->_altSource == 3) && validOrigin && rngBcnGoodToAlign) {
|
||||
activeHgtSource = HGT_SOURCE_BCN;
|
||||
} else if ((frontend->_altSource == 4) && ((imuSampleTime_ms - extNavMeasTime_ms) < 500)) {
|
||||
} else if ((frontend->_altSource == 4) && extNavDataIsFresh) {
|
||||
activeHgtSource = HGT_SOURCE_EXTNAV;
|
||||
}
|
||||
|
||||
// Use Baro alt as a fallback if we lose range finder, GPS, external nav or Beacon
|
||||
bool lostRngHgt = ((activeHgtSource == HGT_SOURCE_RNG) && !rangeFinderDataIsFresh);
|
||||
bool lostGpsHgt = ((activeHgtSource == HGT_SOURCE_GPS) && ((imuSampleTime_ms - lastTimeGpsReceived_ms) > 2000));
|
||||
bool lostExtNavHgt = ((activeHgtSource == HGT_SOURCE_EXTNAV) && ((imuSampleTime_ms - extNavMeasTime_ms) > 2000));
|
||||
bool lostExtNavHgt = ((activeHgtSource == HGT_SOURCE_EXTNAV) && !extNavDataIsFresh);
|
||||
bool lostRngBcnHgt = ((activeHgtSource == HGT_SOURCE_BCN) && ((imuSampleTime_ms - rngBcnDataDelayed.time_ms) > 2000));
|
||||
if (lostRngHgt || lostGpsHgt || lostExtNavHgt || lostRngBcnHgt) {
|
||||
activeHgtSource = HGT_SOURCE_BARO;
|
||||
|
Loading…
Reference in New Issue
Block a user