Curves
A library for curves generation.
curves::PolynomialSpline< splineOrder_ > Class Template Reference

#include <PolynomialSpline.hpp>

Public Types

using SplineImplementation = spline_traits::spline_rep< double, splineOrder >
 
using SplineCoefficients = typename SplineImplementation::SplineCoefficients
 
using EigenTimeVectorType = Eigen::Matrix< double, 1, coefficientCount >
 
using EigenCoefficientVectorType = Eigen::Matrix< double, coefficientCount, 1 >
 

Public Member Functions

 PolynomialSpline ()
 
template<typename SplineCoeff_ >
 PolynomialSpline (SplineCoeff_ &&coefficients, double duration)
 
 PolynomialSpline (const SplineOptions &options)
 
 PolynomialSpline (SplineOptions &&options)
 
virtual ~PolynomialSpline ()=default
 
 PolynomialSpline (PolynomialSpline &&)=default
 
PolynomialSplineoperator= (PolynomialSpline &&)=default
 
 PolynomialSpline (const PolynomialSpline &)=default
 
PolynomialSplineoperator= (const PolynomialSpline &)=default
 
const SplineCoefficientsgetCoefficients () const
 Get the coefficients of the spline. More...
 
template<typename SplineOptionsType_ >
bool computeCoefficients (SplineOptionsType_ &&options)
 Compute the coefficients of the spline. More...
 
void setCoefficientsAndDuration (const SplineCoefficients &coefficients, double duration)
 Set the coefficients and the duration of the spline. More...
 
constexpr double getPositionAtTime (double tk) const
 Get the spline evaluated at time tk. More...
 
constexpr double getVelocityAtTime (double tk) const
 Get the first derivative of the spline evaluated at time tk. More...
 
constexpr double getAccelerationAtTime (double tk) const
 Get the second derivative of the spline evaluated at time tk. More...
 
double getSplineDuration () const
 Get the duration of the spline in seconds. More...
 

Static Public Member Functions

static void getTimeVector (Eigen::Ref< EigenTimeVectorType > timeVec, const double tk)
 Get the time vector evaluated at time tk. More...
 
template<typename Derived >
static void getTimeVector (Eigen::MatrixBase< Derived > const &timeVec, const double tk)
 Get the time vector evaluated at time tk. More...
 
template<typename Derived >
static void addTimeVector (Eigen::MatrixBase< Derived > const &timeVec, const double tk)
 Get the time vector evaluated at time tk and add it to the input vector. More...
 
static void getDTimeVector (Eigen::Ref< EigenTimeVectorType > dtimeVec, const double tk)
 Get the first derivative of the time vector evaluated at time tk. More...
 
template<typename Derived >
static void getDiffTimeVector (Eigen::MatrixBase< Derived > const &dtimeVec, const double tk)
 Get the first derivative of the time vector evaluated at time tk. More...
 
template<typename Derived >
static void addDiffTimeVector (Eigen::MatrixBase< Derived > const &dtimeVec, const double tk)
 Get the first derivative of the time vector evaluated at time tk and add it to the input vector. More...
 
static void getDDTimeVector (Eigen::Ref< EigenTimeVectorType > ddtimeVec, const double tk)
 Get the second derivative of the time vector evaluated at time tk. More...
 
template<typename Derived >
static void getDDiffTimeVector (Eigen::MatrixBase< Derived > const &ddtimeVec, const double tk)
 Get the second derivative of the time vector evaluated at time tk. More...
 
template<typename Derived >
static void addDDiffTimeVector (Eigen::MatrixBase< Derived > const &ddtimeVec, const double tk)
 Get the second derivative of the time vector evaluated at time tk and add it to the input vector. More...
 
static void getTimeVectorAtZero (Eigen::Ref< EigenTimeVectorType > timeVec)
 Get the time vector evaluated at zero. More...
 
template<typename Derived >
static void getTimeVectorAtZero (Eigen::MatrixBase< Derived > const &timeVec)
 Get the time vector evaluated at zero. More...
 
template<typename Derived >
static void addTimeVectorAtZero (Eigen::MatrixBase< Derived > const &timeVec)
 Get the time vector evaluated at zero. More...
 
static void getDTimeVectorAtZero (Eigen::Ref< EigenTimeVectorType > dtimeVec)
 Get the first derivative of the time vector evaluated at zero. More...
 
template<typename Derived >
static void getDiffTimeVectorAtZero (Eigen::MatrixBase< Derived > const &dtimeVec)
 Get the time vector evaluated at zero. More...
 
