mirror of https://github.com/ArduPilot/ardupilot
AP_Arming: only compare AHRS vs GPS if GPS is enabled
This commit is contained in:
parent
ba234330d9
commit
cb39bd72d3
|
@ -598,13 +598,15 @@ bool AP_Arming::gps_checks(bool report)
|
|||
}
|
||||
|
||||
// check AHRS and GPS are within 10m of each other
|
||||
const Location gps_loc = gps.location();
|
||||
Location ahrs_loc;
|
||||
if (AP::ahrs().get_location(ahrs_loc)) {
|
||||
const float distance = gps_loc.get_distance(ahrs_loc);
|
||||
if (distance > AP_ARMING_AHRS_GPS_ERROR_MAX) {
|
||||
check_failed(ARMING_CHECK_GPS, report, "GPS and AHRS differ by %4.1fm", (double)distance);
|
||||
return false;
|
||||
if (gps.num_sensors() > 0) {
|
||||
const Location gps_loc = gps.location();
|
||||
Location ahrs_loc;
|
||||
if (AP::ahrs().get_location(ahrs_loc)) {
|
||||
const float distance = gps_loc.get_distance(ahrs_loc);
|
||||
if (distance > AP_ARMING_AHRS_GPS_ERROR_MAX) {
|
||||
check_failed(ARMING_CHECK_GPS, report, "GPS and AHRS differ by %4.1fm", (double)distance);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue