EKF: always run GPS checks

This commit is contained in:
Paul Riseborough 2018-02-26 12:12:41 +11:00
parent b227aca4a8
commit bd59e381db
1 changed files with 32 additions and 37 deletions

View File

@ -58,11 +58,8 @@
bool Ekf::collect_gps(uint64_t time_usec, struct gps_message *gps)
{
// Run GPS checks whenever the WGS-84 origin is not set or the vehicle is not using GPS
// Also run checks if the vehicle is on-ground as the check data can be used by vehicle pre-flight checks
if (!_control_status.flags.in_air || !_NED_origin_initialised || !_control_status.flags.gps) {
// Run GPS checks always
bool gps_checks_pass = gps_is_good(gps);
if (!_NED_origin_initialised && gps_checks_pass) {
// If we have good GPS data set the origin's WGS-84 position to the last gps fix
double lat = gps->lat / 1.0e7;
@ -94,12 +91,10 @@ bool Ekf::collect_gps(uint64_t time_usec, struct gps_message *gps)
_control_status.flags.rng_hgt = false;
// zero the sensor offset
_hgt_sensor_offset = 0.0f;
} else {
ECL_INFO("EKF GPS checks passed (WGS-84 origin set)");
}
}
}
// start collecting GPS if there is a 3D fix and the NED origin has been set
return _NED_origin_initialised && (gps->fix_type >= 3);