for dror
Diff: PID.cpp
- Revision:
- 1:b738a8164729
- Parent:
- 0:6e12a3e5af19
--- a/PID.cpp Thu Sep 02 16:48:10 2010 +0000 +++ b/PID.cpp Wed Dec 25 09:00:32 2019 +0000 @@ -57,8 +57,8 @@ //Default the limits to the full range of I/O: 3.3V //Make sure to set these to more appropriate limits for //your application. - setInputLimits(0.0, 3.3); - setOutputLimits(0.0, 3.3); + setInputLimits(20, 90.0); + setOutputLimits(-1, 1); tSample_ = interval; @@ -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; }