mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 07:44:03 -04:00
ArduCopter: make terrain checks common between Copter and Plane
This commit is contained in:
parent
3bcd4fa22a
commit
67d8965cad
@ -120,6 +120,17 @@ bool AP_Arming_Copter::board_voltage_checks(bool display_failure)
|
||||
return true;
|
||||
}
|
||||
|
||||
// expected to return true if the terrain database is required to have
|
||||
// all data loaded
|
||||
bool AP_Arming_Copter::terrain_database_required() const
|
||||
{
|
||||
if (copter.wp_nav->get_terrain_source() == AC_WPNav::TerrainSource::TERRAIN_FROM_TERRAINDATABASE &&
|
||||
copter.mode_rtl.get_alt_type() == ModeRTL::RTLAltType::RTL_ALTTYPE_TERRAIN) {
|
||||
return true;
|
||||
}
|
||||
return AP_Arming::terrain_database_required();
|
||||
}
|
||||
|
||||
bool AP_Arming_Copter::parameter_checks(bool display_failure)
|
||||
{
|
||||
// check various parameter values
|
||||
@ -228,22 +239,7 @@ bool AP_Arming_Copter::parameter_checks(bool display_failure)
|
||||
}
|
||||
break;
|
||||
case AC_WPNav::TerrainSource::TERRAIN_FROM_TERRAINDATABASE:
|
||||
#if AP_TERRAIN_AVAILABLE
|
||||
if (!copter.terrain.enabled()) {
|
||||
check_failed(ARMING_CHECK_PARAMETERS, display_failure, failure_template, "terrain disabled");
|
||||
return false;
|
||||
}
|
||||
// check terrain data is loaded
|
||||
uint16_t terr_pending, terr_loaded;
|
||||
copter.terrain.get_statistics(terr_pending, terr_loaded);
|
||||
if (terr_pending != 0) {
|
||||
check_failed(ARMING_CHECK_PARAMETERS, display_failure, failure_template, "waiting for terrain data");
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
check_failed(ARMING_CHECK_PARAMETERS, display_failure, failure_template, "terrain disabled");
|
||||
return false;
|
||||
#endif
|
||||
// these checks are done in AP_Arming
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,10 @@ protected:
|
||||
|
||||
void set_pre_arm_check(bool b);
|
||||
|
||||
// expected to return true if the terrain database is required to have
|
||||
// all data loaded
|
||||
bool terrain_database_required() const override;
|
||||
|
||||
private:
|
||||
|
||||
// actually contains the pre-arm checks. This is wrapped so that
|
||||
|
Loading…
Reference in New Issue
Block a user