mission: be more intelligent about saying that we are on a mission landing

- previously the decision of being on a landing pattern was taken by just
looking at the current mission index. However, even if the current mission
index indicates a landing pattern the vehicle could be at an arbitrary location, far
from being established on the pattern.

Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
RomanBapst
2021-01-04 11:58:16 +01:00
committed by Lorenz Meier
parent 29c3ce6d5d
commit a4a03e86da
6 changed files with 49 additions and 6 deletions
+7 -1
View File
@@ -225,8 +225,10 @@ void RTL::on_activation()
// For safety reasons don't go into RTL if landed.
_rtl_state = RTL_STATE_LANDED;
} else if ((_destination.type == RTL_DESTINATION_MISSION_LANDING) && _navigator->on_mission_landing()) {
} else if ((_destination.type == RTL_DESTINATION_MISSION_LANDING) && _navigator->getMissionLandingInProgress()) {
// RTL straight to RETURN state, but mission will takeover for landing.
_rtl_state = RTL_STATE_RETURN;
} else if ((global_position.alt < _destination.alt + _param_rtl_return_alt.get()) || _rtl_alt_min) {
@@ -239,7 +241,10 @@ void RTL::on_activation()
_rtl_state = RTL_STATE_RETURN;
}
setInitialClimbDone(_rtl_state != RTL_STATE_CLIMB);
set_rtl_item();
}
void RTL::on_active()
@@ -476,6 +481,7 @@ void RTL::advance_rtl()
switch (_rtl_state) {
case RTL_STATE_CLIMB:
setInitialClimbDone(true);
_rtl_state = RTL_STATE_RETURN;
break;