From 33a307873a35104008ad516a6e470ce89ee6baea Mon Sep 17 00:00:00 2001 From: Chris Lovett Date: Wed, 18 Jan 2017 02:56:34 -0800 Subject: [PATCH] Enable rc mode change switch to override offboard mode. This is a safety feature, in case offboard control goes crazy, user can always regain control by switching modes to stabilize, or alt hold or position hold, however they have configured the mode change RC switch. --- src/modules/commander/commander.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 40cf15c189..869395d0ec 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -3249,12 +3249,9 @@ set_main_state_rc(struct vehicle_status_s *status_local) /* set main state according to RC switches */ transition_result_t res = TRANSITION_DENIED; - // XXX this should not be necessary any more, we should be able to - // just delete this and respond to mode switches - /* if offboard is set already by a mavlink command, abort */ - if (status_flags.offboard_control_set_by_command) { - return main_state_transition(status_local, commander_state_s::MAIN_STATE_OFFBOARD, main_state_prev, &status_flags, &internal_state); - } + // Note: even if status_flags.offboard_control_set_by_command is set + // we want to allow rc mode change to take precidence. This is a safety + // feature, just in case offboard control goes crazy. /* manual setpoint has not updated, do not re-evaluate it */ if (((_last_sp_man.timestamp != 0) && (_last_sp_man.timestamp == sp_man.timestamp)) ||