Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Nucleo_spi 2015_denziben_i2c_S2 Nucleo_Motor Nucleo_Motor
Fork of PID by
PID.h
00001 00002 #ifndef PID_H 00003 #define PID_H 00004 00005 #include "mbed.h" 00006 class PID 00007 { 00008 protected: 00009 PID(const PID& p); 00010 PID& operator=(const PID &p) { 00011 return *this; 00012 } 00013 void PIDctrl(); 00014 public: 00015 void InputLimits(float max,float min); 00016 void OutputLimits(float max,float min); 00017 PID(float tauKc, float tauKi, float tauKd ,Timer *T); 00018 void setbias(float bias_){bias=bias_;} 00019 double s_dErrIntg ,dErr_prev; 00020 void start(); 00021 void pid_reset(); 00022 void setInterval(double inter); 00023 //Getters. 00024 void stop(); 00025 double dTarget; 00026 double dPoint; 00027 // PI制御ゲイン 00028 double GAIN_P ;//1.5 // 比例ゲイン 00029 double GAIN_I ;//2.8 // 積分ゲイン 00030 double GAIN_D ;//0.2 00031 double data; 00032 private: 00033 float bias; 00034 float OutMax; 00035 float InMax; 00036 float OutMin; 00037 float InMin; 00038 float OutSpan; 00039 float InSpan; 00040 Timer *timer; 00041 float gettime() { 00042 static float prev_time; 00043 float a = timer->read()-prev_time; 00044 prev_time=timer->read(); 00045 return a; 00046 } 00047 //Ticker T; 00048 float interval; 00049 00050 }; 00051 00052 #endif
Generated on Tue Jul 12 2022 18:05:07 by
