ndcurves::polynomial Class Reference

Represents a polynomial of an arbitrary order defined on the interval $[t_{min}, t_{max}]$. It follows the equation :
$ x(t) = a + b(t - t_{min}) + ... + d(t - t_{min})^N $
where N is the order and $ t \in [t_{min}, t_{max}] $. More...

#include <ndcurves/fwd.h>

Public Types

typedef Point point_t
 
typedef T_Point t_point_t
 
typedef Time time_t
 
typedef Numeric num_t
 
typedef curve_abc< Time, Numeric, Safe, Point > curve_abc_t
 
typedef Eigen::MatrixXd coeff_t
 
typedef Eigen::Ref< coeff_tcoeff_t_ref
 
typedef polynomial< Time, Numeric, Safe, Point, T_Point > polynomial_t
 
typedef curve_abc_t::curve_ptr_t curve_ptr_t
 

Public Member Functions

 polynomial ()
 Empty constructor. Curve obtained this way can not perform other class functions. More...
 
 polynomial (const coeff_t &coefficients, const time_t min, const time_t max)
 Constructor. More...
 
 polynomial (const T_Point &coefficients, const time_t min, const time_t max)
 Constructor. More...
 
template<typename In >
 polynomial (In zeroOrderCoefficient, In out, const time_t min, const time_t max)
 Constructor. More...
 
 polynomial (const Point &init, const Point &end, const time_t min, const time_t max)
 Constructor from boundary condition with C0 : create a polynomial that connect exactly init and end (order 1) More...
 
 polynomial (const Point &init, const Point &d_init, const Point &end, const Point &d_end, const time_t min, const time_t max)
 Constructor from boundary condition with C1 : create a polynomial that connect exactly init and end and thier first order derivatives(order 3) More...
 
 polynomial (const Point &init, const Point &d_init, const Point &dd_init, const Point &end, const Point &d_end, const Point &dd_end, const time_t min, const time_t max)
 Constructor from boundary condition with C2 : create a polynomial that connect exactly init and end and thier first and second order derivatives(order 5) More...
 
virtual ~polynomial ()
 Destructor. More...
 
 polynomial (const polynomial &other)
 
virtual point_t operator() (const time_t t) const
 Evaluation of the cubic spline at time t using horner's scheme. More...
 
bool isApprox (const polynomial_t &other, const Numeric prec=Eigen::NumTraits< Numeric >::dummy_precision()) const
 isApprox check if other and *this are approximately equals. Only two curves of the same class can be approximately equals, for comparison between different type of curves see isEquivalent More...
 
virtual bool isApprox (const curve_abc_t *other, const Numeric prec=Eigen::NumTraits< Numeric >::dummy_precision()) const
 
virtual bool operator== (const polynomial_t &other) const
 
virtual bool operator!= (const polynomial_t &other) const
 
virtual point_t derivate (const time_t t, const std::size_t order) const
 Evaluation of the derivative of order N of spline at time t. More...
 
polynomial_t compute_derivate (const std::size_t order) const
 
polynomial_tcompute_derivate_ptr (const std::size_t order) const
 Compute the derived curve at order N. More...
 
Eigen::MatrixXd coeff () const
 
point_t coeffAtDegree (const std::size_t degree) const
 
virtual std::size_t dim () const
 Get dimension of curve. More...
 
virtual num_t min () const
 Get the minimum time for which the curve is defined. More...
 
virtual num_t max () const
 Get the maximum time for which the curve is defined. More...
 
virtual std::size_t degree () const
 Get the degree of the curve. More...
 
polynomial_toperator+= (const polynomial_t &p1)
 
polynomial_toperator-= (const polynomial_t &p1)
 
polynomial_toperator+= (const polynomial_t::point_t &point)
 
polynomial_toperator-= (const polynomial_t::point_t &point)
 
polynomial_toperator/= (const double d)
 
polynomial_toperator*= (const double d)
 
