Add jerk parameter for auto mode MPC_JERK_AUTO. Specify when a parameter is only used in a certain manual or auto mode

This commit is contained in:
bresch 2019-05-14 08:49:39 +02:00 committed by Matthias Grob
parent 011aef5464
commit b726d8df0d
3 changed files with 33 additions and 8 deletions

View File

@ -201,9 +201,9 @@ void FlightTaskAutoLineSmoothVel::_updateTrajConstraints()
_trajectory[1].setMaxAccel(_param_mpc_acc_hor_max.get());
_trajectory[0].setMaxVel(_param_mpc_xy_vel_max.get());
_trajectory[1].setMaxVel(_param_mpc_xy_vel_max.get());
_trajectory[0].setMaxJerk(_param_mpc_jerk_min.get()); // TODO : Should be computed using heading
_trajectory[1].setMaxJerk(_param_mpc_jerk_min.get());
_trajectory[2].setMaxJerk(_param_mpc_jerk_min.get());
_trajectory[0].setMaxJerk(_param_mpc_jerk_auto.get()); // TODO : Should be computed using heading
_trajectory[1].setMaxJerk(_param_mpc_jerk_auto.get());
_trajectory[2].setMaxJerk(_param_mpc_jerk_auto.get());
if (_velocity_setpoint(2) < 0.f) { // up
_trajectory[2].setMaxAccel(_param_mpc_acc_up_max.get());

View File

@ -60,7 +60,7 @@ protected:
(ParamFloat<px4::params::MPC_ACC_UP_MAX>) _param_mpc_acc_up_max,
(ParamFloat<px4::params::MPC_ACC_DOWN_MAX>) _param_mpc_acc_down_max,
(ParamFloat<px4::params::MPC_ACC_HOR_MAX>) _param_mpc_acc_hor_max,
(ParamFloat<px4::params::MPC_JERK_MIN>) _param_mpc_jerk_min,
(ParamFloat<px4::params::MPC_JERK_AUTO>) _param_mpc_jerk_auto,
(ParamFloat<px4::params::MPC_XY_TRAJ_P>) _param_mpc_xy_traj_p,
(ParamFloat<px4::params::MPC_Z_TRAJ_P>) _param_mpc_z_traj_p
);

View File

@ -87,7 +87,7 @@ PARAM_DEFINE_FLOAT(MPC_THR_HOVER, 0.5f);
* (e.g. if hover thrust is set to 20%, 80% of the upper thrust range is squeezed into the
* upper half of the stick range).
*
* Note: in case MPC_THR_HOVER is set to 50%, the modes 0 and 1 are the same.
* Note: In case MPC_THR_HOVER is set to 50%, the modes 0 and 1 are the same.
*
* @value 0 Rescale to hover thrust
* @value 1 No Rescale
@ -427,7 +427,10 @@ PARAM_DEFINE_FLOAT(MPC_HOLD_MAX_Z, 0.6f);
PARAM_DEFINE_FLOAT(MPC_VELD_LP, 5.0f);
/**
* Maximum horizontal acceleration for auto mode and maximum deceleration for manual mode
* Maximum horizontal acceleration for auto mode and for manual mode
*
* Manual mode: Maximum deceleration for MPC_POS_MODE 1 and 2. Maximum acceleration and deceleration for MPC_POS_MODE 3.
* Auto mode: Used with MPC_AUTO_MODE 0 only. For MPC_AUTO_MODE 1, MPC_ACC_HOR is always used.
*
* @unit m/s/s
* @min 2.0
@ -441,6 +444,8 @@ PARAM_DEFINE_FLOAT(MPC_ACC_HOR_MAX, 10.0f);
/**
* Acceleration for auto and for manual
*
* Note: In manual, this parameter is only used in MPC_POS_MODE 1 and 2
*
* @unit m/s/s
* @min 2.0
* @max 15.0
@ -454,6 +459,8 @@ PARAM_DEFINE_FLOAT(MPC_ACC_HOR, 5.0f);
/**
* Slow horizontal manual deceleration for manual mode
*
* Note: This is only used when MPC_POS_MODE is set to 1 or 2.
*
* @unit m/s/s
* @min 0.5
* @max 10.0
@ -511,7 +518,7 @@ PARAM_DEFINE_FLOAT(MPC_ACC_DOWN_MAX, 10.0f);
*
* 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.
* Note: This is only used when MPC_POS_MODE is set to a smoothing mode.
*
* @unit m/s/s/s
* @min 0.5
@ -534,7 +541,7 @@ PARAM_DEFINE_FLOAT(MPC_JERK_MAX, 20.0f);
*
* 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.
* Note: This is only used when MPC_POS_MODE is set to 1 or 2.
*
* @unit m/s/s/s
* @min 0
@ -545,6 +552,24 @@ PARAM_DEFINE_FLOAT(MPC_JERK_MAX, 20.0f);
*/
PARAM_DEFINE_FLOAT(MPC_JERK_MIN, 8.0f);
/**
* Jerk limit in auto mode
*
* 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.
*
* Note: This is only used in jerk-limited trajectory mode (MPC_AUTO_MODE 1)
*
* @unit m/s/s/s
* @min 5.0
* @max 80.0
* @increment 1
* @decimal 1
* @group Multicopter Position Control
*/
PARAM_DEFINE_FLOAT(MPC_JERK_AUTO, 8.0f);
/**
* Altitude control mode.
*