curves::bezier_curve< Time, Numeric, Safe, Point > Struct Template Reference

#include <curves/bezier_curve.h>

Inheritance diagram for curves::bezier_curve< Time, Numeric, Safe, Point >:
[legend]
Collaboration diagram for curves::bezier_curve< Time, Numeric, Safe, Point >:
[legend]

Public Types

typedef Point point_t
 
typedef Time time_t
 
typedef Numeric num_t
 
typedef curve_constraints< point_tcurve_constraints_t
 
typedef std::vector< point_t, Eigen::aligned_allocator< point_t > > t_point_t
 
typedef t_point_t::const_iterator cit_point_t
 
typedef bezier_curve< Time, Numeric, Safe, Point > bezier_curve_t
 
- Public Types inherited from curves::curve_abc< Time, Numeric, Safe, Point >
typedef Point point_t
 
typedef Time time_t
 

Public Member Functions

 bezier_curve ()
 Empty constructor. More...
 
template<typename In >
 bezier_curve (In PointsBegin, In PointsEnd, const time_t T_min=0., const time_t T_max=1., const time_t mult_T=1.)
 Constructor. More...
 
template<typename In >
 bezier_curve (In PointsBegin, In PointsEnd, const curve_constraints_t &constraints, const time_t T_min=0., const time_t T_max=1., const time_t mult_T=1.)
 Constructor This constructor will add 4 points (2 after the first one, 2 before the last one) to ensure that velocity and acceleration constraints are respected. More...
 
 bezier_curve (const bezier_curve &other)
 
 ~bezier_curve ()
 Destructor. More...
 
virtual point_t operator() (const time_t t) const
 Evaluation of the bezier curve at time t. More...
 
bezier_curve_t compute_derivate (const std::size_t order) const
 Compute the derived curve at order N. More...
 
bezier_curve_t compute_primitive (const std::size_t order) const
 Compute the primitive of the curve at order N. More...
 
virtual point_t derivate (const time_t t, const std::size_t order) const
 Evaluate the derivative order N of curve at time t. More...
 
point_t evalBernstein (const Numeric t) const
 Evaluate all Bernstein polynomes for a certain degree. More...
 
- Public Member Functions inherited from curves::curve_abc< Time, Numeric, Safe, Point >
 curve_abc ()
 Constructor. More...
 
virtual ~curve_abc ()
 Destructor. More...
 
virtual std::size_t dim () const =0
 Get dimension of curve. More...
 
virtual time_t min () const =0
 Get the minimum time for which the curve is defined. More...
 
virtual time_t max () const =0
 Get the maximum time for which the curve is defined. More...
 
std::pair< time_t, time_ttimeRange ()
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Member Typedef Documentation

◆ bezier_curve_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef bezier_curve<Time, Numeric, Safe, Point> curves::bezier_curve< Time, Numeric, Safe, Point >::bezier_curve_t

◆ cit_point_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef t_point_t::const_iterator curves::bezier_curve< Time, Numeric, Safe, Point >::cit_point_t

◆ curve_constraints_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef curve_constraints<point_t> curves::bezier_curve< Time, Numeric, Safe, Point >::curve_constraints_t

◆ num_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef Numeric curves::bezier_curve< Time, Numeric, Safe, Point >::num_t

◆ point_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef Point curves::bezier_curve< Time, Numeric, Safe, Point >::point_t

◆ t_point_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef std::vector<point_t, Eigen::aligned_allocator<point_t> > curves::bezier_curve< Time, Numeric, Safe, Point >::t_point_t

◆ time_t

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
typedef Time curves::bezier_curve< Time, Numeric, Safe, Point >::time_t

Constructor & Destructor Documentation

◆ bezier_curve() [1/4]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
curves::bezier_curve< Time, Numeric, Safe, Point >::bezier_curve ( )
inline

Empty constructor.

Curve obtained this way can not perform other class functions.

◆ bezier_curve() [2/4]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
template<typename In >
curves::bezier_curve< Time, Numeric, Safe, Point >::bezier_curve ( In  PointsBegin,
In  PointsEnd,
const time_t  T_min = 0.,
const time_t  T_max = 1.,
const time_t  mult_T = 1. 
)
inline

Constructor.

Given the first and last point of a control points set, create the bezier curve.

