stock mbed AnalogReads current loop closed and working

Dependencies:   mbed

Fork of priustroller_2 by N K

meta/filters.h

Committer:
bwang
Date:
2016-01-31
Revision:
56:85a26f839af2
Parent:
50:16b43e8fe04f

File content as of revision 56:85a26f839af2:

#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);
    void ZeroIntegrator();
private:
    float _ki, _kp, _kd;
    float _last_in, _integral;
    float _out_max, _out_min;
}; 
#endif