sfbsg
Dependencies: mbed
DiffCounter.h@0:8ab621116ccd, 2018-04-03 (annotated)
- Committer:
- borlanic
- Date:
- Tue Apr 03 15:17:11 2018 +0000
- Revision:
- 0:8ab621116ccd
fg
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
borlanic | 0:8ab621116ccd | 1 | /* DiffCounter Class, differentiate encoder counts for cuboid based on LP filter |
borlanic | 0:8ab621116ccd | 2 | and unwrapping |
borlanic | 0:8ab621116ccd | 3 | |
borlanic | 0:8ab621116ccd | 4 | 1/tau*(z-1) |
borlanic | 0:8ab621116ccd | 5 | G(z) = ------------ |
borlanic | 0:8ab621116ccd | 6 | z - a0 |
borlanic | 0:8ab621116ccd | 7 | */ |
borlanic | 0:8ab621116ccd | 8 | |
borlanic | 0:8ab621116ccd | 9 | class DiffCounter{ |
borlanic | 0:8ab621116ccd | 10 | public: |
borlanic | 0:8ab621116ccd | 11 | DiffCounter(float a,float b); |
borlanic | 0:8ab621116ccd | 12 | float operator()(short inc){ |
borlanic | 0:8ab621116ccd | 13 | return doStep(inc); |
borlanic | 0:8ab621116ccd | 14 | } |
borlanic | 0:8ab621116ccd | 15 | virtual ~DiffCounter(); |
borlanic | 0:8ab621116ccd | 16 | void reset(float,short); |
borlanic | 0:8ab621116ccd | 17 | float doStep(short inc); |
borlanic | 0:8ab621116ccd | 18 | float Ts; |
borlanic | 0:8ab621116ccd | 19 | |
borlanic | 0:8ab621116ccd | 20 | private: |
borlanic | 0:8ab621116ccd | 21 | |
borlanic | 0:8ab621116ccd | 22 | float alpha; |
borlanic | 0:8ab621116ccd | 23 | float a0; |
borlanic | 0:8ab621116ccd | 24 | short inc_old; |
borlanic | 0:8ab621116ccd | 25 | float v_old; |
borlanic | 0:8ab621116ccd | 26 | long del; |
borlanic | 0:8ab621116ccd | 27 | float inc2rad; |
borlanic | 0:8ab621116ccd | 28 | }; |