Parameters
PointsBegin: an iterator pointing to the first element of a control point container.
PointsEnd: an iterator pointing to the last element of a control point container.
T: upper bound of time which is between $[0;T]$ (default $[0;1]$).
mult_T: ... (default value is 1.0).

◆ bezier_curve() [3/4]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
template<typename In >
curves::bezier_curve< Time, Numeric, Safe, Point >::bezier_curve ( In  PointsBegin,
In  PointsEnd,
const curve_constraints_t constraints,
const time_t  T_min = 0.,
const time_t  T_max = 1.,
const time_t  mult_T = 1. 
)
inline

Constructor This constructor will add 4 points (2 after the first one, 2 before the last one) to ensure that velocity and acceleration constraints are respected.

Parameters
PointsBegin: an iterator pointing to the first element of a control point container.
PointsEnd: an iterator pointing to the last element of a control point container.
constraints: constraints applying on start / end velocities and acceleration.

◆ bezier_curve() [4/4]

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
curves::bezier_curve< Time, Numeric, Safe, Point >::bezier_curve ( const bezier_curve< Time, Numeric, Safe, Point > &  other)
inline

◆ ~bezier_curve()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
curves::bezier_curve< Time, Numeric, Safe, Point >::~bezier_curve ( )
inline

Destructor.

Member Function Documentation

◆ compute_derivate()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
bezier_curve_t curves::bezier_curve< Time, Numeric, Safe, Point >::compute_derivate ( const std::size_t  order) const
inline

Compute the derived curve at order N.

Computes the derivative order N, $\frac{d^Nx(t)}{dt^N}$ of bezier curve of parametric equation x(t).

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

Referenced by curves::bezier_curve< Time, Numeric, Safe, Point >::derivate().

◆ compute_primitive()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
bezier_curve_t curves::bezier_curve< Time, Numeric, Safe, Point >::compute_primitive ( const std::size_t  order) const
inline

Compute the primitive of the curve at order N.

Computes the primitive at order N of bezier curve of parametric equation $x(t)$.
At order $N=1$, the primitve $X(t)$ of $x(t)$ is such as $\frac{dX(t)}{dt} = x(t)$.

Parameters
order: order of the primitive.
Returns
primitive at order N of x(t).

References curves::bezier_curve< Time, Numeric, Safe, Point >::compute_primitive().

Referenced by curves::bezier_curve< Time, Numeric, Safe, Point >::compute_primitive().

◆ derivate()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual point_t curves::bezier_curve< Time, Numeric, Safe, Point >::derivate ( const time_t  t,
const std::size_t  order 
) const
inlinevirtual

Evaluate the derivative order N of curve at time t.

If derivative is to be evaluated several times, it is rather recommended to compute derived curve using compute_derivate.

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

Implements curves::curve_abc< Time, Numeric, Safe, Point >.

References curves::bezier_curve< Time, Numeric, Safe, Point >::compute_derivate().

◆ evalBernstein()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
point_t curves::bezier_curve< Time, Numeric, Safe, Point >::evalBernstein ( const Numeric  t) const
inline

Evaluate all Bernstein polynomes for a certain degree.

A bezier curve with N control points is represented by : $x(t) = \sum_{i=0}^{N} B_i^N(t) P_i$ with $ B_i^N(t) = \binom{N}{i}t^i (1-t)^{N-i} $.
Warning: the horner scheme is about 100 times faster than this method.
This method will probably be removed in the future as the computation of bernstein polynomial is very costly.

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

References curves::curve_abc< Time, Numeric, Safe, Point >::dim(), curves::curve_constraints< Point >::end_acc, curves::curve_constraints< Point >::end_vel, curves::curve_constraints< Point >::init_acc, curves::curve_constraints< Point >::init_vel, curves::curve_abc< Time, Numeric, Safe, Point >::max(), curves::curve_abc< Time, Numeric, Safe, Point >::min(), and curves::curve_abc< Time, Numeric, Safe, Point >::serialize().

◆ operator()()

template<typename Time = double, typename Numeric = Time, bool Safe = false, typename Point = Eigen::Matrix<Numeric, Eigen::Dynamic, 1>>
virtual point_t curves::bezier_curve< Time, Numeric, Safe, Point >::operator() ( const time_t  t) const
inlinevirtual

Evaluation of the bezier curve at time t.

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

Implements curves::curve_abc< Time, Numeric, Safe, Point >.