polynomial_t cross (const polynomial_t &pOther) const
 Compute the cross product of the current polynomial by another polynomial. The cross product p1Xp2 of 2 polynomials p1 and p2 is defined such that forall t, p1Xp2(t) = p1(t) X p2(t), with X designing the cross product. This method of course only makes sense for dimension 3 polynomials. More...
 
polynomial_t cross (const polynomial_t::point_t &point) const
 Compute the cross product of the current polynomial p by a point point. The cross product pXpoint of is defined such that forall t, pXpoint(t) = p(t) X point, with X designing the cross product. This method of course only makes sense for dimension 3 polynomials. More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Static Public Member Functions

static polynomial_t MinimumJerk (const point_t &p_init, const point_t &p_final, const time_t t_min=0., const time_t t_max=1.)
 MinimumJerk Build a polynomial curve connecting p_init to p_final minimizing the time integral of the squared jerk with a zero initial and final velocity and acceleration. More...
 
static void MinimumJerk (polynomial_t &out, const point_t &p_init, const point_t &p_final, const time_t t_min=0., const time_t t_max=1.)
 MinimumJerk Build a polynomial curve connecting p_init to p_final minimizing the time integral of the squared jerk with a zero initial and final velocity and acceleration. More...
 

Public Attributes

std::size_t dim_
 
coeff_t coefficients_
 
std::size_t degree_
 
time_t T_min_
 
time_t T_max_
 

Friends

class boost::serialization::access
 

Detailed Description

Represents a polynomial of an arbitrary order defined on the interval $[t_{min}, t_{max}]$. It follows the equation :
$ x(t) = a + b(t - t_{min}) + ... + d(t - t_{min})^N $
where N is the order and $ t \in [t_{min}, t_{max}] $.

Member Typedef Documentation

◆ coeff_t

typedef Eigen::MatrixXd ndcurves::polynomial::coeff_t

◆ coeff_t_ref

◆ curve_abc_t

typedef curve_abc<Time, Numeric, Safe, Point> ndcurves::polynomial::curve_abc_t

◆ curve_ptr_t

◆ num_t

typedef Numeric ndcurves::polynomial::num_t

◆ point_t

◆ polynomial_t

typedef polynomial<Time, Numeric, Safe, Point, T_Point> ndcurves::polynomial::polynomial_t

◆ t_point_t

◆ time_t

Constructor & Destructor Documentation

◆ polynomial() [1/8]

ndcurves::polynomial::polynomial ( )
inline

Empty constructor. Curve obtained this way can not perform other class functions.

◆ polynomial() [2/8]

ndcurves::polynomial::polynomial ( const coeff_t coefficients,
const time_t  min,
const time_t  max 
)
inline

Constructor.

Parameters
coefficients: a reference to an Eigen matrix where each column is a coefficient, from the zero order coefficient, up to the highest order. Spline order is given by the number of the columns -1.
min: LOWER bound on interval definition of the curve.
max: UPPER bound on interval definition of the curve.

◆ polynomial() [3/8]

ndcurves::polynomial::polynomial ( const T_Point &  coefficients,
const time_t  min,
const time_t  max 
)
inline

Constructor.

Parameters
coefficients: a container containing all coefficients of the spline, starting with the zero order coefficient, up to the highest order. Spline order is given by the size of the coefficients.
min: LOWER bound on interval definition of the spline.
max: UPPER bound on interval definition of the spline.

◆ polynomial() [4/8]

template<typename In >
ndcurves::polynomial::polynomial ( In  zeroOrderCoefficient,
In  out,
const time_t  min,
const time_t  max 
)
inline

Constructor.

Parameters
zeroOrderCoefficient: an iterator pointing to the first element of a structure containing the coefficients it corresponds to the zero degree coefficient.
out: an iterator pointing to the last element of a structure ofcoefficients.
min: LOWER bound on interval definition of the spline.
max: UPPER bound on interval definition of the spline.

◆ polynomial() [5/8]

ndcurves::polynomial::polynomial ( const Point &  init,
const Point &  end,
const time_t  min,
const time_t  max 
)
inline

Constructor from boundary condition with C0 : create a polynomial that connect exactly init and end (order 1)

