stock mbed AnalogReads current loop closed and working
Fork of priustroller_2 by
Diff: meta/filters.h
- Revision:
- 11:dccbaa9274c5
- Child:
- 50:16b43e8fe04f
diff -r b4abecccec7a -r dccbaa9274c5 meta/filters.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/meta/filters.h Sun Mar 08 08:37:38 2015 +0000 @@ -0,0 +1,27 @@ +#ifndef __FILTERS_H +#define __FILTERS_H + +class LtiFilter { +public: + virtual float Update(float x) {return x;} +}; + +class MeanFilter: public LtiFilter { +public: + MeanFilter(float strength); + virtual float Update(float x); +private: + float _mean; + float _strength; +}; + +class PidController { +public: + PidController(float ki, float kp, float kd, float out_max = 1.0f, float out_min = 0.0f); + float Update(float ref, float in); +private: + float _ki, _kp, _kd; + float _last_in, _integral; + float _out_max, _out_min; +}; +#endif \ No newline at end of file