diff --git a/libraries/AC_PID/AC_PID.cpp b/libraries/AC_PID/AC_PID.cpp index bd628108c5..004507800b 100644 --- a/libraries/AC_PID/AC_PID.cpp +++ b/libraries/AC_PID/AC_PID.cpp @@ -123,7 +123,7 @@ void AC_PID::slew_limit(float smax) // target and error are filtered // the derivative is then calculated and filtered // the integral is then updated based on the setting of the limit flag -float AC_PID::update_all(float target, float measurement, float dt, bool limit) +float AC_PID::update_all(float target, float measurement, float dt, bool limit, float boost) { // don't process inf or NaN if (!isfinite(target) || !isfinite(measurement)) { @@ -161,6 +161,10 @@ float AC_PID::update_all(float target, float measurement, float dt, bool limit) P_out *= _pid_info.Dmod; D_out *= _pid_info.Dmod; + // boost output if required + P_out *= boost; + D_out *= boost; + _pid_info.target = _target; _pid_info.actual = measurement; _pid_info.error = _error; diff --git a/libraries/AC_PID/AC_PID.h b/libraries/AC_PID/AC_PID.h index 8e4f735c4c..1bf3a0163b 100644 --- a/libraries/AC_PID/AC_PID.h +++ b/libraries/AC_PID/AC_PID.h @@ -31,7 +31,7 @@ public: // target and error are filtered // the derivative is then calculated and filtered // the integral is then updated based on the setting of the limit flag - float update_all(float target, float measurement, float dt, bool limit = false); + float update_all(float target, float measurement, float dt, bool limit = false, float boost = 1.0f); // update_error - set error input to PID controller and calculate outputs // target is set to zero and error is set and filtered