Skip to content

Commit

Permalink
Commander: make RC override multicopter only
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MaEtUgR committed Jul 22, 2019
1 parent 5c1ab06 commit 706500f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/commander/Commander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand All @@ -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) &&
Expand Down
5 changes: 5 additions & 0 deletions src/modules/commander/commander_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 706500f

Please sign in to comment.