00001 // -*- C++ -*- 00010 #ifndef TWO_DOF_CONTROLLER_DYNAMICS_MODEL_H 00011 #define TWO_DOF_CONTROLLER_DYNAMICS_MODEL_H 00012 00013 // </rtc-template> 00014 00015 #include "../Stabilizer/TwoDofController.h" 00016 #include "Convolution.h" 00017 #include <vector> 00018 00019 class TwoDofControllerDynamicsModel : public TwoDofControllerInterface { 00020 public: 00021 class TwoDofControllerDynamicsModelParam { 00022 public: 00023 TwoDofControllerDynamicsModelParam() { 00024 alpha = beta = ki = tc = dt = 0.0; // set default param 00025 } 00026 ~TwoDofControllerDynamicsModelParam() { 00027 } 00028 static int getControllerParamNum() { 00029 return 4; 00030 } 00031 double alpha; // completing squared param (s + alpha)^2 - beta^2 00032 double beta; // completing square param (s + alpha)^2 - beta^2 00033 double ki; // virtual inertia 00034 double tc; // time constant 00035 double dt; // control cycle (not controller but system parameter) 00036 }; 00037 TwoDofControllerDynamicsModel(); 00038 TwoDofControllerDynamicsModel(TwoDofControllerDynamicsModelParam &_param, unsigned int _range = 0); 00039 ~TwoDofControllerDynamicsModel(); 00040 void setup(); 00041 void setup(TwoDofControllerDynamicsModelParam &_param, unsigned int _range = 0); 00042 void reset(); 00043 double update(double _x, double _xd); 00044 bool getParameter(); 00045 bool getParameter(TwoDofControllerDynamicsModelParam &_p); 00046 00047 private: 00048 TwoDofControllerDynamicsModelParam param; 00049 double current_time; 00050 Integrator integrate_exp_sinh_current; 00051 std::vector<double> exp_sinh; 00052 std::vector<Convolution> convolutions; 00053 }; 00054 00055 #endif // TWO_DOF_CONTROLLER_DYNAMICS_MODEL_H