AP_NavEKF: Improve behaviour recovering from a GPS timeout
When regaining GPS after a timeout, an offset is applied when fusing GPS velocity so that GPS velocity and position data as fused by the EKF is kinematically consistent.
This velocity offset is also accounted for when fusing air data so that wind estimates are not corrupted when the GPS position offset is being pulle back to zero.
The intended behaviour is that the EKF position will be pulled back to the GPS position at a rate of 5m/s for planes and 1 m/s for copters. This avoids large deviations in trajectory when GPS is regained.
state.velocity.x=velNED.x;// north velocity from blended accel data
state.velocity.y=velNED.y;// east velocity from blended accel data
state.vel1.x=velNED.x;// north velocity from IMU1 accel data
state.vel1.y=velNED.y;// east velocity from IMU1 accel data
state.vel2.x=velNED.x;// north velocity from IMU2 accel data
state.vel2.y=velNED.y;// east velocity from IMU2 accel data
// reset horizontal velocity states, applying an offset to the GPS velocity to prevent the GPS position being rejected when the GPS position offset is being decayed to zero.
state.velocity.x=velNED.x+gpsVelGlitchOffset.x;// north velocity from blended accel data
state.velocity.y=velNED.y+gpsVelGlitchOffset.y;// east velocity from blended accel data
state.vel1.x=velNED.x+gpsVelGlitchOffset.x;// north velocity from IMU1 accel data
state.vel1.y=velNED.y+gpsVelGlitchOffset.y;// east velocity from IMU1 accel data
state.vel2.x=velNED.x+gpsVelGlitchOffset.x;// north velocity from IMU2 accel data
state.vel2.y=velNED.y+gpsVelGlitchOffset.y;// east velocity from IMU2 accel data
// over write stored horizontal velocity states to prevent subsequent GPS measurements from being rejected
// decay and limit the position offset which is applied to NE position wherever it is used throughout code to allow GPS position jumps to be accommodated gradually
// calculate a position offset which is applied to NE position and velocity wherever it is used throughout code to allow GPS position jumps to be accommodated gradually
// Calculate the GPS velocity offset required. This is necessary to prevent the position measurement being rejected for inconsistency when the radius is being pulled back in.
boolfirstArmComplete;// true when first transition out of static mode has been performed after start up
boolfinalMagYawInit;// true when the final post takeoff initialisation of earth field and yaw angle has been performed
boolflowTimeout;// true when optical flow measurements have time out
Vector2fgpsVelGlitchOffset;// Offset applied to the GPS velocity when the gltch radius is being decayed back to zero
// Used by smoothing of state corrections
floatgpsIncrStateDelta[10];// vector of corrections to attitude, velocity and position to be applied over the period between the current and next GPS measurement