sot-torque-control  1.6.2
Collection of dynamic-graph entities aimed at implementing torque control on different robots.
quad-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 of first order that fits some data.
5 */
6 
7 #ifndef _QUAD_ESTIMATOR_HH_
8 #define _QUAD_ESTIMATOR_HH_
9 
11 
17 class QuadEstimator : public PolyEstimator {
18  public:
25  QuadEstimator(const unsigned int& N, const unsigned int& dim, const double& dt = 0.0);
26 
27  virtual void estimate(std::vector<double>& estimee, const std::vector<double>& el);
28 
29  virtual void estimateRecursive(std::vector<double>& estimee, const std::vector<double>& el, const double& time);
30 
31  virtual void getEstimateDerivative(std::vector<double>& estimeeDerivative, const unsigned int order);
32 
33  private:
34  virtual double getEsteeme();
35  virtual void fit();
36 
37  int dim_; // size of the data
38 
39  // Sums for the recursive computation
40  double sum_ti_;
41  double sum_ti2_;
42  double sum_ti3_;
43  double sum_ti4_;
44  std::vector<double> sum_xi_;
45  std::vector<double> sum_tixi_;
46  std::vector<double> sum_ti2xi_;
47 
48  // coefficients of the polynomial c2*x^2 + c1*x + c0
49  std::vector<double> c0_;
50  std::vector<double> c1_;
51  std::vector<double> c2_;
52 
53  // Rows of the pseudo-inverse (when assuming constant sample time)
54  double* pinv0_;
55  double* pinv1_;
56  double* pinv2_;
57  // Half of the maximum time (according to the size of the window and dt)
58  double tmed_;
59 };
60 
61 #endif
virtual void estimateRecursive(std::vector< double > &estimee, const std::vector< double > &el, const double &time)
virtual void getEstimateDerivative(std::vector< double > &estimeeDerivative, const unsigned int order)
QuadEstimator(const unsigned int &N, const unsigned int &dim, const double &dt=0.0)
virtual void estimate(std::vector< double > &estimee, const std::vector< double > &el)