Sticks: globalize MPC_HOLD_DZ to MAN_DEADZONE

This commit is contained in:
Matthias Grob
2025-09-04 14:56:34 +02:00
committed by Silvan Fuhrer
parent a9720cf1ef
commit 2bf9fce577
8 changed files with 30 additions and 27 deletions
@@ -645,7 +645,6 @@
1 1 MPC_ACC_HOR_MAX 5.000000000000000000 9 1 1 MPC_ACC_HOR_MAX 5.000000000000000000 9
1 1 MPC_ACC_UP_MAX 4.000000000000000000 9 1 1 MPC_ACC_UP_MAX 4.000000000000000000 9
1 1 MPC_ALT_MODE 2 6 1 1 MPC_ALT_MODE 2 6
1 1 MPC_HOLD_DZ 0.100000001490116119 9
1 1 MPC_HOLD_MAX_XY 0.800000011920928955 9 1 1 MPC_HOLD_MAX_XY 0.800000011920928955 9
1 1 MPC_HOLD_MAX_Z 0.600000023841857910 9 1 1 MPC_HOLD_MAX_Z 0.600000023841857910 9
1 1 MPC_JERK_AUTO 4.000000000000000000 9 1 1 MPC_JERK_AUTO 4.000000000000000000 9
+6 -6
View File
@@ -43,7 +43,7 @@ While very rare on a well calibrated vehicle, sometimes there may be problems wi
RC mode where roll, pitch, throttle (RPT) sticks control movement in corresponding axes/directions. RC mode where roll, pitch, throttle (RPT) sticks control movement in corresponding axes/directions.
Centered sticks level vehicle and hold it to fixed altitude and position against wind. Centered sticks level vehicle and hold it to fixed altitude and position against wind.
- Centered roll, pitch, throttle sticks (within RC deadzone [MPC_HOLD_DZ](../advanced_config/parameter_reference.md#MPC_HOLD_DZ)) hold x, y, z position steady against any disturbance like wind. - Centered roll, pitch, throttle sticks (within RC deadzone [MAN_DEADZONE](../advanced_config/parameter_reference.md#MAN_DEADZONE)) hold x, y, z position steady against any disturbance like wind.
- Outside center: - Outside center:
- Roll/Pitch sticks control horizontal acceleration over ground in the vehicle's left-right and forward-back directions (respectively). - Roll/Pitch sticks control horizontal acceleration over ground in the vehicle's left-right and forward-back directions (respectively).
- Throttle stick controls speed of ascent-descent. - Throttle stick controls speed of ascent-descent.
@@ -51,10 +51,10 @@ Centered sticks level vehicle and hold it to fixed altitude and position against
- Takeoff: - Takeoff:
- When landed, the vehicle will take off if the throttle stick is raised above 62.5% percent (of the full range from bottom). - When landed, the vehicle will take off if the throttle stick is raised above 62.5% percent (of the full range from bottom).
- Global position estimate is required. - Global position estimate is required.
- Manual control input is required (such as RC control, joystick). - Manual control input is required (such as RC control, joystick).
- Roll, Pitch, Throttle: Assistance from autopilot to hold position against wind. - Roll, Pitch, Throttle: Assistance from autopilot to hold position against wind.
- Yaw: Assistance from autopilot to stabilize the attitude rate. - Yaw: Assistance from autopilot to stabilize the attitude rate.
Position of RC stick maps to the rate of rotation of vehicle in that orientation. Position of RC stick maps to the rate of rotation of vehicle in that orientation.
### Parameters ### Parameters
@@ -62,7 +62,7 @@ All the parameters in the [Multicopter Position Control](../advanced_config/para
| Parameter | Description | | Parameter | Description |
| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <a id="MPC_HOLD_DZ"></a>[MPC_HOLD_DZ](../advanced_config/parameter_reference.md#MPC_HOLD_DZ) | Deadzone of sticks where position hold is enabled. Default: 0.1 (10% of full stick range). | | <a id="MAN_DEADZONE"></a>[MAN_DEADZONE](../advanced_config/parameter_reference.md#MAN_DEADZONE) | Deadzone of sticks where position hold is enabled. Default: 0.1 (10% of full stick range). |
| <a id="MPC_Z_VEL_MAX_UP"></a>[MPC_Z_VEL_MAX_UP](../advanced_config/parameter_reference.md#MPC_Z_VEL_MAX_UP) | Maximum vertical ascent velocity. Default: 3 m/s. | | <a id="MPC_Z_VEL_MAX_UP"></a>[MPC_Z_VEL_MAX_UP](../advanced_config/parameter_reference.md#MPC_Z_VEL_MAX_UP) | Maximum vertical ascent velocity. Default: 3 m/s. |
| <a id="MPC_Z_VEL_MAX_DN"></a>[MPC_Z_VEL_MAX_DN](../advanced_config/parameter_reference.md#MPC_Z_VEL_MAX_DN) | Maximum vertical descent velocity. Default: 1 m/s. | | <a id="MPC_Z_VEL_MAX_DN"></a>[MPC_Z_VEL_MAX_DN](../advanced_config/parameter_reference.md#MPC_Z_VEL_MAX_DN) | Maximum vertical descent velocity. Default: 1 m/s. |
| <a id="MPC_LAND_ALT1"></a>[MPC_LAND_ALT1](../advanced_config/parameter_reference.md#MPC_LAND_ALT1) | Altitude for triggering first phase of slow landing. Below this altitude descending velocity gets limited to a value between [MPC_Z_VEL_MAX_DN](#MPC_Z_VEL_MAX_DN) (or `MPC_Z_V_AUTO_DN`) and [MPC_LAND_SPEED](#MPC_LAND_SPEED). Value needs to be higher than [MPC_LAND_ALT2](#MPC_LAND_ALT2). Default 10m. | | <a id="MPC_LAND_ALT1"></a>[MPC_LAND_ALT1](../advanced_config/parameter_reference.md#MPC_LAND_ALT1) | Altitude for triggering first phase of slow landing. Below this altitude descending velocity gets limited to a value between [MPC_Z_VEL_MAX_DN](#MPC_Z_VEL_MAX_DN) (or `MPC_Z_V_AUTO_DN`) and [MPC_LAND_SPEED](#MPC_LAND_SPEED). Value needs to be higher than [MPC_LAND_ALT2](#MPC_LAND_ALT2). Default 10m. |
+4 -4
View File
@@ -57,10 +57,10 @@ bool Sticks::checkAndUpdateStickInputs()
_positions(3) = manual_control_setpoint.yaw; _positions(3) = manual_control_setpoint.yaw;
// Exponential scale // Exponential scale
_positions_expo(0) = math::expo_deadzone(_positions(0), _param_mpc_xy_man_expo.get(), _param_mpc_hold_dz.get()); _positions_expo(0) = math::expo_deadzone(_positions(0), _param_mpc_xy_man_expo.get(), _param_man_deadzone.get());
_positions_expo(1) = math::expo_deadzone(_positions(1), _param_mpc_xy_man_expo.get(), _param_mpc_hold_dz.get()); _positions_expo(1) = math::expo_deadzone(_positions(1), _param_mpc_xy_man_expo.get(), _param_man_deadzone.get());
_positions_expo(2) = math::expo_deadzone(_positions(2), _param_mpc_z_man_expo.get(), _param_mpc_hold_dz.get()); _positions_expo(2) = math::expo_deadzone(_positions(2), _param_mpc_z_man_expo.get(), _param_man_deadzone.get());
_positions_expo(3) = math::expo_deadzone(_positions(3), _param_mpc_yaw_expo.get(), _param_mpc_hold_dz.get()); _positions_expo(3) = math::expo_deadzone(_positions(3), _param_mpc_yaw_expo.get(), _param_man_deadzone.get());
_aux_positions(0) = manual_control_setpoint.aux1; _aux_positions(0) = manual_control_setpoint.aux1;
_aux_positions(1) = manual_control_setpoint.aux2; _aux_positions(1) = manual_control_setpoint.aux2;
+1 -1
View File
@@ -101,7 +101,7 @@ private:
uORB::Subscription _failsafe_flags_sub{ORB_ID(failsafe_flags)}; uORB::Subscription _failsafe_flags_sub{ORB_ID(failsafe_flags)};
DEFINE_PARAMETERS( DEFINE_PARAMETERS(
(ParamFloat<px4::params::MPC_HOLD_DZ>) _param_mpc_hold_dz, (ParamFloat<px4::params::MAN_DEADZONE>) _param_man_deadzone,
(ParamFloat<px4::params::MPC_XY_MAN_EXPO>) _param_mpc_xy_man_expo, (ParamFloat<px4::params::MPC_XY_MAN_EXPO>) _param_mpc_xy_man_expo,
(ParamFloat<px4::params::MPC_Z_MAN_EXPO>) _param_mpc_z_man_expo, (ParamFloat<px4::params::MPC_Z_MAN_EXPO>) _param_mpc_z_man_expo,
(ParamFloat<px4::params::MPC_YAW_EXPO>) _param_mpc_yaw_expo (ParamFloat<px4::params::MPC_YAW_EXPO>) _param_mpc_yaw_expo
@@ -58,3 +58,20 @@ PARAM_DEFINE_INT32(MAN_ARM_GESTURE, 1);
* @max 15 * @max 15
*/ */
PARAM_DEFINE_FLOAT(MAN_KILL_GEST_T, -1.f); PARAM_DEFINE_FLOAT(MAN_KILL_GEST_T, -1.f);
/**
* Deadzone for sticks (only specific use cases)
*
* Range around stick center ignored to prevent
* vehicle drift from stick hardware inaccuracy.
*
* Does not apply to any precise constant input like
* throttle and attitude or rate piloting.
*
* @min 0
* @max 1
* @decimal 2
* @increment 0.01
* @group Manual Control
*/
PARAM_DEFINE_FLOAT(MAN_DEADZONE, 0.1f);
@@ -161,7 +161,7 @@ private:
(ParamFloat<px4::params::MC_YAWRATE_MAX>) _param_mc_yawrate_max, (ParamFloat<px4::params::MC_YAWRATE_MAX>) _param_mc_yawrate_max,
/* Stabilized mode params */ /* Stabilized mode params */
(ParamFloat<px4::params::MPC_HOLD_DZ>) _param_mpc_hold_dz, (ParamFloat<px4::params::MAN_DEADZONE>) _param_man_deadzone,
(ParamFloat<px4::params::MPC_MAN_TILT_MAX>) _param_mpc_man_tilt_max, (ParamFloat<px4::params::MPC_MAN_TILT_MAX>) _param_mpc_man_tilt_max,
(ParamFloat<px4::params::MPC_MANTHR_MIN>) _param_mpc_manthr_min, (ParamFloat<px4::params::MPC_MANTHR_MIN>) _param_mpc_manthr_min,
(ParamFloat<px4::params::MPC_THR_MAX>) _param_mpc_thr_max, (ParamFloat<px4::params::MPC_THR_MAX>) _param_mpc_thr_max,
@@ -147,7 +147,7 @@ MulticopterAttitudeControl::generate_attitude_setpoint(const Quatf &q, float dt)
const float yaw = Eulerf(q).psi(); const float yaw = Eulerf(q).psi();
const float yaw_stick_input = math::expo_deadzone(_manual_control_setpoint.yaw, _param_mpc_yaw_expo.get(), const float yaw_stick_input = math::expo_deadzone(_manual_control_setpoint.yaw, _param_mpc_yaw_expo.get(),
_param_mpc_hold_dz.get()); _param_man_deadzone.get());
_stick_yaw.generateYawSetpoint(attitude_setpoint.yaw_sp_move_rate, _yaw_setpoint_stabilized, yaw_stick_input, yaw, dt, _stick_yaw.generateYawSetpoint(attitude_setpoint.yaw_sp_move_rate, _yaw_setpoint_stabilized, yaw_stick_input, yaw, dt,
_unaided_heading); _unaided_heading);
@@ -130,19 +130,6 @@ PARAM_DEFINE_FLOAT(MPC_ACC_HOR_MAX, 5.f);
*/ */
PARAM_DEFINE_FLOAT(MPC_JERK_MAX, 8.f); PARAM_DEFINE_FLOAT(MPC_JERK_MAX, 8.f);
/**
* Deadzone for sticks in manual piloted modes
*
* Does not apply to manual throttle and direct attitude piloting by stick.
*
* @min 0
* @max 1
* @decimal 2
* @increment 0.01
* @group Multicopter Position Control
*/
PARAM_DEFINE_FLOAT(MPC_HOLD_DZ, 0.1f);
/** /**
* Manual position control stick exponential curve sensitivity * Manual position control stick exponential curve sensitivity
* *