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/polynomial.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_t > | coeff_t_ref |
typedef polynomial< Time, Numeric, Safe, Point, T_Point > | polynomial_t |
typedef curve_abc_t::curve_ptr_t | curve_ptr_t |
![]() | |
typedef Point | point_t |
typedef Point_derivate | point_derivate_t |
typedef Time | time_t |
typedef Numeric | num_t |
typedef curve_abc< Time, Numeric, Safe, point_t, point_derivate_t > | curve_t |
typedef curve_abc< Time, Numeric, Safe, point_derivate_t > | curve_derivate_t |
typedef std::shared_ptr< curve_t > | curve_ptr_t |
Public Member Functions | |
polynomial () | |
Empty constructor. Curve obtained this way can not perform other class functions. | |
polynomial (const coeff_t &coefficients, const time_t min, const time_t max) | |
Constructor. | |
polynomial (const T_Point &coefficients, const time_t min, const time_t max) | |
Constructor. | |
template<typename In > | |
polynomial (In zeroOrderCoefficient, In out, const time_t min, const time_t max) | |
Constructor. | |
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) | |
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) | |
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) | |
virtual | ~polynomial () |
Destructor. | |
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. | |
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 | |
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. | |
polynomial_t | compute_derivate (const std::size_t order) const |
polynomial_t * | compute_derivate_ptr (const std::size_t order) const |
Compute the derived curve at order N. | |
Eigen::MatrixXd | coeff () const |
point_t | coeffAtDegree (const std::size_t degree) const |
virtual std::size_t | dim () const |
Get dimension of curve. | |
virtual num_t | min () const |
Get the minimum time for which the curve is defined. | |
virtual num_t | max () const |
Get the maximum time for which the curve is defined. | |
virtual std::size_t | degree () const |
Get the degree of the curve. | |
polynomial_t & | operator+= (const polynomial_t &p1) |
polynomial_t & | operator-= (const polynomial_t &p1) |
polynomial_t & | operator+= (const polynomial_t::point_t &point) |
polynomial_t & | operator-= (const polynomial_t::point_t &point) |
polynomial_t & | operator/= (const double d) |
polynomial_t & | operator*= (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. | |
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. | |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
![]() | |
curve_abc () | |
Constructor. | |
virtual | ~curve_abc () |
Destructor. | |
bool | isEquivalent (const curve_t *other, const Numeric prec=Eigen::NumTraits< Numeric >::dummy_precision(), const size_t order=5) const |
isEquivalent check if other and *this are approximately equal by values, given a precision threshold. This test is done by discretizing both curves and evaluating them and their derivatives. | |
virtual bool | isApprox (const curve_t *other, const Numeric prec=Eigen::NumTraits< Numeric >::dummy_precision()) const =0 |
isApprox check if other and *this are approximately equal given a precision threshold Only two curves of the same class can be approximately equal, for comparison between different type of curves see isEquivalent. | |
std::pair< time_t, time_t > | timeRange () |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
![]() | |
template<class Derived > | |
void | loadFromText (const std::string &filename) |
Loads a Derived object from a text file. | |
template<class Derived > | |
void | saveAsText (const std::string &filename) const |
Saved a Derived object as a text file. | |
template<class Derived > | |
void | loadFromXML (const std::string &filename, const std::string &tag_name) |
Loads a Derived object from an XML file. | |
template<class Derived > | |
void | saveAsXML (const std::string &filename, const std::string &tag_name) const |
Saved a Derived object as an XML file. | |
template<class Derived > | |
void | loadFromBinary (const std::string &filename) |
Loads a Derived object from an binary file. | |
template<class Derived > | |
void | saveAsBinary (const std::string &filename) const |
Saved a Derived object as an binary file. | |
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. | |
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. | |
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 |
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}] \).
typedef Eigen::MatrixXd ndcurves::polynomial< Time, Numeric, Safe, Point, T_Point >::coeff_t |
typedef Eigen::Ref<coeff_t> ndcurves::polynomial< Time, Numeric, Safe, Point, T_Point >::coeff_t_ref |
typedef curve_abc<Time, Numeric, Safe, Point> ndcurves::polynomial< Time, Numeric, Safe, Point, T_Point >::curve_abc_t |
typedef curve_abc_t::curve_ptr_t ndcurves::polynomial< Time, Numeric, Safe, Point, T_Point >::curve_ptr_t |
typedef Numeric ndcurves::polynomial< Time, Numeric, Safe, Point, T_Point >::num_t |
typedef Point ndcurves::polynomial< Time, Numeric, Safe, Point, T_Point >::point_t |
typedef polynomial<Time, Numeric, Safe, Point, T_Point> ndcurves::polynomial< Time, Numeric, Safe, Point, T_Point >::polynomial_t |
typedef T_Point ndcurves::polynomial< Time, Numeric, Safe, Point, T_Point >::t_point_t |
typedef Time ndcurves::polynomial< Time, Numeric, Safe, Point, T_Point >::time_t |
|
inline |
Empty constructor. Curve obtained this way can not perform other class functions.
|
inline |
Constructor.
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. |
|
inline |
Constructor.
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. |
|
inline |
Constructor.
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. |
|
inline |
Constructor from boundary condition with C0 : create a polynomial that connect exactly init and end (order 1)
init | the initial point of the curve |
end | the final point of the curve |
min | : LOWER bound on interval definition of the spline. |
max | : UPPER bound on interval definition of the spline. |
|
inline |
Constructor from boundary condition with C1 : create a polynomial that connect exactly init and end and thier first order derivatives(order 3)
init | the initial point of the curve |
d_init | the initial value of the derivative of the curve |
end | the final point of the curve |
d_end | the 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. |
|
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)
init | the initial point of the curve |
d_init | the initial value of the derivative of the curve |
d_init | the initial value of the second derivative of the curve |
end | the final point of the curve |
d_end | the final value of the derivative of the curve |
d_end | the 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. |
|
inlinevirtual |
Destructor.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
Compute the derived curve at order N.
order | : order of derivative. |
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
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.
pOther | other polynomial to compute the cross product with. |
|
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.
point | point to compute the cross product with. |
|
inlinevirtual |
Get the degree of the curve.
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
inlinevirtual |
Evaluation of the derivative of order N of spline at time t.
t | : the time when to evaluate the spline. |
order | : order of derivative. |
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
inlinevirtual |
Get dimension of curve.
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
inlinevirtual |
|
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
other | the other curve to check |
prec | the precision threshold, default Eigen::NumTraits<Numeric>::dummy_precision() |
|
inlinevirtual |
Get the maximum time for which the curve is defined.
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
inlinevirtual |
Get the minimum time for which the curve is defined.
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
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.
p_init | the initial point |
p_final | the final point |
t_min | initial time |
t_max | final time |
|
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.
out | The output polynomial needs to be of the correct size. |
p_init | the initial point |
p_final | the final point |
t_min | initial time |
t_max | final time |
|
inlinevirtual |
|
inlinevirtual |
Evaluation of the cubic spline at time t using horner's scheme.
t | : time when to evaluate the spline. |
Implements ndcurves::curve_abc< Time, Numeric, Safe, Point, Point_derivate >.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
|
inline |
|
friend |
coeff_t ndcurves::polynomial< Time, Numeric, Safe, Point, T_Point >::coefficients_ |
std::size_t ndcurves::polynomial< Time, Numeric, Safe, Point, T_Point >::degree_ |
std::size_t ndcurves::polynomial< Time, Numeric, Safe, Point, T_Point >::dim_ |
time_t ndcurves::polynomial< Time, Numeric, Safe, Point, T_Point >::T_max_ |
time_t ndcurves::polynomial< Time, Numeric, Safe, Point, T_Point >::T_min_ |