Enforce enough braking power when users set higher horizontal speeds

This commit is contained in:
Lorenz Meier
2016-07-31 17:43:15 +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;