sot-torque-control  1.6.5
Collection of dynamic-graph entities aimed at implementing torque control on different robots.
poly-estimator.hh
Go to the documentation of this file.
1 /*
2  Oscar Efrain RAMOS PONCE, LAAS-CNRS
3  Date: 28/10/2014
4  Object to estimate a polynomial that fits some data.
5 */
6 
7 #ifndef _POLY_ESTIMATOR_HH_
8 #define _POLY_ESTIMATOR_HH_
9 
10 #include <Eigen/Dense>
11 #include <vector>
12 
19 void pinv(const Eigen::MatrixXd& matrix_in, Eigen::MatrixXd& pseudo_inv,
20  const double& pinvtoler = 1.0e-6);
21 
31  public:
38  PolyEstimator(const unsigned int& order, const unsigned int& N,
39  const double& dt);
40 
50  void estimate(std::vector<double>& estimee,
51  const std::vector<double>& data_element, const double& time);
52 
61  virtual void estimate(std::vector<double>& estimee,
62  const std::vector<double>& data_element) = 0;
63 
72  virtual void estimateRecursive(std::vector<double>& estimee,
73  const std::vector<double>& data_element,
74  const double& time) = 0;
75 
82  virtual void getEstimateDerivative(std::vector<double>& estimeeDerivative,
83  const unsigned int order) = 0;
84 
89  void setWindowLength(const unsigned int& N);
90 
95  unsigned int getWindowLength();
96 
97  protected:
102  virtual void fit();
103 
107  virtual double getEsteeme() = 0;
108 
110  unsigned int order_;
111 
113  unsigned int N_;
114 
116  double dt_;
117 
119  bool dt_zero_;
120 
124 
126  std::vector<std::vector<double> > elem_list_;
127 
129  std::vector<double> time_list_;
130 
132  unsigned int pt_;
133 
135  Eigen::VectorXd coeff_;
136 
138  std::vector<double> t_;
139 
142  std::vector<double> x_;
143 
147  Eigen::MatrixXd R_;
148 };
149 
150 #endif
PolyEstimator::fit
virtual void fit()
Definition: poly-estimator.cpp:91
PolyEstimator::first_run_
bool first_run_
Definition: poly-estimator.hh:123
PolyEstimator::dt_
double dt_
Sampling (control) time.
Definition: poly-estimator.hh:116
PolyEstimator::R_
Eigen::MatrixXd R_
Definition: poly-estimator.hh:147
PolyEstimator::estimate
void estimate(std::vector< double > &estimee, const std::vector< double > &data_element, const double &time)
Definition: poly-estimator.cpp:41
PolyEstimator::getEstimateDerivative
virtual void getEstimateDerivative(std::vector< double > &estimeeDerivative, const unsigned int order)=0
PolyEstimator::coeff_
Eigen::VectorXd coeff_
Coefficients for the least squares solution.
Definition: poly-estimator.hh:135
PolyEstimator::setWindowLength
void setWindowLength(const unsigned int &N)
Definition: poly-estimator.cpp:107
PolyEstimator::dt_zero_
bool dt_zero_
Indicate that dt is zero (dt is invalid)
Definition: poly-estimator.hh:119
pinv
void pinv(const Eigen::MatrixXd &matrix_in, Eigen::MatrixXd &pseudo_inv, const double &pinvtoler=1.0e-6)
Definition: poly-estimator.cpp:9
PolyEstimator::t_
std::vector< double > t_
Time vector setting the lowest time to zero (for numerical stability).
Definition: poly-estimator.hh:138
PolyEstimator::N_
unsigned int N_
Window length.
Definition: poly-estimator.hh:113
PolyEstimator
Definition: poly-estimator.hh:30
PolyEstimator::getWindowLength
unsigned int getWindowLength()
Definition: poly-estimator.cpp:109
PolyEstimator::order_
unsigned int order_
Order of the polynomial estimator.
Definition: poly-estimator.hh:110
PolyEstimator::pt_
unsigned int pt_
Circular index to each data and time element.
Definition: poly-estimator.hh:132
PolyEstimator::x_
std::vector< double > x_
Definition: poly-estimator.hh:142
PolyEstimator::time_list_
std::vector< double > time_list_
Time vector corresponding to each element in elem_list_.
Definition: poly-estimator.hh:129
PolyEstimator::estimateRecursive
virtual void estimateRecursive(std::vector< double > &estimee, const std::vector< double > &data_element, const double &time)=0
PolyEstimator::PolyEstimator
PolyEstimator(const unsigned int &order, const unsigned int &N, const double &dt)
Definition: poly-estimator.cpp:26
PolyEstimator::elem_list_
std::vector< std::vector< double > > elem_list_
All the data (N elements of size dim)
Definition: poly-estimator.hh:126
PolyEstimator::getEsteeme
virtual double getEsteeme()=0