AP_NavEKF3: drag fusion for att and velAiding

also add dragTimeout
This commit is contained in:
Randy Mackay 2022-05-10 11:59:57 +09:00
parent 61c4643aed
commit e37bf9ad53
7 changed files with 19 additions and 6 deletions

View File

@ -443,6 +443,7 @@ private:
const uint16_t hgtRetryTimeMode0_ms = 10000; // Height retry time with vertical velocity measurement (msec)
const uint16_t hgtRetryTimeMode12_ms = 5000; // Height retry time without vertical velocity measurement (msec)
const uint16_t tasRetryTime_ms = 5000; // True airspeed timeout and retry interval (msec)
const uint16_t dragFailTimeLimit_ms = 5000; // Drag timeout (msec)
const uint32_t magFailTimeLimit_ms = 10000; // number of msec before a magnetometer failing innovation consistency checks is declared failed (msec)
const float magVarRateScale = 0.005f; // scale factor applied to magnetometer variance due to angular rate
const float gyroBiasNoiseScaler = 2.0f; // scale factor applied to gyro bias state process noise when on ground

View File

@ -270,6 +270,7 @@ void NavEKF3_core::SelectBetaDragFusion()
if (!inhibitWindStates && storedDrag.recall(dragSampleDelayed,imuDataDelayed.time_ms)) {
FuseDragForces();
}
dragTimeout = (imuSampleTime_ms - lastDragPassTime_ms) > frontend->dragFailTimeLimit_ms;
#endif
}
@ -751,6 +752,9 @@ void NavEKF3_core::FuseDragForces()
}
}
}
// record time of successful fusion
lastDragPassTime_ms = imuSampleTime_ms;
}
#endif // EK3_FEATURE_DRAG_FUSION

View File

@ -299,6 +299,9 @@ void NavEKF3_core::setAidingMode()
// Check if airspeed data is being used
bool airSpdUsed = (imuSampleTime_ms - lastTasPassTime_ms <= minTestTime_ms);
// check if drag data is being used
bool dragUsed = (imuSampleTime_ms - lastDragPassTime_ms <= minTestTime_ms);
// Check if range beacon data is being used
bool rngBcnUsed = (imuSampleTime_ms - lastRngBcnPassTime_ms <= minTestTime_ms);
@ -307,10 +310,10 @@ void NavEKF3_core::setAidingMode()
bool gpsVelUsed = (imuSampleTime_ms - lastVelPassTime_ms <= minTestTime_ms);
// Check if attitude drift has been constrained by a measurement source
bool attAiding = posUsed || gpsVelUsed || optFlowUsed || airSpdUsed || rngBcnUsed || bodyOdmUsed;
bool attAiding = posUsed || gpsVelUsed || optFlowUsed || airSpdUsed || dragUsed || rngBcnUsed || bodyOdmUsed;
// check if velocity drift has been constrained by a measurement source
bool velAiding = gpsVelUsed || airSpdUsed || optFlowUsed || bodyOdmUsed;
bool velAiding = gpsVelUsed || airSpdUsed || dragUsed || optFlowUsed || bodyOdmUsed;
// check if position drift has been constrained by a measurement source
bool posAiding = posUsed || rngBcnUsed;
@ -344,6 +347,7 @@ void NavEKF3_core::setAidingMode()
posTimeout = true;
velTimeout = true;
tasTimeout = true;
dragTimeout = true;
gpsIsInUse = false;
} else if (posAidLossCritical) {
// if the loss of position is critical, declare all sources of position aiding as being timed out
@ -683,10 +687,10 @@ void NavEKF3_core::updateFilterStatus(void)
filterStatus.value = 0;
bool doingBodyVelNav = (PV_AidingMode != AID_NONE) && (imuSampleTime_ms - prevBodyVelFuseTime_ms < 5000);
bool doingFlowNav = (PV_AidingMode != AID_NONE) && flowDataValid;
bool doingWindRelNav = !tasTimeout && assume_zero_sideslip();
bool doingWindRelNav = (!tasTimeout && assume_zero_sideslip()) || !dragTimeout;
bool doingNormalGpsNav = !posTimeout && (PV_AidingMode == AID_ABSOLUTE);
bool someVertRefData = (!velTimeout && (useGpsVertVel || useExtNavVel)) || !hgtTimeout;
bool someHorizRefData = !(velTimeout && posTimeout && tasTimeout) || doingFlowNav || doingBodyVelNav;
bool someHorizRefData = !(velTimeout && posTimeout && tasTimeout && dragTimeout) || doingFlowNav || doingBodyVelNav;
bool filterHealthy = healthy() && tiltAlignComplete && (yawAlignComplete || (!use_compass() && (PV_AidingMode != AID_ABSOLUTE)));
// If GPS height usage is specified, height is considered to be inaccurate until the GPS passes all checks

View File

@ -146,7 +146,8 @@ void NavEKF3_core::Log_Write_XKF4(uint64_t time_us) const
velTimeout<<1 |
hgtTimeout<<2 |
magTimeout<<3 |
tasTimeout<<4;
tasTimeout<<4 |
dragTimeout<<5;
nav_filter_status solutionStatus {};
getVariances(velVar, posVar, hgtVar, magVar, tasVar, offset);

View File

@ -226,6 +226,7 @@ void NavEKF3_core::InitialiseVariables()
gpsNoiseScaler = 1.0f;
hgtTimeout = true;
tasTimeout = true;
dragTimeout = true;
badIMUdata = false;
badIMUdata_ms = 0;
goodIMUdata_ms = 0;

View File

@ -983,6 +983,7 @@ private:
bool hgtTimeout; // boolean true if height measurements have failed innovation consistency check and timed out
bool magTimeout; // boolean true if magnetometer measurements have failed for too long and have timed out
bool tasTimeout; // boolean true if true airspeed measurements have failed for too long and have timed out
bool dragTimeout; // boolean true if drag measurements have failed for too long and have timed out
bool badIMUdata; // boolean true if the bad IMU data is detected
uint32_t badIMUdata_ms; // time stamp bad IMU data was last detected
uint32_t goodIMUdata_ms; // time stamp good IMU data was last detected
@ -1319,6 +1320,7 @@ private:
Vector2F innovDragVar; // multirotor drag measurement innovation variance ((m/sec**2)**2)
Vector2F dragTestRatio; // drag innovation consistency check ratio
#endif
uint32_t lastDragPassTime_ms; // system time that drag samples were last successfully fused
bool dragFusionEnabled;
// height source selection logic

View File

@ -185,7 +185,7 @@ struct PACKED log_XKF3 {
// @Field: OFN: Most recent position reset (North component)
// @Field: OFE: Most recent position reset (East component)
// @Field: FS: Filter fault status
// @Field: TS: Filter timeout status bitmask (0:position measurement, 1:velocity measurement, 2:height measurement, 3:magnetometer measurement, 4:airspeed measurement)
// @Field: TS: Filter timeout status bitmask (0:position measurement, 1:velocity measurement, 2:height measurement, 3:magnetometer measurement, 4:airspeed measurement, 5:drag measurement)
// @Field: SS: Filter solution status
// @Field: GPS: Filter GPS status
// @Field: PI: Primary core index