RTL: replace deny_mission_landing logic by getDestinationTypeMissionLanding()

The rtl instance decides on destination of RTL, and Navigator then switches to
mission mode if required.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2021-10-22 17:28:34 +02:00
committed by Roman Bapst
parent ab08bbdb58
commit f4f9b8ebf2
3 changed files with 6 additions and 10 deletions
+1 -5
View File
@@ -138,7 +138,7 @@ void RTL::find_RTL_destination()
double dist_squared = coord_dist_sq(dlat, dlon);
// set destination to mission landing if closest or in RTL_TYPE_MISSION_LANDING or RTL_TYPE_MISSION_LANDING_REVERSED (so not in RTL_TYPE_CLOSEST)
if (dist_squared < min_dist_squared || _param_rtl_type.get() != RTL_TYPE_CLOSEST) {
if (dist_squared < min_dist_squared || (_param_rtl_type.get() != RTL_TYPE_CLOSEST && !vtol_in_rw_mode)) {
min_dist_squared = dist_squared;
_destination.lat = mission_landing_lat;
_destination.lon = mission_landing_lon;
@@ -235,10 +235,6 @@ void RTL::find_RTL_destination()
void RTL::on_activation()
{
_deny_mission_landing = _navigator->get_vstatus()->is_vtol
&& _navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING;
// output the correct message, depending on where the RTL destination is
switch (_destination.type) {
case RTL_DESTINATION_HOME: