Mercurial > hg > beaglert
comparison 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 |
comparison
equal
deleted
inserted
replaced
148:6cd38e261027 | 149:134bff10e561 |
---|---|
1 /* | |
2 * Pid.h | |
3 * | |
4 * Created on: 14 Sep 2015 | |
5 * Author: giulio | |
6 */ | |
7 | |
8 #ifndef PID_H_ | |
9 #define PID_H_ | |
10 #include <stdio.h> | |
11 | |
12 class Pid{ | |
13 private: | |
14 float integralError; | |
15 float pastError; | |
16 float error; | |
17 float differentialError; | |
18 float output; | |
19 float kp; | |
20 float ki; | |
21 float kd; | |
22 float ts; | |
23 int idleTimeout; | |
24 int timeoutCount; | |
25 void updateIntegralError(); | |
26 void updateDifferentialError(); | |
27 public: | |
28 Pid(); | |
29 float setError(float anError); | |
30 void setIdleTimeout(int aIdleTimeout); | |
31 float getOutput(); | |
32 }; | |
33 | |
34 | |
35 | |
36 #endif /* PID_H_ */ |