Check mission climb always on current mission item (#22230)

* mission_base: reset inactivation index when user set a new mission index, or mission is reset.

* mission_base: check Climb required always on current mission item
This commit is contained in:
KonradRudin
2023-10-18 07:59:20 +02:00
committed by GitHub
parent e8a0a0772e
commit 988705831d
3 changed files with 6 additions and 2 deletions
+3
View File
@@ -141,6 +141,9 @@ Mission::set_current_mission_index(uint16_t index)
set_mission_items();
}
// User has actively set new index, reset.
_inactivation_index = -1;
return true;
}
+2 -1
View File
@@ -243,7 +243,7 @@ MissionBase::on_activation()
}
}
checkClimbRequired(resume_index);
checkClimbRequired(_mission.current_seq);
set_mission_items();
_inactivation_index = -1; // reset
@@ -557,6 +557,7 @@ MissionBase::checkMissionRestart()
if (_system_disarmed_while_inactive && _mission_has_been_activated && (_mission.count > 0U)
&& ((_mission.current_seq + 1) == _mission.count)) {
setMissionIndex(0);
_inactivation_index = -1; // reset
_is_current_planned_mission_item_valid = isMissionValid(_mission);
resetMissionJumpCounter();
_navigator->reset_cruising_speed();
+1 -1
View File
@@ -295,6 +295,7 @@ protected:
bool _system_disarmed_while_inactive{false}; /**< Flag indicating if the system has been disarmed while mission is inactive*/
mission_s _mission; /**< Currently active mission*/
float _mission_init_climb_altitude_amsl{NAN}; /**< altitude AMSL the vehicle will climb to when mission starts */
int _inactivation_index{-1}; // index of mission item at which the mission was paused. Used to resume survey missions at previous waypoint to not lose images.
DatamanCache _dataman_cache{"mission_dm_cache_miss", 10}; /**< Dataman cache of mission items*/
DatamanClient &_dataman_client = _dataman_cache.client(); /**< Dataman client*/
@@ -428,7 +429,6 @@ private:
int32_t _load_mission_index{-1}; /**< Mission inted of loaded mission items in dataman cache*/
int32_t _dataman_cache_size_signed; /**< Size of the dataman cache. A negativ value indicates that previous mission items should be loaded, a positiv value the next mission items*/
int _inactivation_index{-1}; // index of mission item at which the mission was paused. Used to resume survey missions at previous waypoint to not lose images.
bool _align_heading_necessary{false}; // if true, heading of vehicle needs to be aligned with heading of next waypoint. Used to create new mission items for heading alignment.
mission_item_s _last_gimbal_configure_item {};