baseline build

Dependencies:   FastPWM mbed-os mbed

PID.h

Committer:
jrhodes5150
Date:
2017-06-19
Revision:
1:909f2393bc01
Parent:
0:8a420ac6394e

File content as of revision 1:909f2393bc01:

#ifndef __PID_H__
#define __PID_H__

class PID
{
public:
    PID(void);
    
    void AddSample(double sampleValue,double control);
    double GetOutput(void) { return currentOutput; }
    double GetPidSampleValue(void) { return pidSampleValue; }
    void Reset(void);
    void SetOutputRange(double minOutput, double maxOutput);
    void SetPeriodMilliseconds(double period) { msPeriod = period; }
    void SetPID(double kp, double ki, double kd);
    void SetTarget(double target) { this->target = target; }
    double GetTarget(void){return target;}
private:
    double minOutput, maxOutput;
    double kp, ki, kd;
    double errorIntegral;
    double lastError;
    double msPeriod;
    double target;
    double currentOutput;
    double pidSampleValue;
};


#endif