Skip to content

Commit

Permalink
[TwoDofController] Move error_prefix to TwoDofControllerInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
orikuma committed Jul 23, 2015
1 parent 1e2d92e commit fe6cab0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions rtc/Stabilizer/TwoDofController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include "TwoDofController.h"
#include <iostream>

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);
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions rtc/Stabilizer/TwoDofController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};


Expand Down Expand Up @@ -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);
Expand All @@ -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

0 comments on commit fe6cab0

Please sign in to comment.