Skip to content

Commit

Permalink
mission_base: Force mission validity check on activation
Browse files Browse the repository at this point in the history
  • Loading branch information
KonradRudin authored and sfuhrer committed Mar 8, 2024
1 parent 1aa26a5 commit 04099ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 7 additions & 5 deletions src/modules/navigator/mission_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ MissionBase::on_activation()
_mission_has_been_activated = true;
_system_disarmed_while_inactive = false;

check_mission_valid();
check_mission_valid(true);

update_mission();

Expand Down Expand Up @@ -687,11 +687,13 @@ MissionBase::checkMissionRestart()
}

void
MissionBase::check_mission_valid()
MissionBase::check_mission_valid(bool forced)
{
if ((_navigator->get_mission_result()->mission_id != _mission.mission_id)
|| (_navigator->get_mission_result()->geofence_id != _mission.geofence_id)
|| (_navigator->get_mission_result()->home_position_counter != _navigator->get_home_position()->update_count)) {
// Allow forcing it, since we currently not rechecking if parameters have changed.
if (forced ||
(_navigator->get_mission_result()->mission_id != _mission.mission_id) ||
(_navigator->get_mission_result()->geofence_id != _mission.geofence_id) ||
(_navigator->get_mission_result()->home_position_counter != _navigator->get_home_position()->update_count)) {

_navigator->get_mission_result()->mission_id = _mission.mission_id;
_navigator->get_mission_result()->geofence_id = _mission.geofence_id;
Expand Down
5 changes: 3 additions & 2 deletions src/modules/navigator/mission_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,10 @@ class MissionBase : public MissionBlock, public ModuleParams
void updateMavlinkMission();

/**
* Check whether a mission is ready to go
* @brief Check whether a mission is ready to go
* @param[in] forced flag if the check has to be run irregardles of any updates.
*/
void check_mission_valid();
void check_mission_valid(bool forced = false);

/**
* Reset mission
Expand Down

0 comments on commit 04099ed

Please sign in to comment.