Proportional, integral, derivative controller library. Ported from the Arduino PID library by Brett Beauregard.
Fork of PID by
Diff: PID.cpp
- Revision:
- 2:9ed1cad69d52
- Parent:
- 1:cc91f529df79
--- a/PID.cpp Sun Nov 30 18:40:15 2014 +0000 +++ b/PID.cpp Mon Dec 01 08:17:44 2014 +0000 @@ -259,8 +259,8 @@ controllerOutput_ = scaledBias + Kc_ * (error + (tauR_ * accError_) - (tauD_ * dMeas)); //Make sure the computed output is within output constraints. - if (controllerOutput_ < 0.0) { - controllerOutput_ = 0.0; + if (controllerOutput_ < -1.0) { + controllerOutput_ = -1.0; } else if (controllerOutput_ > 1.0) { controllerOutput_ = 1.0; }