gps: fixed filter initialization bug around gps

- do not gps reference altitude to zero in case gps checks pass before the
filter initialized
- reset the filtered gps position and position derivative filters in case
we are in air or there is movement on the ground

Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
RomanBapst
2020-06-04 15:52:43 +03:00
committed by Mathieu Bresciani
parent 8f533cb878
commit b7d54b5477
4 changed files with 14 additions and 4 deletions
+4 -4
View File
@@ -93,6 +93,10 @@ void Ekf::reset()
_accel_magnitude_filt = 0.0f;
_ang_rate_magnitude_filt = 0.0f;
_prev_dvel_bias_var.zero();
_gps_alt_ref = 0.0f;
resetGpsDriftCheckFilters();
}
bool Ekf::update()
@@ -189,10 +193,6 @@ bool Ekf::initialiseFilter()
// we use baro height initially and switch to GPS/range/EV finder later when it passes checks.
setControlBaroHeight();
// reset variables that are shared with post alignment GPS checks
_gps_pos_deriv_filt(2) = 0.0f;
_gps_alt_ref = 0.0f;
if(!initialiseTilt()){
return false;
}