From 2d4be68e00063b8b69600a8d85d36576a5b87ce4 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Thu, 12 Jan 2023 09:44:20 +0100 Subject: [PATCH] VTOL: reset quad-chute failsafe flag when user triggeres a new transition to FW This failsafe flag is currently used for not allowing to re-transition to FW, as well as disabling pusher assist in hover. Till now it was only possible to reset it with a commanded transition to MC, which many ground station interfaces didn't allow as the system, after a quad-chute, already was in MC mode. Hereby it is changed to reset when a new transition to FW is triggered (either via RC switch or MAVLink command). It is the users responsibility to assess the situation after a quad-chute happened to try to transition to FW again, manually proceed/land the vehicle in MC, or let it finish the defined behavior after a quad-chute. Signed-off-by: Silvan Fuhrer --- src/modules/vtol_att_control/standard.cpp | 5 ----- src/modules/vtol_att_control/tailsitter.cpp | 5 ----- src/modules/vtol_att_control/tiltrotor.cpp | 5 ----- .../vtol_att_control/vtol_att_control_main.cpp | 11 +++++++++++ 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/modules/vtol_att_control/standard.cpp b/src/modules/vtol_att_control/standard.cpp index 7818ddc341..a210b8ef27 100644 --- a/src/modules/vtol_att_control/standard.cpp +++ b/src/modules/vtol_att_control/standard.cpp @@ -78,11 +78,6 @@ void Standard::update_vtol_state() _pusher_throttle = 0.0f; _reverse_output = 0.0f; - //reset failsafe when FW is no longer requested - if (!_attc->is_fixed_wing_requested()) { - _vtol_vehicle_status->vtol_transition_failsafe = false; - } - } else if (!_attc->is_fixed_wing_requested()) { // the transition to fw mode switch is off diff --git a/src/modules/vtol_att_control/tailsitter.cpp b/src/modules/vtol_att_control/tailsitter.cpp index 69bc5a7552..74e7810fbf 100644 --- a/src/modules/vtol_att_control/tailsitter.cpp +++ b/src/modules/vtol_att_control/tailsitter.cpp @@ -75,11 +75,6 @@ void Tailsitter::update_vtol_state() // Failsafe event, switch to MC mode immediately _vtol_mode = vtol_mode::MC_MODE; - //reset failsafe when FW is no longer requested - if (!_attc->is_fixed_wing_requested()) { - _vtol_vehicle_status->vtol_transition_failsafe = false; - } - } else if (!_attc->is_fixed_wing_requested()) { switch (_vtol_mode) { // user switchig to MC mode diff --git a/src/modules/vtol_att_control/tiltrotor.cpp b/src/modules/vtol_att_control/tiltrotor.cpp index c48c10a1f4..a00c52860a 100644 --- a/src/modules/vtol_att_control/tiltrotor.cpp +++ b/src/modules/vtol_att_control/tiltrotor.cpp @@ -75,11 +75,6 @@ void Tiltrotor::update_vtol_state() // Failsafe event, switch to MC mode immediately _vtol_mode = vtol_mode::MC_MODE; - //reset failsafe when FW is no longer requested - if (!_attc->is_fixed_wing_requested()) { - _vtol_vehicle_status->vtol_transition_failsafe = false; - } - } else if (!_attc->is_fixed_wing_requested()) { // plane is in multicopter mode diff --git a/src/modules/vtol_att_control/vtol_att_control_main.cpp b/src/modules/vtol_att_control/vtol_att_control_main.cpp index 77c440b7b4..dfcf60af43 100644 --- a/src/modules/vtol_att_control/vtol_att_control_main.cpp +++ b/src/modules/vtol_att_control/vtol_att_control_main.cpp @@ -133,6 +133,12 @@ void VtolAttitudeControl::action_request_poll() case action_request_s::ACTION_VTOL_TRANSITION_TO_FIXEDWING: _transition_command = vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW; _immediate_transition = false; + + // reset vtol_transition_failsafe flag when a new transition to FW is triggered + if (_transition_command == vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW) { + _vtol_vehicle_status.vtol_transition_failsafe = false; + } + break; } } @@ -162,6 +168,11 @@ void VtolAttitudeControl::vehicle_cmd_poll() } else { _transition_command = transition_command_param1; _immediate_transition = (PX4_ISFINITE(vehicle_command.param2)) ? int(vehicle_command.param2 + 0.5f) : false; + + // reset vtol_transition_failsafe flag when a new transition to FW is triggered + if (_transition_command == vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW) { + _vtol_vehicle_status.vtol_transition_failsafe = false; + } } if (vehicle_command.from_external) {