Browse Source

Only use roll/pitch not centered for RC override, and increase override threshold

sbg
Julian Kent 5 years ago committed by Daniel Agar
parent
commit
7958586f35
  1. 9
      src/modules/commander/Commander.cpp
  2. 4
      src/modules/commander/commander_params.c

9
src/modules/commander/Commander.cpp

@ -1884,12 +1884,9 @@ Commander::run()
if ((override_auto_mode || override_offboard_mode) && is_rotary_wing if ((override_auto_mode || override_offboard_mode) && is_rotary_wing
&& !in_low_battery_failsafe && !_geofence_warning_action_on) { && !in_low_battery_failsafe && !_geofence_warning_action_on) {
// transition to previous state if sticks are touched // transition to previous state if sticks are touched
if ((_last_manual_control_setpoint.timestamp != _manual_control_setpoint.timestamp) && if (hrt_elapsed_time(&_manual_control_setpoint.timestamp) < 1_s && // don't use uninitialized or old messages
((fabsf(_manual_control_setpoint.x - _last_manual_control_setpoint.x) > _min_stick_change) || ((fabsf(_manual_control_setpoint.x) > _min_stick_change) ||
(fabsf(_manual_control_setpoint.y - _last_manual_control_setpoint.y) > _min_stick_change) || (fabsf(_manual_control_setpoint.y) > _min_stick_change))) {
(fabsf(_manual_control_setpoint.z - _last_manual_control_setpoint.z) > _min_stick_change) ||
(fabsf(_manual_control_setpoint.r - _last_manual_control_setpoint.r) > _min_stick_change))) {
// revert to position control in any case // revert to position control in any case
main_state_transition(status, commander_state_s::MAIN_STATE_POSCTL, status_flags, &_internal_state); main_state_transition(status, commander_state_s::MAIN_STATE_POSCTL, status_flags, &_internal_state);
mavlink_log_info(&mavlink_log_pub, "Pilot took over control using sticks"); mavlink_log_info(&mavlink_log_pub, "Pilot took over control using sticks");

4
src/modules/commander/commander_params.c

@ -194,11 +194,11 @@ PARAM_DEFINE_FLOAT(COM_RC_LOSS_T, 0.5f);
* @group Commander * @group Commander
* @unit % * @unit %
* @min 5 * @min 5
* @max 40 * @max 80
* @decimal 0 * @decimal 0
* @increment 0.05 * @increment 0.05
*/ */
PARAM_DEFINE_FLOAT(COM_RC_STICK_OV, 12.0f); PARAM_DEFINE_FLOAT(COM_RC_STICK_OV, 50.0f);
/** /**
* Home set horizontal threshold * Home set horizontal threshold

Loading…
Cancel
Save