|
|
|
@ -71,6 +71,9 @@ AttPosEKF::AttPosEKF() :
@@ -71,6 +71,9 @@ AttPosEKF::AttPosEKF() :
|
|
|
|
|
dtVelPosFilt(0.01f), |
|
|
|
|
dtHgtFilt(0.01f), |
|
|
|
|
dtGpsFilt(0.1f), |
|
|
|
|
windSpdFiltNorth(0.0f), |
|
|
|
|
windSpdFiltEast(0.0f), |
|
|
|
|
windSpdFiltAltitude(0.0f), |
|
|
|
|
fusionModeGPS(0), |
|
|
|
|
innovVelPos{}, |
|
|
|
|
varInnovVelPos{}, |
|
|
|
@ -1657,6 +1660,24 @@ void AttPosEKF::FuseAirspeed()
@@ -1657,6 +1660,24 @@ void AttPosEKF::FuseAirspeed()
|
|
|
|
|
// Perform fusion of True Airspeed measurement
|
|
|
|
|
if (useAirspeed && fuseVtasData && (VtasPred > 1.0f) && (VtasMeas > 8.0f)) |
|
|
|
|
{ |
|
|
|
|
// Lowpass the output of the wind estimate - we want a long-term
|
|
|
|
|
// stable estimate, but not start to load into the overall dynamics
|
|
|
|
|
// of the system (which adjusting covariances would do)
|
|
|
|
|
|
|
|
|
|
// Nominally damp to 0.02% of the noise, but reduce the damping for strong altitude variations
|
|
|
|
|
// assuming equal wind speeds on the same altitude and varying wind speeds on
|
|
|
|
|
// different altitudes
|
|
|
|
|
float windFiltCoeff = 0.0002f; |
|
|
|
|
|
|
|
|
|
float altDiff = fabsf(windSpdFiltAltitude - hgtMea); |
|
|
|
|
|
|
|
|
|
// Change filter coefficient based on altitude
|
|
|
|
|
windFiltCoeff += ConstrainFloat(0.00001f * altDiff, windFiltCoeff, 0.1f); |
|
|
|
|
|
|
|
|
|
windSpdFiltNorth = ((1.0f - windFiltCoeff) * windSpdFiltNorth) + (windFiltCoeff * vwn); |
|
|
|
|
windSpdFiltEast = ((1.0f - windFiltCoeff) * windSpdFiltEast) + (windFiltCoeff * vwe); |
|
|
|
|
windSpdFiltAltitude = hgtMea; |
|
|
|
|
|
|
|
|
|
// Calculate observation jacobians
|
|
|
|
|
SH_TAS[0] = 1/(sqrt(sq(ve - vwe) + sq(vn - vwn) + sq(vd))); |
|
|
|
|
SH_TAS[1] = (SH_TAS[0]*(2.0f*ve - 2*vwe))/2.0f; |
|
|
|
|