AP_Mission: Add a helper to check if a mission contains an item
This commit is contained in:
parent
0d369929cb
commit
fccf23dff2
@ -1849,6 +1849,20 @@ const char *AP_Mission::Mission_Command::type() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AP_Mission::contains_item(MAV_CMD command) const
|
||||||
|
{
|
||||||
|
for (int i = 1; i < num_commands(); i++) {
|
||||||
|
Mission_Command tmp;
|
||||||
|
if (!read_cmd_from_storage(i, tmp)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (tmp.id == command) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// singleton instance
|
// singleton instance
|
||||||
AP_Mission *AP_Mission::_singleton;
|
AP_Mission *AP_Mission::_singleton;
|
||||||
|
|
||||||
|
@ -478,6 +478,9 @@ public:
|
|||||||
return _rsem;
|
return _rsem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns true if the mission contains the requested items
|
||||||
|
bool contains_item(MAV_CMD command) const;
|
||||||
|
|
||||||
// user settable parameters
|
// user settable parameters
|
||||||
static const struct AP_Param::GroupInfo var_info[];
|
static const struct AP_Param::GroupInfo var_info[];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user