// reduce weighting (increase observation noise) on baro if we are likely to be in ground effect
// reduce weighting (increase observation noise) on baro if we are likely to be in ground effect
if(getGndEffectMode()){
// when on the ground we use a smaller observation noise because there are less baro disturbances and we can do faster learning of Z accelerometer bias offsets
if(getGndEffectMode()&&vehicleArmed){
R_OBS[5]*=gndEffectBaroScaler;
R_OBS[5]*=gndEffectBaroScaler;
}elseif(!vehicleArmed){
R_OBS[5]=sq(onGndBaroNoise);
}
}
// For data integrity checks we use the same measurement variances as used to calculate the Kalman gains for all measurements except GPS horizontal velocity
// For data integrity checks we use the same measurement variances as used to calculate the Kalman gains for all measurements except GPS horizontal velocity
@ -2161,7 +2166,7 @@ void NavEKF::FuseVelPosNED()
// Increase allowed rate of change when disarmed as estimates will be less noisy
// Increase allowed rate of change when disarmed as estimates will be less noisy
floatcorrectionLimit=0.005f*dtIMU*dtVelPos;
floatcorrectionLimit=0.005f*dtIMU*dtVelPos;
if(!vehicleArmed){
if(!vehicleArmed){
correctionLimit*=imuBiasNoiseScaler;
correctionLimit*=accelBiasNoiseScaler;
}
}
state.accel_zbias1-=constrain_float(Kfusion[13]*hgtInnov1,-correctionLimit,correctionLimit);// IMU1 Z accel bias
state.accel_zbias1-=constrain_float(Kfusion[13]*hgtInnov1,-correctionLimit,correctionLimit);// IMU1 Z accel bias
state.accel_zbias2-=constrain_float(Kfusion[22]*hgtInnov2,-correctionLimit,correctionLimit);// IMU2 Z accel bias
state.accel_zbias2-=constrain_float(Kfusion[22]*hgtInnov2,-correctionLimit,correctionLimit);// IMU2 Z accel bias
@ -3996,11 +4001,11 @@ void NavEKF::readGpsData()
}
}
// check if we have enough GPS satellites and increase the gps noise scaler if we don't
// check if we have enough GPS satellites and increase the gps noise scaler if we don't