GRT_FS2019_VoiceCoil / Mbed 2 deprecated GRT_VC_PIDT1

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PID_Cntrl.h Source File

PID_Cntrl.h

00001 #ifndef PID_CNTRL_H_
00002 #define PID_CNTRL_H_
00003 
00004 // PID Controller Class
00005 class PID_Cntrl
00006 {
00007 public:
00008 
00009     PID_Cntrl(float Kp, float Ki, float Kd, float Tf, float Ts, float Min, float Max);
00010 
00011     float operator()(float error) {
00012         return update((double)error);
00013     }
00014 
00015     virtual     ~PID_Cntrl();
00016 
00017     void        reset(float initValue);
00018     float       update(double error);
00019     
00020 private:
00021 
00022     // controller parameters (member variables)
00023     float Kp, Ki, Kd, Tf, Ts, Min, Max;
00024     // storage for signals (member variables)
00025     float yI, yD, e_old;
00026 };
00027 
00028 #endif
00029