![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Fertig
Fork of RT2_P3_students by
Diff: DiffCounter.h
- Revision:
- 3:769ce5f06d3e
- Parent:
- 1:a30512c3ac73
- Child:
- 7:72982ede2ff6
--- a/DiffCounter.h Mon Apr 09 05:50:04 2018 +0000 +++ b/DiffCounter.h Mon Apr 09 08:01:29 2018 +0000 @@ -1,34 +1,24 @@ - -#ifndef DIFFCOUNTER_H_ -#define DIFFCOUNTER_H_ - -/* DiffCounter Class, differentiate encoder counts for cuboid based on LP filter - and unwrapping - - 1/tau*(z-1) -G(z) = ------------ - z - a0 -*/ +class DiffCounter +{ +public: -class DiffCounter{ - public: - DiffCounter(float a,float b); - float operator()(short inc){ - return doStep(inc); - } - virtual ~DiffCounter(); - void reset(float,short); - float doStep(short inc); - float Ts; + DiffCounter(float T, float Ts); + + float operator()(short inc) { + return doStep(inc); + } + + virtual ~DiffCounter(); - private: - - float alpha; - float a0; - short inc_old; - float v_old; - long del; - float inc2rad; -}; + void reset(float initValue, short inc); + float doStep(short inc); + +private: -#endif // DIFFCOUNTER_H_ + double b; + double a; + short incPast; + double vel; + double inc2rad; + +}; \ No newline at end of file