mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-21 21:55:34 +08:00
feat(manual_control): trigger RC override on stick velocity
COM_RC_STICK_OV is now a velocity threshold (1/s) instead of a deflection percentage. Default 3.0, range [1.0, 10.0]. A stick held statically cannot trigger override.
This commit is contained in:
@@ -308,17 +308,18 @@ parameters:
|
||||
max: 3
|
||||
COM_RC_STICK_OV:
|
||||
description:
|
||||
short: Stick override threshold
|
||||
short: Stick override velocity threshold
|
||||
long: |-
|
||||
If COM_RC_OVERRIDE is enabled and the joystick input is moved more than this threshold
|
||||
the pilot takes over control.
|
||||
If COM_RC_OVERRIDE is enabled, the pilot takes over control when any stick velocity
|
||||
exceeds this threshold. Unit is normalized stick travel per second: at the default
|
||||
3.0, a half-stick movement in ~170 ms triggers override. Lower = more sensitive.
|
||||
type: float
|
||||
default: 30.0
|
||||
unit: '%'
|
||||
min: 5
|
||||
max: 80
|
||||
decimal: 0
|
||||
increment: 0.05
|
||||
default: 3.0
|
||||
unit: '1/s'
|
||||
min: 1.0
|
||||
max: 10.0
|
||||
decimal: 1
|
||||
increment: 0.5
|
||||
COM_ARM_MIS_REQ:
|
||||
description:
|
||||
short: Require valid mission to arm
|
||||
|
||||
@@ -123,14 +123,15 @@ void ManualControl::processInput(hrt_abstime now)
|
||||
|
||||
processStickArming(_selector.setpoint());
|
||||
|
||||
// User override by stick
|
||||
// User override by stick: any axis velocity exceeds COM_RC_STICK_OV
|
||||
const float dt_s = (now - _timestamp_last_loop) / 1e6f;
|
||||
const float minimum_stick_change = 0.01f * _param_com_rc_stick_ov.get();
|
||||
const float velocity_threshold = _param_com_rc_stick_ov.get();
|
||||
|
||||
_selector.setpoint().sticks_moving = (fabsf(_roll_diff.update(_selector.setpoint().roll, dt_s)) > minimum_stick_change)
|
||||
|| (fabsf(_pitch_diff.update(_selector.setpoint().pitch, dt_s)) > minimum_stick_change)
|
||||
|| (fabsf(_yaw_diff.update(_selector.setpoint().yaw, dt_s)) > minimum_stick_change)
|
||||
|| (fabsf(_throttle_diff.update(_selector.setpoint().throttle, dt_s)) > minimum_stick_change);
|
||||
_selector.setpoint().sticks_moving =
|
||||
(fabsf(_roll_diff.update(_selector.setpoint().roll, dt_s)) > velocity_threshold)
|
||||
|| (fabsf(_pitch_diff.update(_selector.setpoint().pitch, dt_s)) > velocity_threshold)
|
||||
|| (fabsf(_yaw_diff.update(_selector.setpoint().yaw, dt_s)) > velocity_threshold)
|
||||
|| (fabsf(_throttle_diff.update(_selector.setpoint().throttle, dt_s)) > velocity_threshold);
|
||||
|
||||
_selector.setpoint().timestamp = now;
|
||||
_manual_control_setpoint_pub.publish(_selector.setpoint());
|
||||
|
||||
Reference in New Issue
Block a user