Fixed some mathematical issues

Dependents:   GPSNavigationNew

Fork of PID by Aaron Berk

Files at this revision

API Documentation at this revision

Comitter:
Spilly
Date:
Wed Apr 29 18:07:24 2015 +0000
Parent:
4:b7326da8243b
Commit message:
Updated commits

Changed in this revision

PID.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/PID.cpp	Mon Apr 27 16:48:55 2015 +0000
+++ b/PID.cpp	Wed Apr 29 18:07:24 2015 +0000
@@ -152,6 +152,7 @@
     //Perform the PID calculation.
     controllerOutput_ = Kc_ * (error + (tauR_ * accError_) - (tauD_ * dMeas));
     
+    //scale PID output based on user provided input and output restraints
     controllerOutput_ = ((outMax_ - outMin_) * ((Kc_ * controllerOutput_) - inMin_)) / (inMax_ - inMin_) + outMin_;
     
     //Make sure the computed output is within output constraints.