sot-torque-control  1.6.4
Collection of dynamic-graph entities aimed at implementing torque control on different robots.
 
Loading...
Searching...
No Matches
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
19void 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
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
virtual void estimateRecursive(std::vector< double > &estimee, const std::vector< double > &data_element, const double &time)=0
virtual void fit()
unsigned int N_
Window length.
unsigned int getWindowLength()
std::vector< double > time_list_
Time vector corresponding to each element in elem_list_.
virtual void getEstimateDerivative(std::vector< double > &estimeeDerivative, const unsigned int order)=0
double dt_
Sampling (control) time.
bool dt_zero_
Indicate that dt is zero (dt is invalid)
Eigen::VectorXd coeff_
Coefficients for the least squares solution.
std::vector< double > x_
void setWindowLength(const unsigned int &N)
unsigned int order_
Order of the polynomial estimator.
unsigned int pt_
Circular index to each data and time element.
virtual void estimate(std::vector< double > &estimee, const std::vector< double > &data_element)=0
std::vector< double > t_
Time vector setting the lowest time to zero (for numerical stability).
void estimate(std::vector< double > &estimee, const std::vector< double > &data_element, const double &time)
virtual double getEsteeme()=0
std::vector< std::vector< double > > elem_list_
All the data (N elements of size dim)
Eigen::MatrixXd R_
void pinv(const Eigen::MatrixXd &matrix_in, Eigen::MatrixXd &pseudo_inv, const double &pinvtoler=1.0e-6)