Integrator.h
Go to the documentation of this file.
1 // -*- C++ -*-
10 #ifndef INTEGRATOR_H
11 #define INTEGRATOR_H
12 
13 // </rtc-template>
14 
15 #include <deque>
16 
17 class Integrator {
18 public:
19  // if range = 0, integrate from 0 to t. Otherwise, integrate from t - (range - 1) * dt to t.
20  Integrator(double _dt = 0.005, unsigned int _range = 0);
21  ~Integrator(void);
22  void reset(void);
23  void setup(double _dt, unsigned int _range);
24  void update(double _x);
25  double calculate(void);
26 private:
27  double dt; // control cycle
28  double first, sum, last; // for trapezoidal rule calculation
29  bool init_integration_flag; // integration inited flag (true when first value is updated)
30  unsigned int range; // integration range (from t_now - range * dt to t_now [sec])
31  std::deque<double> buffer; // integration data buffer
32 };
33 
34 #endif // TWO_DOF_CONTROLLER_H
double calculate(void)
Definition: Integrator.cpp:65
double dt
Definition: Integrator.h:27
std::deque< double > buffer
Definition: Integrator.h:31
double sum
Definition: Integrator.h:28
double first
Definition: Integrator.h:28
bool init_integration_flag
Definition: Integrator.h:29
~Integrator(void)
Definition: Integrator.cpp:20
unsigned int range
Definition: Integrator.h:30
void setup(double _dt, unsigned int _range)
Definition: Integrator.cpp:32
void update(double _x)
Definition: Integrator.cpp:39
void reset(void)
Definition: Integrator.cpp:23
double last
Definition: Integrator.h:28
Integrator(double _dt=0.005, unsigned int _range=0)
Definition: Integrator.cpp:16


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:50