Mercurial > hg > beaglert
annotate include/Pid.h @ 152:8f98b32d0e23 ClockSync
Last commit on this branch for a while. Overall not very succesful
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 05 Oct 2015 13:06:14 +0100 |
parents | 134bff10e561 |
children |
rev | line source |
---|---|
giuliomoro@149 | 1 /* |
giuliomoro@149 | 2 * Pid.h |
giuliomoro@149 | 3 * |
giuliomoro@149 | 4 * Created on: 14 Sep 2015 |
giuliomoro@149 | 5 * Author: giulio |
giuliomoro@149 | 6 */ |
giuliomoro@149 | 7 |
giuliomoro@149 | 8 #ifndef PID_H_ |
giuliomoro@149 | 9 #define PID_H_ |
giuliomoro@149 | 10 #include <stdio.h> |
giuliomoro@149 | 11 |
giuliomoro@149 | 12 class Pid{ |
giuliomoro@149 | 13 private: |
giuliomoro@149 | 14 float integralError; |
giuliomoro@149 | 15 float pastError; |
giuliomoro@149 | 16 float error; |
giuliomoro@149 | 17 float differentialError; |
giuliomoro@149 | 18 float output; |
giuliomoro@149 | 19 float kp; |
giuliomoro@149 | 20 float ki; |
giuliomoro@149 | 21 float kd; |
giuliomoro@152 | 22 float gain; |
giuliomoro@149 | 23 float ts; |
giuliomoro@149 | 24 int idleTimeout; |
giuliomoro@149 | 25 int timeoutCount; |
giuliomoro@149 | 26 void updateIntegralError(); |
giuliomoro@149 | 27 void updateDifferentialError(); |
giuliomoro@149 | 28 public: |
giuliomoro@149 | 29 Pid(); |
giuliomoro@149 | 30 float setError(float anError); |
giuliomoro@149 | 31 void setIdleTimeout(int aIdleTimeout); |
giuliomoro@149 | 32 float getOutput(); |
giuliomoro@152 | 33 void setProportionalGain(float proportionalGain); |
giuliomoro@152 | 34 void setDerivativeGain(float derivativeGain); |
giuliomoro@152 | 35 void setIntegralGain(float integralGain); |
giuliomoro@152 | 36 void setGlobalGain(float globalGain); |
giuliomoro@152 | 37 float getProportionalGain(); |
giuliomoro@152 | 38 float getDerivativeGain(); |
giuliomoro@152 | 39 float getIntegralGain(); |
giuliomoro@152 | 40 float getGlobalGain(); |
giuliomoro@152 | 41 float getIntegralError(); |
giuliomoro@149 | 42 }; |
giuliomoro@149 | 43 |
giuliomoro@149 | 44 |
giuliomoro@149 | 45 |
giuliomoro@149 | 46 #endif /* PID_H_ */ |