Commander: make RC override multicopter only

AAs discussed in the devcall this functionality is only useful for
rotary-wing (multicopter) flying since it's a big safety hazard to
accidentally bring a fixed wing out of an auto mode e.g. a mission
and fly away in a straight line or into an obstacle.
This commit is contained in:
Matthias Grob
2019-07-18 14:15:41 +01:00
parent 5c1ab06343
commit 706500f19c
2 changed files with 7 additions and 1 deletions
+2 -1
View File
@@ -1825,6 +1825,7 @@ Commander::run()
// abort auto mode or geofence reaction if sticks are moved significantly
// but only if not in a low battery handling action
const bool not_in_low_battery_reaction = _battery_warning < battery_status_s::BATTERY_WARNING_CRITICAL;
const bool is_rotary_wing = status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING;
const bool manual_mode_before_geofence =
main_state_before_rtl == commander_state_s::MAIN_STATE_MANUAL ||
main_state_before_rtl == commander_state_s::MAIN_STATE_ALTCTL ||
@@ -1837,7 +1838,7 @@ Commander::run()
internal_state.main_state == commander_state_s::MAIN_STATE_AUTO_MISSION ||
internal_state.main_state == commander_state_s::MAIN_STATE_AUTO_LOITER;
if (rc_override != 0 && not_in_low_battery_reaction
if (rc_override != 0 && is_rotary_wing && not_in_low_battery_reaction
&& (in_auto_mode || (_geofence_warning_action_on && manual_mode_before_geofence))) {
// transition to previous state if sticks are touched
if ((_last_sp_man.timestamp != sp_man.timestamp) &&
+5
View File
@@ -613,6 +613,11 @@ PARAM_DEFINE_FLOAT(COM_ARM_MAG, 0.15f);
/**
* Enable RC stick override of auto modes
*
* When an auto mode is active (except a critical battery reaction) moving the RC sticks
* gives control back to the pilot in manual position mode immediately.
*
* Only has an effect on multicopters and VTOLS in multicopter mode.
*
* @boolean
* @group Commander
*/