TwoDofController.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00010 #ifndef TWO_DOF_CONTROLLER_H
00011 #define TWO_DOF_CONTROLLER_H
00012 
00013 // </rtc-template>
00014 
00015 #include "Integrator.h"
00016 #include <string>
00017 
00018 // interface class for TwoDofController
00019 class TwoDofControllerInterface {
00020 public:
00021   virtual ~TwoDofControllerInterface() {}
00022   virtual void reset() = 0; // initialze controller
00023   virtual void setup() = 0; // setup parameters
00024   virtual bool getParameter() = 0; // get prameter of controller
00025   virtual double update(double _x, double _xd) = 0; // calculate input from current value(_x) and target value(_xd)
00026   void setErrorPrefix(const std::string& _error_prefix); // set prefix string for error message
00027 protected:
00028   std::string error_prefix;
00029 };
00030 
00031 
00032 class TwoDofController : public TwoDofControllerInterface {
00033 public:
00034   class TwoDofControllerParam {
00035   public:
00036     TwoDofControllerParam() {
00037       ke = tc = dt = 0.0; // set default param
00038     }
00039     ~TwoDofControllerParam() {
00040     }
00041     static int getControllerParamNum() {
00042       return 2;
00043     }
00044     double ke; // gain
00045     double tc; // time constant
00046     double dt; // control cycle (not controller but system parameter)
00047   };
00048   TwoDofController();
00049   TwoDofController(TwoDofControllerParam &_param, unsigned int _range = 0);
00050   ~TwoDofController();
00051   void setup();
00052   void setup(TwoDofControllerParam &_param, unsigned int _range = 0);
00053   void reset();
00054   double update(double _x, double _xd);
00055   bool getParameter();
00056   bool getParameter(TwoDofControllerParam &_p);
00057 
00058   // for compatibility of Stabilizer. TODO: replace to new parameter argument
00059   TwoDofController(double _ke, double _tc, double _dt, unsigned int _range = 0);
00060   void setup(double _ke, double _tc, double _dt, unsigned int _range = 0);
00061   
00062 private:
00063   TwoDofControllerParam param;
00064   Integrator integrator; // integrated (xd - x)
00065 };
00066 
00067 #endif // TWO_DOF_CONTROLLER_H


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Wed Sep 6 2017 02:35:56