mirror of https://github.com/ArduPilot/ardupilot
AP_Mission: added contains_terrain_relative()
used in plane arming check
This commit is contained in:
parent
0434d496c7
commit
fc306128ba
|
@ -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;
|
||||
|
||||
|
|
|
@ -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[];
|
||||
|
||||
|
|
Loading…
Reference in New Issue