Commander: RC override back to stick change

Instead of deflection mainly because:
- Spring loaded throttle -> bad user experience
- Stale RC data -> Vehicle not savable
This commit is contained in:
Matthias Grob 2021-01-27 18:00:33 +01:00
parent 0204fe8663
commit a457710d4c
2 changed files with 9 additions and 8 deletions

View File

@ -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);

View File

@ -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 %