mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-18 04:27:34 +08:00
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:
committed by
Mathieu Bresciani
parent
8f533cb878
commit
b7d54b5477
+4
-4
@@ -93,6 +93,10 @@ void Ekf::reset()
|
|||||||
_accel_magnitude_filt = 0.0f;
|
_accel_magnitude_filt = 0.0f;
|
||||||
_ang_rate_magnitude_filt = 0.0f;
|
_ang_rate_magnitude_filt = 0.0f;
|
||||||
_prev_dvel_bias_var.zero();
|
_prev_dvel_bias_var.zero();
|
||||||
|
|
||||||
|
_gps_alt_ref = 0.0f;
|
||||||
|
|
||||||
|
resetGpsDriftCheckFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Ekf::update()
|
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.
|
// we use baro height initially and switch to GPS/range/EV finder later when it passes checks.
|
||||||
setControlBaroHeight();
|
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()){
|
if(!initialiseTilt()){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -893,4 +893,5 @@ private:
|
|||||||
// Returns true if the reset was successful
|
// Returns true if the reset was successful
|
||||||
bool resetYawToEKFGSF();
|
bool resetYawToEKFGSF();
|
||||||
|
|
||||||
|
void resetGpsDriftCheckFilters();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1866,3 +1866,9 @@ void Ekf::runYawEKFGSF()
|
|||||||
yawEstimator.setVelocity(_gps_sample_delayed.vel.xy(), _gps_sample_delayed.vacc);
|
yawEstimator.setVelocity(_gps_sample_delayed.vel.xy(), _gps_sample_delayed.vacc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Ekf::resetGpsDriftCheckFilters()
|
||||||
|
{
|
||||||
|
_gps_velNE_filt.setZero();
|
||||||
|
_gps_pos_deriv_filt.setZero();
|
||||||
|
}
|
||||||
|
|||||||
@@ -194,10 +194,13 @@ bool Ekf::gps_is_good(const gps_message &gps)
|
|||||||
_gps_check_fail_status.flags.hspeed = false;
|
_gps_check_fail_status.flags.hspeed = false;
|
||||||
_gps_drift_updated = false;
|
_gps_drift_updated = false;
|
||||||
|
|
||||||
|
resetGpsDriftCheckFilters();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// This is the case where the vehicle is on ground and IMU movement is blocking the drift calculation
|
// This is the case where the vehicle is on ground and IMU movement is blocking the drift calculation
|
||||||
_gps_drift_updated = true;
|
_gps_drift_updated = true;
|
||||||
|
|
||||||
|
resetGpsDriftCheckFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
// save GPS fix for next time
|
// save GPS fix for next time
|
||||||
|
|||||||
Reference in New Issue
Block a user