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: Tourobo2022_TBCMotorDriver
Pid.h
00001 #ifndef PID_H 00002 #define PID_H 00003 00004 #include "mbed.h" 00005 00006 enum MODE_NUMBER{ 00007 POSITION_PID, 00008 SPEED_PID, 00009 }; 00010 00011 class Pid { 00012 public: 00013 void setup(float Kp,float Ki,float Kd,short PidMode = 0,float period = 0.01f); 00014 00015 void setupLimit(float UpperLimit,float FallLimit); 00016 00017 void calculate(float targetValue,float nowValue,bool enableErrorIntegration=true); 00018 00019 void reset(); 00020 00021 float getDuty(); 00022 00023 private: 00024 00025 float KP,KI,KD,PERIOD,duty,now,before,upperLimit,fallLimit; 00026 float p,i,d,e,e1,e2; 00027 short MODE; 00028 //Timer pid; 00029 }; 00030 00031 #endif
Generated on Mon Aug 15 2022 04:10:20 by
1.7.2