James Kiwic
/
RT2_P3_students
Fertig
Fork of RT2_P3_students by
DiffCounter.h@1:a30512c3ac73, 2018-04-09 (annotated)
- Committer:
- altb
- Date:
- Mon Apr 09 05:50:04 2018 +0000
- Revision:
- 1:a30512c3ac73
- Parent:
- 0:78ca29b4c49e
- Child:
- 3:769ce5f06d3e
added compiler commands
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
altb | 1:a30512c3ac73 | 1 | |
altb | 1:a30512c3ac73 | 2 | #ifndef DIFFCOUNTER_H_ |
altb | 1:a30512c3ac73 | 3 | #define DIFFCOUNTER_H_ |
altb | 1:a30512c3ac73 | 4 | |
altb | 0:78ca29b4c49e | 5 | /* DiffCounter Class, differentiate encoder counts for cuboid based on LP filter |
altb | 0:78ca29b4c49e | 6 | and unwrapping |
altb | 0:78ca29b4c49e | 7 | |
altb | 0:78ca29b4c49e | 8 | 1/tau*(z-1) |
altb | 0:78ca29b4c49e | 9 | G(z) = ------------ |
altb | 0:78ca29b4c49e | 10 | z - a0 |
altb | 0:78ca29b4c49e | 11 | */ |
altb | 0:78ca29b4c49e | 12 | |
altb | 0:78ca29b4c49e | 13 | class DiffCounter{ |
altb | 0:78ca29b4c49e | 14 | public: |
altb | 0:78ca29b4c49e | 15 | DiffCounter(float a,float b); |
altb | 0:78ca29b4c49e | 16 | float operator()(short inc){ |
altb | 0:78ca29b4c49e | 17 | return doStep(inc); |
altb | 0:78ca29b4c49e | 18 | } |
altb | 0:78ca29b4c49e | 19 | virtual ~DiffCounter(); |
altb | 0:78ca29b4c49e | 20 | void reset(float,short); |
altb | 0:78ca29b4c49e | 21 | float doStep(short inc); |
altb | 0:78ca29b4c49e | 22 | float Ts; |
altb | 0:78ca29b4c49e | 23 | |
altb | 0:78ca29b4c49e | 24 | private: |
altb | 0:78ca29b4c49e | 25 | |
altb | 0:78ca29b4c49e | 26 | float alpha; |
altb | 0:78ca29b4c49e | 27 | float a0; |
altb | 0:78ca29b4c49e | 28 | short inc_old; |
altb | 0:78ca29b4c49e | 29 | float v_old; |
altb | 0:78ca29b4c49e | 30 | long del; |
altb | 0:78ca29b4c49e | 31 | float inc2rad; |
altb | 1:a30512c3ac73 | 32 | }; |
altb | 1:a30512c3ac73 | 33 | |
altb | 1:a30512c3ac73 | 34 | #endif // DIFFCOUNTER_H_ |