MPC: add updateHoverThrust function

This function updates the vertical velocity integrator with the change
in hover thrust to avoid propagating discontinuities through the
controller when changing the hover thrust.
This is also important when using the hover thrust estimator as its
estimate has unconstrained dynamics and can cause drops or kicks when
the estimate updates faster than the velocity integrator.
This commit is contained in:
bresch
2020-03-15 16:15:22 +01:00
committed by Daniel Agar
parent 1bf791ba3f
commit 6ccf55b6fd
4 changed files with 52 additions and 5 deletions
@@ -63,6 +63,12 @@ void PositionControl::setThrustLimits(const float min, const float max)
_lim_thr_max = max;
}
void PositionControl::updateHoverThrust(const float hover_thrust_new)
{
_vel_int(2) += hover_thrust_new - _hover_thrust;
setHoverThrust(hover_thrust_new);
}
void PositionControl::setState(const PositionControlStates &states)
{
_pos = states.position;