Compare commits

...

2 Commits

Author SHA1 Message Date
Matthias Grob fef8c5e42e StickAccelerationXY: make brake filter configurable 2021-05-04 11:08:48 +02:00
Matthias Grob b98c7e63c7 StickAccelerationXY: make brake boost factor configurable 2021-05-04 10:53:30 +02:00
3 changed files with 31 additions and 3 deletions
@@ -126,10 +126,10 @@ void StickAccelerationXY::applyJerkLimit(const float dt)
Vector2f StickAccelerationXY::calculateDrag(Vector2f drag_coefficient, const float dt, const Vector2f &stick_xy,
const Vector2f &vel_sp)
{
_brake_boost_filter.setParameters(dt, .8f);
_brake_boost_filter.setParameters(dt, _param_mpc_brake_filter.get());
if (stick_xy.norm_squared() < FLT_EPSILON) {
_brake_boost_filter.update(math::max(2.f, sqrtf(_param_mpc_vel_manual.get())));
_brake_boost_filter.update(_param_mpc_brake_factor.get());
} else {
_brake_boost_filter.update(1.f);
@@ -81,6 +81,9 @@ private:
DEFINE_PARAMETERS(
(ParamFloat<px4::params::MPC_VEL_MANUAL>) _param_mpc_vel_manual,
(ParamFloat<px4::params::MPC_ACC_HOR>) _param_mpc_acc_hor,
(ParamFloat<px4::params::MPC_ACC_HOR_MAX>) _param_mpc_acc_hor_max,
(ParamFloat<px4::params::MPC_BRAKE_FACTOR>) _param_mpc_brake_factor,
(ParamFloat<px4::params::MPC_BRAKE_FILTER>) _param_mpc_brake_filter,
(ParamFloat<px4::params::MPC_JERK_MAX>) _param_mpc_jerk_max,
(ParamFloat<px4::params::MPC_TILTMAX_AIR>) _param_mpc_tiltmax_air
)
@@ -508,9 +508,34 @@ PARAM_DEFINE_FLOAT(MPC_ACC_HOR_MAX, 5.0f);
* @decimal 2
* @group Multicopter Position Control
*/
PARAM_DEFINE_FLOAT(MPC_ACC_HOR, 3.0f);
/**
* Factor for faster braking than accelerating in position mode
*
* Note: In manual, this parameter is only used in MPC_POS_MODE 1.
*
* @unit m/s^2
* @min 2.0
* @max 15.0
* @increment 1
* @decimal 2
* @group Multicopter Position Control
*/
PARAM_DEFINE_FLOAT(MPC_BRAKE_FACTOR, 2.0f);
/**
* Brake boost filter time constant
*
* @unit m/s^2
* @min 2.0
* @max 15.0
* @increment 1
* @decimal 2
* @group Multicopter Position Control
*/
PARAM_DEFINE_FLOAT(MPC_BRAKE_FILTER, 0.8f);
/**
* Maximum vertical acceleration in velocity controlled modes upward
*