7 #ifndef RB_POLYNOMIAL_H_
8 #define RB_POLYNOMIAL_H_
43 const std::vector<double>& start,
44 const std::vector<double>& end,
49 this->
c_[0] = start[0];
50 this->
c_[1] = start[1];
51 this->
c_[2] = start[2]/2.;
59 double p1 =
c_[0] +
c_[1] * T +
c_[2] * T2;
60 double p2 =
c_[1] + 2. *
c_[2] * T;
61 double p3 = 2. *
c_[2];
66 3 * T2 , 4 * T3 , 5 * T4 ,
67 6 * T , 12 * T2 , 20 * T3;
89 for(
int i=0; i<vecT.size(); ++i)
93 double position =
c_.transpose() * vecT;
106 for(
int i=0; i<vecT.size(); ++i)
108 vecT[i] = (i+1) * pow(T, i);
111 double vel =
c_.tail(
degree_).transpose() * vecT;
145 #endif // RB_POLYNOMIAL_H_
double getPosition(const double &T) const
Get the value (position) of polynomial f(t) at time T.
Definition: polynomial.h:86
Polynomial()
Default Construction.
Definition: polynomial.h:24
short degree_
An integer indicate degree of polynomial.
Definition: polynomial.h:131
void coeffQuintic(const std::vector< double > &start, const std::vector< double > &end, const double &T)
Compute the coefficients of quintic (fifth order) polynomial by giving initial conditions of start an...
Definition: polynomial.h:42
short getDegree(void) const
Get the degree (order) of the polynomial function.
Definition: polynomial.h:119
double t_
The duration (time) of polynomial function f(t).
Definition: polynomial.h:137
Eigen::Matrix3d Matrix3
make Matrix3 as alias of Eigen::Matrix3d
Definition: matrix.h:19
double getVelocity(const double &T) const
Get the 1st order differential value (velocity) of polynomial f(t) at time T.
Definition: polynomial.h:103
Polynomial(const short deg, const double t=0.)
Construct polynomial with given degree.
Definition: polynomial.h:30
rb::math::VectorX getCoeff(void) const
Get the coefficients of the polynomial function.
Definition: polynomial.h:128
A class for constructing polynomial function.
Definition: polynomial.h:20
A head file define tpyes, and function for matrix manipulating.
rb::math::VectorX c_
A vector of coefficient of polynomial.
Definition: polynomial.h:136
Eigen::VectorXd VectorX
make VectorX as alias of Eigen::VectorXd
Definition: matrix.h:22