Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
rtc
Stabilizer
TwoDofController.h
Go to the documentation of this file.
1
// -*- C++ -*-
10
#ifndef TWO_DOF_CONTROLLER_H
11
#define TWO_DOF_CONTROLLER_H
12
13
// </rtc-template>
14
15
#include "
Integrator.h
"
16
#include <string>
17
18
// interface class for TwoDofController
19
class
TwoDofControllerInterface
{
20
public
:
21
virtual
~TwoDofControllerInterface
() {}
22
virtual
void
reset
() = 0;
// initialze controller
23
virtual
void
setup
() = 0;
// setup parameters
24
virtual
bool
getParameter
() = 0;
// get prameter of controller
25
virtual
double
update
(
double
_x,
double
_xd) = 0;
// calculate input from current value(_x) and target value(_xd)
26
void
setErrorPrefix
(
const
std::string& _error_prefix);
// set prefix string for error message
27
protected
:
28
std::string
error_prefix
;
29
};
30
31
32
class
TwoDofController
:
public
TwoDofControllerInterface
{
33
public
:
34
class
TwoDofControllerParam
{
35
public
:
36
TwoDofControllerParam
() {
37
ke = tc = dt = 0.0;
// set default param
38
}
39
~TwoDofControllerParam
() {
40
}
41
static
int
getControllerParamNum
() {
42
return
2;
43
}
44
double
ke
;
// gain
45
double
tc
;
// time constant
46
double
dt
;
// control cycle (not controller but system parameter)
47
};
48
TwoDofController
();
49
TwoDofController
(
TwoDofControllerParam
&_param,
unsigned
int
_range = 0);
50
~
TwoDofController
();
51
void
setup
();
52
void
setup
(
TwoDofControllerParam
&_param,
unsigned
int
_range = 0);
53
void
reset
();
54
double
update
(
double
_x,
double
_xd);
55
bool
getParameter
();
56
bool
getParameter
(
TwoDofControllerParam
&_p);
57
58
// for compatibility of Stabilizer. TODO: replace to new parameter argument
59
TwoDofController
(
double
_ke,
double
_tc,
double
_dt,
unsigned
int
_range = 0);
60
void
setup
(
double
_ke,
double
_tc,
double
_dt,
unsigned
int
_range = 0);
61
62
private
:
63
TwoDofControllerParam
param
;
64
Integrator
integrator
;
// integrated (xd - x)
65
};
66
67
#endif // TWO_DOF_CONTROLLER_H
TwoDofController
Definition:
TwoDofController.h:32
TwoDofController::TwoDofControllerParam::TwoDofControllerParam
TwoDofControllerParam()
Definition:
TwoDofController.h:36
TwoDofController::integrator
Integrator integrator
Definition:
TwoDofController.h:64
TwoDofControllerInterface::~TwoDofControllerInterface
virtual ~TwoDofControllerInterface()
Definition:
TwoDofController.h:21
TwoDofControllerInterface::getParameter
virtual bool getParameter()=0
TwoDofController::TwoDofControllerParam::ke
double ke
Definition:
TwoDofController.h:44
TwoDofController::TwoDofControllerParam::~TwoDofControllerParam
~TwoDofControllerParam()
Definition:
TwoDofController.h:39
Integrator
Definition:
Integrator.h:17
TwoDofControllerInterface
Definition:
TwoDofController.h:19
TwoDofController::TwoDofControllerParam::dt
double dt
Definition:
TwoDofController.h:46
TwoDofController::TwoDofControllerParam
Definition:
TwoDofController.h:34
TwoDofControllerInterface::setErrorPrefix
void setErrorPrefix(const std::string &_error_prefix)
Definition:
TwoDofController.cpp:14
TwoDofControllerInterface::update
virtual double update(double _x, double _xd)=0
Integrator.h
Calcurate Integration.
TwoDofController::param
TwoDofControllerParam param
Definition:
TwoDofController.h:63
TwoDofController::TwoDofControllerParam::getControllerParamNum
static int getControllerParamNum()
Definition:
TwoDofController.h:41
TwoDofControllerInterface::error_prefix
std::string error_prefix
Definition:
TwoDofController.h:28
TwoDofControllerInterface::setup
virtual void setup()=0
TwoDofController::TwoDofControllerParam::tc
double tc
Definition:
TwoDofController.h:45
TwoDofControllerInterface::reset
virtual void reset()=0
hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:51