forked from Archive/PX4-Autopilot
missionResult: remove unnecessary constants and rename instance_count to mission_update_counter
This commit is contained in:
parent
7afa011741
commit
a92e7a8796
|
@ -1,9 +1,6 @@
|
|||
uint64 timestamp # time since system start (microseconds)
|
||||
uint8 MISSION_EXECUTION_MODE_NORMAL = 0 # Execute the mission according to the planned items
|
||||
uint8 MISSION_EXECUTION_MODE_REVERSE = 1 # Execute the mission in reverse order, ignoring commands and converting all waypoints to normal ones
|
||||
uint8 MISSION_EXECUTION_MODE_FAST_FORWARD = 2 # Execute the mission as fast as possible, for example converting loiter waypoints to normal ones
|
||||
|
||||
uint32 instance_count # Instance count of this mission. Increments monotonically whenever the mission is modified
|
||||
uint16 mission_update_counter # Counter for the mission for which the result was generated
|
||||
|
||||
int32 seq_reached # Sequence of the mission item which has been reached, default -1
|
||||
uint16 seq_current # Sequence of the current mission item
|
||||
|
|
|
@ -1935,19 +1935,19 @@ void Commander::checkForMissionUpdate()
|
|||
if (_mission_result_sub.updated()) {
|
||||
const mission_result_s &mission_result = _mission_result_sub.get();
|
||||
|
||||
const auto prev_mission_instance_count = mission_result.instance_count;
|
||||
const auto prev_mission_mission_update_counter = mission_result.mission_update_counter;
|
||||
_mission_result_sub.update();
|
||||
|
||||
// if mission_result is valid for the current mission
|
||||
const bool mission_result_ok = (mission_result.timestamp > _boot_timestamp)
|
||||
&& (mission_result.instance_count > 0);
|
||||
&& (mission_result.mission_update_counter > 0);
|
||||
|
||||
bool auto_mission_available = mission_result_ok && mission_result.valid;
|
||||
|
||||
if (mission_result_ok) {
|
||||
/* Only evaluate mission state if home is set */
|
||||
if (!_failsafe_flags.home_position_invalid &&
|
||||
(prev_mission_instance_count != mission_result.instance_count)) {
|
||||
(prev_mission_mission_update_counter != mission_result.mission_update_counter)) {
|
||||
|
||||
if (!auto_mission_available) {
|
||||
/* the mission is invalid */
|
||||
|
|
|
@ -56,6 +56,6 @@ void MissionChecks::checkAndReport(const Context &context, Report &reporter)
|
|||
}
|
||||
|
||||
// This is a mode requirement, no need to report
|
||||
reporter.failsafeFlags().auto_mission_missing = mission_result.instance_count <= 0;
|
||||
reporter.failsafeFlags().auto_mission_missing = mission_result.mission_update_counter <= 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -690,14 +690,14 @@ MissionBase::checkMissionRestart()
|
|||
void
|
||||
MissionBase::check_mission_valid()
|
||||
{
|
||||
if (_navigator->get_mission_result()->instance_count != _mission.mission_update_counter) {
|
||||
if (_navigator->get_mission_result()->mission_update_counter != _mission.mission_update_counter) {
|
||||
MissionFeasibilityChecker missionFeasibilityChecker(_navigator, _dataman_client);
|
||||
|
||||
bool is_mission_valid =
|
||||
missionFeasibilityChecker.checkMissionFeasible(_mission);
|
||||
|
||||
_navigator->get_mission_result()->valid = is_mission_valid;
|
||||
_navigator->get_mission_result()->instance_count = _mission.mission_update_counter;
|
||||
_navigator->get_mission_result()->mission_update_counter = _mission.mission_update_counter;
|
||||
_navigator->get_mission_result()->seq_total = _mission.count;
|
||||
_navigator->get_mission_result()->seq_reached = -1;
|
||||
_navigator->get_mission_result()->failure = false;
|
||||
|
|
|
@ -249,7 +249,7 @@ public:
|
|||
|
||||
orb_advert_t *get_mavlink_log_pub() { return &_mavlink_log_pub; }
|
||||
|
||||
int mission_instance_count() const { return _mission_result.instance_count; }
|
||||
int mission_instance_count() const { return _mission_result.mission_update_counter; }
|
||||
|
||||
void set_mission_failure_heading_timeout();
|
||||
|
||||
|
|
Loading…
Reference in New Issue