first
Dependencies: BEAR_Reciever Motor eeprom iSerial mbed
Fork of BEAR_Motion by
pidcontrol.h
00001 #ifndef _PIDCONTROL_H_ 00002 #define _PIDCONTROL_H_ 00003 00004 #include "mbed.h" 00005 00006 class PID{ 00007 public: 00008 PID(); 00009 PID(float p,float i,float d); 00010 void setGoal(float ref); 00011 //float getGoal(); 00012 void setCurrent(float sensor); 00013 float compute(); 00014 00015 void setMargin(float gap); 00016 float getMargin(); 00017 void setIntegalLimit(float limit); 00018 float getIntegalLimit(); 00019 00020 float getErrorNow(); 00021 float getErrorLast(); 00022 float getErrorDiff(); 00023 float getErrorIntegal(); 00024 00025 void setKp(float); 00026 void setKi(float); 00027 void setKd(float); 00028 00029 float getKp(); 00030 float getKi(); 00031 float getKd(); 00032 00033 private: 00034 float e_n; //error now 00035 float e_n_1; //error last time 00036 float e_i; //error integal 00037 float il; //integal limit 00038 float margin; //output margin 00039 00040 float Kp,Ki,Kd; 00041 00042 float setpoint; 00043 float input; 00044 float output; 00045 }; 00046 00047 00048 00049 #endif
Generated on Thu Jul 14 2022 01:39:48 by 1.7.2