ROS_FINGER

Fork of PID by LDSC_Robotics_TAs

Committer:
weisnail
Date:
Thu Feb 18 04:25:52 2016 +0000
Revision:
0:7f9b4ca968ae
Child:
1:4df4895863cd
add PID library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
weisnail 0:7f9b4ca968ae 1 #ifndef PID_H
weisnail 0:7f9b4ca968ae 2 #define PID_H
weisnail 0:7f9b4ca968ae 3
weisnail 0:7f9b4ca968ae 4 #include "mbed.h"
weisnail 0:7f9b4ca968ae 5
weisnail 0:7f9b4ca968ae 6 class PID{
weisnail 0:7f9b4ca968ae 7 public:
weisnail 0:7f9b4ca968ae 8
weisnail 0:7f9b4ca968ae 9 PID(float setKp, float setKi, float setKd, float setSampletime);
weisnail 0:7f9b4ca968ae 10 void SetOutputLimits(float setoutputLimits_H, float setoutputLimits_L);
weisnail 0:7f9b4ca968ae 11 void SetInputLimits(float setinputLimits_H, float setinputLimits_L);
weisnail 0:7f9b4ca968ae 12 void Compute(float setreference, float setfeedbackvalue);
weisnail 0:7f9b4ca968ae 13
weisnail 0:7f9b4ca968ae 14 float Kp;
weisnail 0:7f9b4ca968ae 15 float Ki;
weisnail 0:7f9b4ca968ae 16 float Kd;
weisnail 0:7f9b4ca968ae 17
weisnail 0:7f9b4ca968ae 18 float error[3];
weisnail 0:7f9b4ca968ae 19 float output;
weisnail 0:7f9b4ca968ae 20 float reference;
weisnail 0:7f9b4ca968ae 21
weisnail 0:7f9b4ca968ae 22
weisnail 0:7f9b4ca968ae 23
weisnail 0:7f9b4ca968ae 24
weisnail 0:7f9b4ca968ae 25 float sampletime;
weisnail 0:7f9b4ca968ae 26
weisnail 0:7f9b4ca968ae 27
weisnail 0:7f9b4ca968ae 28
weisnail 0:7f9b4ca968ae 29 private:
weisnail 0:7f9b4ca968ae 30
weisnail 0:7f9b4ca968ae 31 bool Outputlimit_bool;
weisnail 0:7f9b4ca968ae 32 bool Inputlimit_bool;
weisnail 0:7f9b4ca968ae 33
weisnail 0:7f9b4ca968ae 34 float outputLimits_H;
weisnail 0:7f9b4ca968ae 35 float outputLimits_L;
weisnail 0:7f9b4ca968ae 36 float inputLimits_H;
weisnail 0:7f9b4ca968ae 37 float inputLimits_L;
weisnail 0:7f9b4ca968ae 38
weisnail 0:7f9b4ca968ae 39 float feedbackvalue;
weisnail 0:7f9b4ca968ae 40 // Ticker PID_timer;
weisnail 0:7f9b4ca968ae 41
weisnail 0:7f9b4ca968ae 42 };
weisnail 0:7f9b4ca968ae 43
weisnail 0:7f9b4ca968ae 44 #endif /* PID_H*/