AP_Mission: added contains_terrain_relative()

used in plane arming check
This commit is contained in:
Andrew Tridgell 2020-06-23 07:26:58 +10:00
parent 0434d496c7
commit fc306128ba
2 changed files with 20 additions and 0 deletions

View File

@ -1969,6 +1969,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;
}
// singleton instance
AP_Mission *AP_Mission::_singleton;

View File

@ -484,6 +484,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;
// user settable parameters
static const struct AP_Param::GroupInfo var_info[];