Go to the documentation of this file.00001
00010 #ifndef TWO_DOF_CONTROLLER_H
00011 #define TWO_DOF_CONTROLLER_H
00012
00013
00014
00015 #include "Integrator.h"
00016 #include <string>
00017
00018
00019 class TwoDofControllerInterface {
00020 public:
00021 virtual ~TwoDofControllerInterface() {}
00022 virtual void reset() = 0;
00023 virtual void setup() = 0;
00024 virtual bool getParameter() = 0;
00025 virtual double update(double _x, double _xd) = 0;
00026 void setErrorPrefix(const std::string& _error_prefix);
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;
00038 }
00039 ~TwoDofControllerParam() {
00040 }
00041 static int getControllerParamNum() {
00042 return 2;
00043 }
00044 double ke;
00045 double tc;
00046 double dt;
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
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;
00065 };
00066
00067 #endif // TWO_DOF_CONTROLLER_H