mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-15 23:13:34 +08:00
EKF: always run GPS checks
This commit is contained in:
+1
-6
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user