From fe6cab0a7b91201c5c19bf602bb5578d99856150 Mon Sep 17 00:00:00 2001 From: iori Date: Thu, 23 Jul 2015 17:49:55 +0900 Subject: [PATCH] [TwoDofController] Move error_prefix to TwoDofControllerInterface --- rtc/Stabilizer/TwoDofController.cpp | 8 ++++---- rtc/Stabilizer/TwoDofController.h | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/rtc/Stabilizer/TwoDofController.cpp b/rtc/Stabilizer/TwoDofController.cpp index f76c734fdf4..e9762d5054c 100644 --- a/rtc/Stabilizer/TwoDofController.cpp +++ b/rtc/Stabilizer/TwoDofController.cpp @@ -11,6 +11,10 @@ #include "TwoDofController.h" #include +void TwoDofControllerInterface::setErrorPrefix(const std::string& _error_prefix) { + error_prefix = _error_prefix; +} + TwoDofController::TwoDofController() { param = TwoDofController::TwoDofControllerParam(); // use default constructor integrator = Integrator(0.0, 0.0); @@ -80,10 +84,6 @@ double TwoDofController::update (double _x, double _xd) { } -void TwoDofController::setErrorPrefix(const std::string& _error_prefix) { - error_prefix = _error_prefix; -} - // for compatiblity of Stabilizer TwoDofController::TwoDofController(double _ke, double _tc, double _dt, unsigned int _range) { param.ke = _ke; param.tc = _tc; param.dt = _dt; diff --git a/rtc/Stabilizer/TwoDofController.h b/rtc/Stabilizer/TwoDofController.h index 0c303771b97..70aa71abe96 100644 --- a/rtc/Stabilizer/TwoDofController.h +++ b/rtc/Stabilizer/TwoDofController.h @@ -23,6 +23,9 @@ class TwoDofControllerInterface { virtual void setup() = 0; // setup parameters virtual bool getParameter() = 0; // get prameter of controller virtual double update(double _x, double _xd) = 0; // calculate input from current value(_x) and target value(_xd) + void setErrorPrefix(const std::string& _error_prefix); // set prefix string for error message +protected: + std::string error_prefix; }; @@ -51,7 +54,6 @@ class TwoDofController : public TwoDofControllerInterface { double update(double _x, double _xd); bool getParameter(); bool getParameter(TwoDofControllerParam &_p); - void setErrorPrefix(const std::string& _error_prefix); // for compatibility of Stabilizer. TODO: replace to new parameter argument TwoDofController(double _ke, double _tc, double _dt, unsigned int _range = 0); @@ -60,7 +62,6 @@ class TwoDofController : public TwoDofControllerInterface { private: TwoDofControllerParam param; Integrator integrator; // integrated (xd - x) - std::string error_prefix; }; #endif // TWO_DOF_CONTROLLER_H