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
|
// check AHRS and GPS are within 10m of each other
|
||||||
const Location gps_loc = gps.location();
|
if (gps.num_sensors() > 0) {
|
||||||
Location ahrs_loc;
|
const Location gps_loc = gps.location();
|
||||||
if (AP::ahrs().get_location(ahrs_loc)) {
|
Location ahrs_loc;
|
||||||
const float distance = gps_loc.get_distance(ahrs_loc);
|
if (AP::ahrs().get_location(ahrs_loc)) {
|
||||||
if (distance > AP_ARMING_AHRS_GPS_ERROR_MAX) {
|
const float distance = gps_loc.get_distance(ahrs_loc);
|
||||||
check_failed(ARMING_CHECK_GPS, report, "GPS and AHRS differ by %4.1fm", (double)distance);
|
if (distance > AP_ARMING_AHRS_GPS_ERROR_MAX) {
|
||||||
return false;
|
check_failed(ARMING_CHECK_GPS, report, "GPS and AHRS differ by %4.1fm", (double)distance);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user