Parameters
initthe initial point of the curve
endthe final point of the curve
min: LOWER bound on interval definition of the spline.
max: UPPER bound on interval definition of the spline.

◆ polynomial() [6/8]

ndcurves::polynomial::polynomial ( const Point &  init,
const Point &  d_init,
const Point &  end,
const Point &  d_end,
const time_t  min,
const time_t  max 
)
inline

Constructor from boundary condition with C1 : create a polynomial that connect exactly init and end and thier first order derivatives(order 3)

Parameters
initthe initial point of the curve
d_initthe initial value of the derivative of the curve
endthe final point of the curve
d_endthe final value of the derivative of the curve
min: LOWER bound on interval definition of the spline.
max: UPPER bound on interval definition of the spline.

◆ polynomial() [7/8]

ndcurves::polynomial::polynomial ( const Point &  init,
const Point &  d_init,
const Point &  dd_init,
const Point &  end,
const Point &  d_end,
const Point &  dd_end,
const time_t  min,
const time_t  max 
)
inline

Constructor from boundary condition with C2 : create a polynomial that connect exactly init and end and thier first and second order derivatives(order 5)

Parameters
initthe initial point of the curve
d_initthe initial value of the derivative of the curve
d_initthe initial value of the second derivative of the curve
endthe final point of the curve
d_endthe final value of the derivative of the curve
d_endthe final value of the second derivative of the curve
min: LOWER bound on interval definition of the spline.
max: UPPER bound on interval definition of the spline.

◆ ~polynomial()

virtual ndcurves::polynomial::~polynomial ( )
inlinevirtual

Destructor.

◆ polynomial() [8/8]

ndcurves::polynomial::polynomial ( const polynomial other)
inline

Member Function Documentation

◆ coeff()

Eigen::MatrixXd ndcurves::polynomial::coeff ( ) const
inline

◆ coeffAtDegree()

point_t ndcurves::polynomial::coeffAtDegree ( const std::size_t  degree) const
inline

◆ compute_derivate()

polynomial_t ndcurves::polynomial::compute_derivate ( const std::size_t  order) const
inline

◆ compute_derivate_ptr()

polynomial_t* ndcurves::polynomial::compute_derivate_ptr ( const std::size_t  order) const
inline

Compute the derived curve at order N.

Parameters
order: order of derivative.
Returns
A pointer to $\frac{d^Nx(t)}{dt^N}$ derivative order N of the curve.

◆ cross() [1/2]

polynomial_t ndcurves::polynomial::cross ( const polynomial_t pOther) const
inline

Compute the cross product of the current polynomial by another polynomial. The cross product p1Xp2 of 2 polynomials p1 and p2 is defined such that forall t, p1Xp2(t) = p1(t) X p2(t), with X designing the cross product. This method of course only makes sense for dimension 3 polynomials.

Parameters
pOtherother polynomial to compute the cross product with.
Returns
a new polynomial defining the cross product between this and pother

◆ cross() [2/2]

polynomial_t ndcurves::polynomial::cross ( const polynomial_t::point_t point) const
inline

Compute the cross product of the current polynomial p by a point point. The cross product pXpoint of is defined such that forall t, pXpoint(t) = p(t) X point, with X designing the cross product. This method of course only makes sense for dimension 3 polynomials.

Parameters
pointpoint to compute the cross product with.
Returns
a new polynomial defining the cross product between this and point

◆ degree()

virtual std::size_t ndcurves::polynomial::degree ( ) const
inlinevirtual

Get the degree of the curve.

Returns
$degree$, the degree of the curve.

◆ derivate()

virtual point_t ndcurves::polynomial::derivate ( const time_t  t,
const std::size_t  order 
) const
inlinevirtual

Evaluation of the derivative of order N of spline at time t.

Parameters
t: the time when to evaluate the spline.
order: order of derivative.
Returns
$\frac{d^Nx(t)}{dt^N}$ point corresponding on derivative spline at time t.

◆ dim()

virtual std::size_t ndcurves::polynomial::dim ( ) const
inlinevirtual

Get dimension of curve.

Returns
dimension of curve.

◆ isApprox() [1/2]

