Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of RT2_P3_students by
DiffCounter.h@0:78ca29b4c49e, 2018-04-03 (annotated)
- Committer:
- altb
- Date:
- Tue Apr 03 08:47:41 2018 +0000
- Revision:
- 0:78ca29b4c49e
- Child:
- 1:a30512c3ac73
Cuboid Lab RT2 FS 2018
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| altb | 0:78ca29b4c49e | 1 | /* DiffCounter Class, differentiate encoder counts for cuboid based on LP filter |
| altb | 0:78ca29b4c49e | 2 | and unwrapping |
| altb | 0:78ca29b4c49e | 3 | |
| altb | 0:78ca29b4c49e | 4 | 1/tau*(z-1) |
| altb | 0:78ca29b4c49e | 5 | G(z) = ------------ |
| altb | 0:78ca29b4c49e | 6 | z - a0 |
| altb | 0:78ca29b4c49e | 7 | */ |
| altb | 0:78ca29b4c49e | 8 | |
| altb | 0:78ca29b4c49e | 9 | class DiffCounter{ |
| altb | 0:78ca29b4c49e | 10 | public: |
| altb | 0:78ca29b4c49e | 11 | DiffCounter(float a,float b); |
| altb | 0:78ca29b4c49e | 12 | float operator()(short inc){ |
| altb | 0:78ca29b4c49e | 13 | return doStep(inc); |
| altb | 0:78ca29b4c49e | 14 | } |
| altb | 0:78ca29b4c49e | 15 | virtual ~DiffCounter(); |
| altb | 0:78ca29b4c49e | 16 | void reset(float,short); |
| altb | 0:78ca29b4c49e | 17 | float doStep(short inc); |
| altb | 0:78ca29b4c49e | 18 | float Ts; |
| altb | 0:78ca29b4c49e | 19 | |
| altb | 0:78ca29b4c49e | 20 | private: |
| altb | 0:78ca29b4c49e | 21 | |
| altb | 0:78ca29b4c49e | 22 | float alpha; |
| altb | 0:78ca29b4c49e | 23 | float a0; |
| altb | 0:78ca29b4c49e | 24 | short inc_old; |
| altb | 0:78ca29b4c49e | 25 | float v_old; |
| altb | 0:78ca29b4c49e | 26 | long del; |
| altb | 0:78ca29b4c49e | 27 | float inc2rad; |
| altb | 0:78ca29b4c49e | 28 | }; |
