00001 // PID蛻カ蠕。蝎ィ繧ッ繝ゥ繧ケ 00002 // 2011/02/16 Yuki YOKOKURA 00003 // 00004 // PID蛻カ蠕。蝎ィ G(s) = Kp + Ki/s + Kd*s*gdis/(s+gdis) (蜿御ク�谺。螟画鋤) 00005 // 00006 // Copyright (C) 2011 Yuki YOKOKURA 00007 // This program is free software; 00008 // you can redistribute it and/or modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation; either version 3 of the License, or any later version. 00010 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00011 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 // See the GNU General Public License for more details <http://www.gnu.org/licenses/>. 00013 // Besides, you can negotiate about other options of licenses instead of GPL. 00014 // If you would like to get other licenses, please contact us<yuki@katsura.sd.keio.ac.jp>. 00015 00016 #ifndef PIDCTRLLER 00017 #define PIDCTRLLER 00018 00019 namespace ARCS { // ARCS蜷榊燕遨コ髢� 00020 class PIDcontroller { 00021 private: 00022 double Ts; // [s] 蛻カ蠕。蜻ィ譛� 00023 double Kp; // 豈比セ九ご繧、繝ウ 00024 double Ki; // 遨榊�繧イ繧、繝ウ 00025 double Kd; // 蠕ョ蛻�繧イ繧、繝ウ 00026 double gpd; // [rad/s] 謫ャ莨シ蠕ョ蛻�蝎ィ縺ョ蟶ッ蝓� 00027 double uZ1; // 迥カ諷句、画焚1 螟画焚蜷校1縺ョ諢丞袖縺ッz螟画鋤縺ョz^(-1)繧堤、コ縺� 00028 double uZ2; // 迥カ諷句、画焚2 00029 double yZ1; // 迥カ諷句、画焚3 00030 double yZ2; // 迥カ諷句、画焚4 00031 00032 public: 00033 PIDcontroller(double Pgain, double Igain, double Dgain, double Bandwidth, double SmplTime); 00034 // 繧ウ繝ウ繧ケ繝医Λ繧ッ繧ソ 00035 // Pgain�シ帶ッ比セ九ご繧、繝ウ�シ栗gain�シ帷ゥ榊�繧イ繧、繝ウ�シ轡gain�シ帛セョ蛻�繧イ繧、繝ウ�シ沓andwidth�シ媼rad/s] 蟶ッ蝓滂シ郡mplTime�シ媼s] 蛻カ蠕。蜻ィ譛� 00036 ~PIDcontroller(); // 繝�繧ケ繝医Λ繧ッ繧ソ 00037 double GetSignal(double u); // 蜃コ蜉帑ソ。蜿キ縺ョ蜿門セ� u�シ帛�・蜉帑ソ。蜿キ 00038 void SetPgain(double Pgain); // 豈比セ九ご繧、繝ウ縺ョ蜀崎ィュ螳� Pgain�シ帶ッ比セ九ご繧、繝ウ 00039 void SetIgain(double Igain); // 遨榊�繧イ繧、繝ウ縺ョ蜀崎ィュ螳� Igain�シ帷ゥ榊�繧イ繧、繝ウ 00040 void SetDgain(double Dgain); // 蠕ョ蛻�繧イ繧、繝ウ縺ョ蜀崎ィュ螳� Dgain�シ帛セョ蛻�繧イ繧、繝ウ 00041 void SetBandwidth(double Bandwidth);// 謫ャ莨シ蠕ョ蛻�縺ョ蟶ッ蝓溘�ョ蜀崎ィュ螳� Bandwidth�シ媼rad/s] 蟶ッ蝓� 00042 void SetSmplTime(double SmplTime); // 蛻カ蠕。蜻ィ譛溘�ョ蜀崎ィュ螳� SmplTime�シ媼s] 蛻カ蠕。蜻ィ譛� 00043 void ClearStateVars(void); // 縺吶∋縺ヲ縺ョ迥カ諷句、画焚縺ョ繝ェ繧サ繝�繝� 00044 }; 00045 } 00046 00047 #endif 00048 00049 00050