virtual bool ndcurves::polynomial::isApprox ( const curve_abc_t other,
const Numeric  prec = Eigen::NumTraits<Numeric>::dummy_precision() 
) const
inlinevirtual

◆ isApprox() [2/2]

bool ndcurves::polynomial::isApprox ( const polynomial_t other,
const Numeric  prec = Eigen::NumTraits<Numeric>::dummy_precision() 
) const
inline

isApprox check if other and *this are approximately equals. Only two curves of the same class can be approximately equals, for comparison between different type of curves see isEquivalent

Parameters
otherthe other curve to check
precthe precision threshold, default Eigen::NumTraits<Numeric>::dummy_precision()
Returns
true is the two curves are approximately equals

◆ max()

virtual num_t ndcurves::polynomial::max ( ) const
inlinevirtual

Get the maximum time for which the curve is defined.

Returns
$t_{max}$ upper bound of time range.

◆ min()

virtual num_t ndcurves::polynomial::min ( ) const
inlinevirtual

Get the minimum time for which the curve is defined.

Returns
$t_{min}$ lower bound of time range.

◆ MinimumJerk() [1/2]

static polynomial_t ndcurves::polynomial::MinimumJerk ( const point_t p_init,
const point_t p_final,
const time_t  t_min = 0.,
const time_t  t_max = 1. 
)
inlinestatic

MinimumJerk Build a polynomial curve connecting p_init to p_final minimizing the time integral of the squared jerk with a zero initial and final velocity and acceleration.

Parameters
p_initthe initial point
p_finalthe final point
t_mininitial time
t_maxfinal time
Returns
the polynomial curve

◆ MinimumJerk() [2/2]

static void ndcurves::polynomial::MinimumJerk ( polynomial_t out,
const point_t p_init,
const point_t p_final,
const time_t  t_min = 0.,
const time_t  t_max = 1. 
)
inlinestatic

MinimumJerk Build a polynomial curve connecting p_init to p_final minimizing the time integral of the squared jerk with a zero initial and final velocity and acceleration.

Parameters
outThe output polynomial needs to be of the correct size.
p_initthe initial point
p_finalthe final point
t_mininitial time
t_maxfinal time
Returns
the polynomial curve

◆ operator!=()

virtual bool ndcurves::polynomial::operator!= ( const polynomial_t other) const
inlinevirtual

◆ operator()()

virtual point_t ndcurves::polynomial::operator() ( const time_t  t) const
inlinevirtual

Evaluation of the cubic spline at time t using horner's scheme.

Parameters
t: time when to evaluate the spline.
Returns
$x(t)$ point corresponding on spline at time t.

◆ operator*=()

polynomial_t& ndcurves::polynomial::operator*= ( const double  d)
inline

◆ operator+=() [1/2]

polynomial_t& ndcurves::polynomial::operator+= ( const polynomial_t p1)
inline

◆ operator+=() [2/2]

polynomial_t& ndcurves::polynomial::operator+= ( const polynomial_t::point_t point)
inline

◆ operator-=() [1/2]

polynomial_t& ndcurves::polynomial::operator-= ( const polynomial_t p1)
inline

◆ operator-=() [2/2]

polynomial_t& ndcurves::polynomial::operator-= ( const polynomial_t::point_t point)
inline

◆ operator/=()

polynomial_t& ndcurves::polynomial::operator/= ( const double  d)
inline

◆ operator==()

virtual bool ndcurves::polynomial::operator== ( const polynomial_t other) const
inlinevirtual

◆ serialize()

template<class Archive >
void ndcurves::polynomial::serialize ( Archive &  ar,
const unsigned int  version 
)
inline

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Member Data Documentation

◆ coefficients_

coeff_t ndcurves::polynomial::coefficients_

◆ degree_

std::size_t ndcurves::polynomial::degree_

◆ dim_

std::size_t ndcurves::polynomial::dim_

◆ T_max_

time_t ndcurves::polynomial::T_max_

◆ T_min_

time_t ndcurves::polynomial::T_min_

The documentation for this class was generated from the following files: