2nd Library

Dependents:   cuboid_balance_ros cuboid_balance mirror_actuator_V1

PI_Cntrl.h

Committer:
altb2
Date:
2021-04-01
Revision:
3:e3b84ea63c0f
Parent:
0:a201a6cd4c0c

File content as of revision 3:e3b84ea63c0f:

class PI_Cntrl
{
public:

    PI_Cntrl(float Kp, float Tn, float Ts);
    PI_Cntrl(float Kp, float Tn, float Ts, float uMax);
    PI_Cntrl(float Kp, float Tn, float Ts, float uMax, float uMin);

    float operator()(float error) {
        return doStep((double)error);
    }

    virtual     ~PI_Cntrl();

    void        reset(float initValue);
    float       doStep(double error);

private:

    double b0;
    double b1;
    double b2;
    double s;
    double uMax;
    double uMin;
    
    void        setCoefficients(float Kp, float Tn, float Ts);

};