Mercurial > hg > beaglert
diff include/Pid.h @ 149:134bff10e561 ClockSync
Added simple one-variable one-measurement Kalman filter, Pid controller(which output is not used). Virtual clock is now much more precise and reactive for period. Still it is lagging behind a bit on the overall offset.
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 21 Sep 2015 03:12:21 +0100 |
parents | |
children | 8f98b32d0e23 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/Pid.h Mon Sep 21 03:12:21 2015 +0100 @@ -0,0 +1,36 @@ +/* + * Pid.h + * + * Created on: 14 Sep 2015 + * Author: giulio + */ + +#ifndef PID_H_ +#define PID_H_ +#include <stdio.h> + +class Pid{ +private: + float integralError; + float pastError; + float error; + float differentialError; + float output; + float kp; + float ki; + float kd; + float ts; + int idleTimeout; + int timeoutCount; + void updateIntegralError(); + void updateDifferentialError(); +public: + Pid(); + float setError(float anError); + void setIdleTimeout(int aIdleTimeout); + float getOutput(); +}; + + + +#endif /* PID_H_ */