from greg
Fork of PID by
Revision 10:3296a2150efe, committed 2014-05-25
- Comitter:
- oprospero
- Date:
- Sun May 25 22:53:48 2014 +0000
- Parent:
- 9:244f8204d1fa
- Child:
- 11:0854d9ff17f8
- Commit message:
- add parabolic curve
Changed in this revision
PID.cpp | Show annotated file Show diff for this revision Revisions of this file |
PID.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/PID.cpp Sat Feb 15 19:55:04 2014 +0000 +++ b/PID.cpp Sun May 25 22:53:48 2014 +0000 @@ -16,13 +16,11 @@ PID::PID(const float proportionalGain, const float integralGain, const float derivativeGain, - const float windupGainGuard, - const float timeDifferential ) : + const float windupGainGuard ) : proportionalGain(proportionalGain), integralGain(integralGain), derivativeGain(derivativeGain), - windupGainGuard(windupGainGuard), - dt(timeDifferential) + windupGainGuard(windupGainGuard) { // pc.baud(38400); integralError = 0.0f; @@ -31,7 +29,7 @@ proportionalControl = integralControl = derivativeControl = 0; } -float PID::correct(const float currentError) +float PID::correct(const float currentError,const int dt) { // float currentError = 0; // float proportionalControl, integralControl, derivativeControl;
--- a/PID.h Sat Feb 15 19:55:04 2014 +0000 +++ b/PID.h Sun May 25 22:53:48 2014 +0000 @@ -31,7 +31,7 @@ * such as momentum. * @param windupGainGuard Cap for the maximum error value. */ - PID(const float, const float, const float, const float, const float); + PID(const float, const float, const float, const float); /** * Determine how to correct the system to the desired position. @@ -43,7 +43,7 @@ * eg. PID can be switched off for manual control) * @return Adjustment to apply to the motors. */ - float correct(const float); + float correct(const float,const int); void updateP(const float); void updateD(const float); @@ -53,7 +53,6 @@ const float integralGain; float derivativeGain; const float windupGainGuard; - const float dt; float proportionalControl, integralControl, derivativeControl; float currentError;