diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp index f6b8042dd5..51f5f7a8f8 100644 --- a/src/modules/commander/Commander.cpp +++ b/src/modules/commander/Commander.cpp @@ -2115,16 +2115,17 @@ Commander::run() && _vehicle_control_mode.flag_control_offboard_enabled; if ((override_auto_mode || override_offboard_mode) && !in_low_battery_failsafe && !_geofence_warning_action_on) { - const float minimum_stick_deflection = 0.01f * _param_com_rc_stick_ov.get(); + const float minimum_stick_change = .01f * _param_com_rc_stick_ov.get(); - const bool rpy_deflected = (fabsf(_manual_control_setpoint.x) > minimum_stick_deflection) || - (fabsf(_manual_control_setpoint.y) > minimum_stick_deflection) - || (fabsf(_manual_control_setpoint.r) > minimum_stick_deflection); - const bool throttle_deflected = fabsf(_manual_control_setpoint.z - 0.5f) * 2.f > minimum_stick_deflection; + const bool rpy_moved = (fabsf(_manual_control_setpoint.x - _last_manual_control_setpoint.x) > minimum_stick_change) + || (fabsf(_manual_control_setpoint.y - _last_manual_control_setpoint.y) > minimum_stick_change) + || (fabsf(_manual_control_setpoint.r - _last_manual_control_setpoint.r) > minimum_stick_change); + const bool throttle_moved = + (fabsf(_manual_control_setpoint.z - _last_manual_control_setpoint.z) * 2.f > minimum_stick_change); const bool use_throttle = !(_param_rc_override.get() & OVERRIDE_IGNORE_THROTTLE_BIT); if (!_status.rc_signal_lost && - (rpy_deflected || (use_throttle && throttle_deflected))) { + (rpy_moved || (use_throttle && throttle_moved))) { if (main_state_transition(_status, commander_state_s::MAIN_STATE_POSCTL, _status_flags, &_internal_state) == TRANSITION_CHANGED) { tune_positive(true); diff --git a/src/modules/commander/commander_params.c b/src/modules/commander/commander_params.c index e59284cf3d..6a9d7e6e18 100644 --- a/src/modules/commander/commander_params.c +++ b/src/modules/commander/commander_params.c @@ -648,8 +648,8 @@ PARAM_DEFINE_INT32(COM_RC_OVERRIDE, 1); /** * RC stick override threshold * - * If COM_RC_OVERRIDE is enabled and the joystick input is moved more than this threshold from the center - * the autopilot switches to position mode and the pilot takes over control. + * If COM_RC_OVERRIDE is enabled and the joystick input is moved more than this threshold + * the autopilot the pilot takes over control. * * @group Commander * @unit %