Enforce enough braking power when users set higher horizontal speeds

This commit is contained in:
Lorenz Meier
2016-07-31 17:42:53 +02:00
parent dd70b3752a
commit a38263b8e7
2 changed files with 6 additions and 1 deletions
@@ -585,6 +585,11 @@ MulticopterPositionControl::parameters_update(bool force)
_params.hold_max_z = (v < 0.0f ? 0.0f : v);
param_get(_params_handles.acc_hor_max, &v);
_params.acc_hor_max = v;
/*
* increase the maximum horizontal acceleration such that stopping
* within 1 s from full speed is feasible
*/
_params.acc_hor_max = math::max(_params.vel_cruise(0), _params.acc_hor_max);
param_get(_params_handles.alt_mode, &v_i);
_params.alt_mode = v_i;
@@ -456,7 +456,7 @@ PARAM_DEFINE_FLOAT(MPC_VELD_LP, 5.0f);
* @decimal 2
* @group Multicopter Position Control
*/
PARAM_DEFINE_FLOAT(MPC_ACC_HOR_MAX, 10.0f);
PARAM_DEFINE_FLOAT(MPC_ACC_HOR_MAX, 5.0f);
/**
* Altitude control mode, note mode 1 only tested with LPE