template<typename Derived >
static void addDiffTimeVectorAtZero (Eigen::MatrixBase< Derived > const &dtimeVec)
 Get the time vector evaluated at zero. More...
 
static void getDDTimeVectorAtZero (Eigen::Ref< EigenTimeVectorType > ddtimeVec)
 Get the second derivative of the time vector evaluated at zero. More...
 
template<typename Derived >
static void getDDiffTimeVectorAtZero (Eigen::MatrixBase< Derived > const &ddtimeVec)
 Get the time vector evaluated at zero. More...
 
template<typename Derived >
static void addDDiffTimeVectorAtZero (Eigen::MatrixBase< Derived > const &ddtimeVec)
 Get the time vector evaluated at zero. More...
 

Static Public Attributes

static constexpr unsigned int splineOrder = splineOrder_
 
static constexpr unsigned int coefficientCount = splineOrder + 1
 

Protected Attributes

double duration_
 The duration of the spline in seconds. More...
 
bool didEvaluateCoeffs_
 True if the coefficents were computed at least once. More...
 
SplineCoefficients coefficients_
 

Detailed Description

template<int splineOrder_>
class curves::PolynomialSpline< splineOrder_ >

This class is the implementation of a scalar polynomial spline s(t) function of a scalar t. The spline is define as s(t) = an*t^n + ... + a1*t + a0 = sum(ai*t^i)

The spline coefficients are stored in a standard container as alpha = [an ... a1 a0]^T

The spline can also be evaluated as: s(t) = tau^T * alpha

where the vector tau (referred to as time vector in the comments) is define as tau = [t^n ... t^2 t 1]^T

Definition at line 36 of file PolynomialSpline.hpp.

Member Typedef Documentation

template<int splineOrder_>
using curves::PolynomialSpline< splineOrder_ >::EigenCoefficientVectorType = Eigen::Matrix<double, coefficientCount, 1>

Definition at line 45 of file PolynomialSpline.hpp.

template<int splineOrder_>
using curves::PolynomialSpline< splineOrder_ >::EigenTimeVectorType = Eigen::Matrix<double, 1, coefficientCount>

Definition at line 44 of file PolynomialSpline.hpp.

template<int splineOrder_>
using curves::PolynomialSpline< splineOrder_ >::SplineCoefficients = typename SplineImplementation::SplineCoefficients

Definition at line 43 of file PolynomialSpline.hpp.

template<int splineOrder_>
using curves::PolynomialSpline< splineOrder_ >::SplineImplementation = spline_traits::spline_rep<double, splineOrder>

Definition at line 42 of file PolynomialSpline.hpp.

Constructor & Destructor Documentation

template<int splineOrder_>
curves::PolynomialSpline< splineOrder_ >::PolynomialSpline ( )
inline

Definition at line 47 of file PolynomialSpline.hpp.

template<int splineOrder_>
template<typename SplineCoeff_ >
curves::PolynomialSpline< splineOrder_ >::PolynomialSpline ( SplineCoeff_ &&  coefficients,
double  duration 
)
inline

Definition at line 56 of file PolynomialSpline.hpp.

template<int splineOrder_>
curves::PolynomialSpline< splineOrder_ >::PolynomialSpline ( const SplineOptions options)
inlineexplicit

Definition at line 64 of file PolynomialSpline.hpp.

template<int splineOrder_>
curves::PolynomialSpline< splineOrder_ >::PolynomialSpline ( SplineOptions &&  options)
inlineexplicit

Definition at line 68 of file PolynomialSpline.hpp.

template<int splineOrder_>
virtual curves::PolynomialSpline< splineOrder_ >::~PolynomialSpline ( )
virtualdefault
template<int splineOrder_>
curves::PolynomialSpline< splineOrder_ >::PolynomialSpline ( PolynomialSpline< splineOrder_ > &&  )
default
template<int splineOrder_>
curves::PolynomialSpline< splineOrder_ >::PolynomialSpline ( const PolynomialSpline< splineOrder_ > &  )
default

Member Function Documentation

template<int splineOrder_>
template<typename Derived >
static void curves::PolynomialSpline< splineOrder_ >::addDDiffTimeVector ( Eigen::MatrixBase< Derived > const &  ddtimeVec,
const double  tk 
)
inlinestatic

Get the second derivative of the time vector evaluated at time tk and add it to the input vector.

Definition at line 191 of file PolynomialSpline.hpp.

