EKF: always run GPS checks

This commit is contained in:
Paul Riseborough
2018-05-08 08:40:31 +10:00
parent b227aca4a8
commit bd59e381db
+1 -6
View File
@@ -58,11 +58,8 @@
bool Ekf::collect_gps(uint64_t time_usec, struct gps_message *gps) 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 // Run GPS checks always
// 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) {
bool gps_checks_pass = gps_is_good(gps); bool gps_checks_pass = gps_is_good(gps);
if (!_NED_origin_initialised && gps_checks_pass) { 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 // If we have good GPS data set the origin's WGS-84 position to the last gps fix
double lat = gps->lat / 1.0e7; 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; _control_status.flags.rng_hgt = false;
// zero the sensor offset // zero the sensor offset
_hgt_sensor_offset = 0.0f; _hgt_sensor_offset = 0.0f;
} else { } else {
ECL_INFO("EKF GPS checks passed (WGS-84 origin set)"); 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 // start collecting GPS if there is a 3D fix and the NED origin has been set
return _NED_origin_initialised && (gps->fix_type >= 3); return _NED_origin_initialised && (gps->fix_type >= 3);