AP_Mission: added contains_terrain_relative()

used in plane arming check
This commit is contained in:
Andrew Tridgell 2020-06-23 07:23:46 +10:00 committed by Peter Barker
parent 2d06261be3
commit bad0120d3c
2 changed files with 20 additions and 0 deletions

View File

@ -2464,6 +2464,23 @@ bool AP_Mission::contains_item(MAV_CMD command) const
return false;
}
/*
return true if the mission has a terrain relative item
*/
bool AP_Mission::contains_terrain_relative(void) const
{
for (int i = 1; i < num_commands(); i++) {
Mission_Command tmp;
if (!read_cmd_from_storage(i, tmp)) {
continue;
}
if (stored_in_location(tmp.id) && tmp.content.location.terrain_alt) {
return true;
}
}
return false;
}
// reset the mission history to prevent recalling previous mission histories after a mission restart.
void AP_Mission::reset_wp_history(void)
{

View File

@ -619,6 +619,9 @@ public:
// returns true if the mission contains the requested items
bool contains_item(MAV_CMD command) const;
// returns true if the mission has a terrain relative mission item
bool contains_terrain_relative(void) const;
// reset the mission history to prevent recalling previous mission histories when restarting missions.
void reset_wp_history(void);