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.
PID.hpp
00001 #ifndef PID_ 00002 #define PID_ 00003 00004 #if 0 00005 ~example~ 00006 PID name(kpの値,kiの値,kdの値,一回のプログラムの時間(Δt))でこのクラスを使うことができる 00007 name.set(現在値,目標値)でPID制御の計算をしてくれる 00008 name.safety(最大値,最小値)でpwmの値が設定した値を超えないようにする(大事) 00009 name.pwmで求めたpwmの値を使うことができる 00010 name.reset()でpwmの値を0にする 00011 #endif 00012 00013 class PID 00014 { 00015 public: 00016 PID(double kp,double ki,double kd,double dt); 00017 ~PID(); 00018 double set(double,double); 00019 void safety(double,double); 00020 void reset(); 00021 double pwm; 00022 private: 00023 double integral; 00024 double e[2]; 00025 double Kp; 00026 double Ki; 00027 double Kd; 00028 double dt; 00029 double getP; 00030 double getI; 00031 double getD; 00032 }; 00033 00034 #endif
Generated on Sat Oct 8 2022 11:15:36 by
1.7.2