template<int splineOrder_>
template<typename Derived >
static void curves::PolynomialSpline< splineOrder_ >::addDDiffTimeVectorAtZero ( Eigen::MatrixBase< Derived > const &  ddtimeVec)
inlinestatic

Get the time vector evaluated at zero.

Definition at line 277 of file PolynomialSpline.hpp.

template<int splineOrder_>
template<typename Derived >
static void curves::PolynomialSpline< splineOrder_ >::addDiffTimeVector ( Eigen::MatrixBase< Derived > const &  dtimeVec,
const double  tk 
)
inlinestatic

Get the first derivative of the time vector evaluated at time tk and add it to the input vector.

Definition at line 164 of file PolynomialSpline.hpp.

template<int splineOrder_>
template<typename Derived >
static void curves::PolynomialSpline< splineOrder_ >::addDiffTimeVectorAtZero ( Eigen::MatrixBase< Derived > const &  dtimeVec)
inlinestatic

Get the time vector evaluated at zero.

Definition at line 249 of file PolynomialSpline.hpp.

template<int splineOrder_>
template<typename Derived >
static void curves::PolynomialSpline< splineOrder_ >::addTimeVector ( Eigen::MatrixBase< Derived > const &  timeVec,
const double  tk 
)
inlinestatic

Get the time vector evaluated at time tk and add it to the input vector.

Definition at line 136 of file PolynomialSpline.hpp.

template<int splineOrder_>
template<typename Derived >
static void curves::PolynomialSpline< splineOrder_ >::addTimeVectorAtZero ( Eigen::MatrixBase< Derived > const &  timeVec)
inlinestatic

Get the time vector evaluated at zero.

Definition at line 219 of file PolynomialSpline.hpp.

template<int splineOrder_>
template<typename SplineOptionsType_ >
bool curves::PolynomialSpline< splineOrder_ >::computeCoefficients ( SplineOptionsType_ &&  options)
inline

Compute the coefficients of the spline.

Definition at line 87 of file PolynomialSpline.hpp.

template<int splineOrder_>
constexpr double curves::PolynomialSpline< splineOrder_ >::getAccelerationAtTime ( double  tk) const
inline

Get the second derivative of the spline evaluated at time tk.

Definition at line 111 of file PolynomialSpline.hpp.

template<int splineOrder_>
const SplineCoefficients& curves::PolynomialSpline< splineOrder_ >::getCoefficients ( ) const
inline

Get the coefficients of the spline.

Definition at line 81 of file PolynomialSpline.hpp.

template<int splineOrder_>
template<typename Derived >
static void curves::PolynomialSpline< splineOrder_ >::getDDiffTimeVector ( Eigen::MatrixBase< Derived > const &  ddtimeVec,
const double  tk 
)
inlinestatic

Get the second derivative of the time vector evaluated at time tk.

Definition at line 181 of file PolynomialSpline.hpp.

template<int splineOrder_>
template<typename Derived >
static void curves::PolynomialSpline< splineOrder_ >::getDDiffTimeVectorAtZero ( Eigen::MatrixBase< Derived > const &  ddtimeVec)
inlinestatic

Get the time vector evaluated at zero.

Definition at line 266 of file PolynomialSpline.hpp.

template<int splineOrder_>
static void curves::PolynomialSpline< splineOrder_ >::getDDTimeVector ( Eigen::Ref< EigenTimeVectorType ddtimeVec,
const double  tk 
)
inlinestatic

Get the second derivative of the time vector evaluated at time tk.

Definition at line 175 of file PolynomialSpline.hpp.

template<int splineOrder_>
static void curves::PolynomialSpline< splineOrder_ >::getDDTimeVectorAtZero ( Eigen::Ref< EigenTimeVectorType ddtimeVec)
inlinestatic

Get the second derivative of the time vector evaluated at zero.

Definition at line 260 of file PolynomialSpline.hpp.

template<int splineOrder_>
template<typename Derived >
static void curves::PolynomialSpline< splineOrder_ >::getDiffTimeVector ( Eigen::MatrixBase< Derived > const &  dtimeVec,
const double  tk 
)
inlinestatic

Get the first derivative of the time vector evaluated at time tk.

Definition at line 154 of file PolynomialSpline.hpp.

template<int splineOrder_>
template<typename Derived >
static void curves::PolynomialSpline< splineOrder_ >::getDiffTimeVectorAtZero ( Eigen::MatrixBase< Derived > const &  dtimeVec)
inlinestatic

