Browse Source

mc_pos_control_params: update jerk params (limits + defaults + description)

sbg
Beat Küng 6 years ago committed by Roman Bapst
parent
commit
d8cb6bb834
  1. 2
      src/lib/FlightTasks/tasks/Utility/ManualSmoothingXY.cpp
  2. 40
      src/modules/mc_pos_control/mc_pos_control_params.c

2
src/lib/FlightTasks/tasks/Utility/ManualSmoothingXY.cpp

@ -140,7 +140,7 @@ ManualSmoothingXY::_setStateAcceleration(const Vector2f &vel_sp, const Vector2f @@ -140,7 +140,7 @@ ManualSmoothingXY::_setStateAcceleration(const Vector2f &vel_sp, const Vector2f
// very slow at low speed.
_jerk_state_dependent = 1e6f; // default
if (_jerk_max.get() > _jerk_min.get()) {
if (_jerk_max.get() > _jerk_min.get() && _jerk_min.get() > FLT_EPSILON) {
_jerk_state_dependent = math::min((_jerk_max.get() - _jerk_min.get())
/ _vel_max * vel.length() + _jerk_min.get(), _jerk_max.get());

40
src/modules/mc_pos_control/mc_pos_control_params.c

@ -483,33 +483,47 @@ PARAM_DEFINE_FLOAT(MPC_ACC_UP_MAX, 10.0f); @@ -483,33 +483,47 @@ PARAM_DEFINE_FLOAT(MPC_ACC_UP_MAX, 10.0f);
PARAM_DEFINE_FLOAT(MPC_ACC_DOWN_MAX, 10.0f);
/**
* Maximum jerk in manual controlled mode for BRAKING to zero.
* If this value is below MPC_JERK_MIN, the acceleration limit in xy and z
* is MPC_ACC_HOR_MAX and MPC_ACC_UP_MAX respectively instantaneously when the
* user demands brake (=zero stick input).
* Otherwise the acceleration limit increases from current acceleration limit
* towards MPC_ACC_HOR_MAX/MPC_ACC_UP_MAX with jerk limit
* Maximum jerk limit
*
* Limit the maximum jerk of the vehicle (how fast the acceleration can change).
* A lower value leads to smoother vehicle motions, but it also limits its
* agility (how fast it can change directions or break).
*
* Setting this to the maximum value essentially disables the limit.
*
* Note: this is only used when MPC_POS_MODE is set to a smoothing mode.
*
* @unit m/s/s/s
* @min 0.0
* @max 15.0
* @min 0.5
* @max 500.0
* @increment 1
* @decimal 2
* @group Multicopter Position Control
*/
PARAM_DEFINE_FLOAT(MPC_JERK_MAX, 0.0f);
PARAM_DEFINE_FLOAT(MPC_JERK_MAX, 20.0f);
/**
* Minimum jerk in manual controlled mode for BRAKING to zero
* Velocity-based jerk limit
*
* If this is not zero, a velocity-based maximum jerk limit is used: the applied
* jerk limit linearly increases with the vehicle's velocity between
* MPC_JERK_MIN (zero velocity) and MPC_JERK_MAX (maximum velocity).
*
* This means that the vehicle's motions are smooth for low velocities, but
* still allows fast direction changes or breaking at higher velocities.
*
* Set this to zero to use a fixed maximum jerk limit (MPC_JERK_MAX).
*
* Note: this is only used when MPC_POS_MODE is set to a smoothing mode.
*
* @unit m/s/s/s
* @min 0.5
* @max 10.0
* @min 0
* @max 30.0
* @increment 1
* @decimal 2
* @group Multicopter Position Control
*/
PARAM_DEFINE_FLOAT(MPC_JERK_MIN, 1.0f);
PARAM_DEFINE_FLOAT(MPC_JERK_MIN, 8.0f);
/**
* Altitude control mode.

Loading…
Cancel
Save