00001 // -*- C++ -*- 00010 #ifndef TWO_DOF_CONTROLLER_PDMODEL_H 00011 #define TWO_DOF_CONTROLLER_PDMODEL_H 00012 00013 // </rtc-template> 00014 00015 #include "../Stabilizer/TwoDofController.h" 00016 #include "Convolution.h" 00017 #include <vector> 00018 00019 class TwoDofControllerPDModel : public TwoDofControllerInterface { 00020 public: 00021 class TwoDofControllerPDModelParam { 00022 public: 00023 TwoDofControllerPDModelParam() { 00024 ke = kd = tc = dt = 0.0; // set default param 00025 } 00026 ~TwoDofControllerPDModelParam() { 00027 } 00028 static int getControllerParamNum() { 00029 return 3; 00030 } 00031 double ke; // Pgain 00032 double kd; // Dgain 00033 double tc; // time constant 00034 double dt; // control cycle (not controller but system parameter) 00035 }; 00036 TwoDofControllerPDModel(); 00037 TwoDofControllerPDModel(TwoDofControllerPDModelParam &_param, unsigned int _range = 0); 00038 ~TwoDofControllerPDModel(); 00039 void setup(); 00040 void setup(TwoDofControllerPDModelParam &_param, unsigned int _range = 0); 00041 void reset(); 00042 double update(double _x, double _xd); 00043 bool getParameter(); 00044 bool getParameter(TwoDofControllerPDModelParam &_p); 00045 private: 00046 TwoDofControllerPDModelParam param; 00047 double current_time; 00048 std::vector<Convolution> convolutions; 00049 }; 00050 00051 #endif // TWO_DOF_CONTROLLER_PDMODEL_H