Get the time vector evaluated at zero.

Definition at line 238 of file PolynomialSpline.hpp.

template<int splineOrder_>
static void curves::PolynomialSpline< splineOrder_ >::getDTimeVector ( Eigen::Ref< EigenTimeVectorType dtimeVec,
const double  tk 
)
inlinestatic

Get the first derivative of the time vector evaluated at time tk.

Definition at line 148 of file PolynomialSpline.hpp.

template<int splineOrder_>
static void curves::PolynomialSpline< splineOrder_ >::getDTimeVectorAtZero ( Eigen::Ref< EigenTimeVectorType dtimeVec)
inlinestatic

Get the first derivative of the time vector evaluated at zero.

Definition at line 232 of file PolynomialSpline.hpp.

template<int splineOrder_>
constexpr double curves::PolynomialSpline< splineOrder_ >::getPositionAtTime ( double  tk) const
inline

Get the spline evaluated at time tk.

Definition at line 99 of file PolynomialSpline.hpp.

template<int splineOrder_>
double curves::PolynomialSpline< splineOrder_ >::getSplineDuration ( ) const
inline

Get the duration of the spline in seconds.

Definition at line 287 of file PolynomialSpline.hpp.

template<int splineOrder_>
static void curves::PolynomialSpline< splineOrder_ >::getTimeVector ( Eigen::Ref< EigenTimeVectorType timeVec,
const double  tk 
)
inlinestatic

Get the time vector evaluated at time tk.

Definition at line 120 of file PolynomialSpline.hpp.

template<int splineOrder_>
template<typename Derived >
static void curves::PolynomialSpline< splineOrder_ >::getTimeVector ( Eigen::MatrixBase< Derived > const &  timeVec,
const double  tk 
)
inlinestatic

Get the time vector evaluated at time tk.

Definition at line 126 of file PolynomialSpline.hpp.

template<int splineOrder_>
static void curves::PolynomialSpline< splineOrder_ >::getTimeVectorAtZero ( Eigen::Ref< EigenTimeVectorType timeVec)
inlinestatic

Get the time vector evaluated at zero.

Definition at line 202 of file PolynomialSpline.hpp.

template<int splineOrder_>
template<typename Derived >
static void curves::PolynomialSpline< splineOrder_ >::getTimeVectorAtZero ( Eigen::MatrixBase< Derived > const &  timeVec)
inlinestatic

Get the time vector evaluated at zero.

Definition at line 208 of file PolynomialSpline.hpp.

template<int splineOrder_>
constexpr double curves::PolynomialSpline< splineOrder_ >::getVelocityAtTime ( double  tk) const
inline

Get the first derivative of the spline evaluated at time tk.

Definition at line 105 of file PolynomialSpline.hpp.

template<int splineOrder_>
PolynomialSpline& curves::PolynomialSpline< splineOrder_ >::operator= ( PolynomialSpline< splineOrder_ > &&  )
default
template<int splineOrder_>
PolynomialSpline& curves::PolynomialSpline< splineOrder_ >::operator= ( const PolynomialSpline< splineOrder_ > &  )
default
template<int splineOrder_>
void curves::PolynomialSpline< splineOrder_ >::setCoefficientsAndDuration ( const SplineCoefficients coefficients,
double  duration 
)
inline

Set the coefficients and the duration of the spline.

Definition at line 93 of file PolynomialSpline.hpp.

Member Data Documentation

template<int splineOrder_>
constexpr unsigned int curves::PolynomialSpline< splineOrder_ >::coefficientCount = splineOrder + 1
static

Definition at line 40 of file PolynomialSpline.hpp.

template<int splineOrder_>
SplineCoefficients curves::PolynomialSpline< splineOrder_ >::coefficients_
protected

Definition at line 302 of file PolynomialSpline.hpp.

template<int splineOrder_>
bool curves::PolynomialSpline< splineOrder_ >::didEvaluateCoeffs_
protected

True if the coefficents were computed at least once.

Definition at line 296 of file PolynomialSpline.hpp.

template<int splineOrder_>
double curves::PolynomialSpline< splineOrder_ >::duration_
protected

The duration of the spline in seconds.

Definition at line 293 of file PolynomialSpline.hpp.

template<int splineOrder_>
constexpr unsigned int curves::PolynomialSpline< splineOrder_ >::splineOrder = splineOrder_
static

Definition at line 39 of file PolynomialSpline.hpp.


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