RTL: fix Mission RTL vs normal RTL (#21464)

* Navigator: on_mission_landing() only can return true if currently in mission mode

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>

* RTL: reset RTL state when not in RTL nav_state

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>

* Navigator: fix mission vs. normal RTL

- remove extra state _should_engange_mission_for_landing from rtl and have
this logic outside of RTL where Navigator decides on running mission RTL or normal RTL
- fix logic in Navigator to decide mission RTL vs normal RTL

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>

* Mission: land_start(): fix decision if already on mission landing

Simply checking landing() is not enough, as that is not reset until
set_current_mission_index(get_land_start_index()) later in the function.
Instead ask Naviator about it (on_mission_landing()).

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>

* Navigator: only update _shouldEngangeMissionForLanding once, to not set it to false after VTOL backtansition

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>

---------

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2023-04-14 09:49:47 +02:00
committed by GitHub
parent 752e3b450d
commit bc560ddddb
5 changed files with 37 additions and 22 deletions
-5
View File
@@ -253,11 +253,6 @@ void RTL::on_activation()
{
_rtl_state = RTL_STATE_NONE;
// if a mission landing is desired we should only execute mission navigation mode if we currently are in fw mode
// In multirotor mode no landing pattern is required so we can just navigate to the land point directly and don't need to run mission
_should_engange_mission_for_landing = (_destination.type == RTL_DESTINATION_MISSION_LANDING)
&& _navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING;
// output the correct message, depending on where the RTL destination is
switch (_destination.type) {
case RTL_DESTINATION_HOME: