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

#include <PolynomialSplineContainer.hpp>

Public Types

using SplineType = PolynomialSpline< splineOrder_ >
 
using SplineList = std::vector< SplineType >
 

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW PolynomialSplineContainer ()
 
virtual ~PolynomialSplineContainer ()=default
 
SplineTypegetSpline (int splineIndex)
 Get a pointer to the spline with a given index. More...
 
const SplineListgetSplines () const
 Get a reference to the spline with a given index. More...
 
bool advance (double dt)
 Update the spline internal time by dt [seconds]. More...
 
void setContainerTime (double t)
 Jump to a specific point in time domain. More...
 
template<typename SplineType_ >
bool addSpline (SplineType_ &&spline)
 Add a spline to the container. More...
 
bool reserveSplines (const unsigned int numSplines)
 Reserve memory for the spline container. More...
 
bool reset ()
 Clear spline container. More...
 
bool resetTime ()
 Set container. More...
 
double getContainerDuration () const
 Get total trajectory duration. More...
 
double getContainerTime () const
 Get currently active time point. More...
 
bool isEmpty () const
 True if splines are empty. More...
 
double getPosition () const
 Get the position evaluated at the internal time. More...
 
double getVelocity () const
 Get the velocity evaluated at the internal time. More...
 
double getAcceleration () const
 Get the acceleration evaluated at the internal time. More...
 
int getActiveSplineIndexAtTime (double t, double &timeOffset) const
 
int getActiveSplineIndex () const
 Return spline index at current time validity. More...
 
double getPositionAtTime (double t) const
 Get position at time t[seconds];. More...
 
double getVelocityAtTime (double t) const
 Get velocity at time t[seconds];. More...
 
double getAccelerationAtTime (double t) const
 Get acceleration at time t[seconds];. More...
 
double getEndPosition () const
 Get position at the end of the spline. More...
 
double getEndVelocity () const
 Get velocity at the end of the spline. More...
 
double getEndAcceleration () const
 Get acceleration at the end of the spline. More...
 
bool setData (const std::vector< double > &knotDurations, const std::vector< double > &knotPositions, double initialVelocity, double initialAcceleration, double finalVelocity, double finalAcceleration)
 
bool setData (const std::vector< double > &knotDurations, const std::vector< double > &knotPositions, double initialVelocity, double finalVelocity)
 
virtual bool setData (const std::vector< double > &knotDurations, const std::vector< double > &knotPositions)
 

Static Public Attributes

static constexpr double undefinedValue = std::numeric_limits<double>::quiet_NaN()
 

Protected Member Functions

int getCoeffIndex (const int splineIdx, const int aIdx) const
 
int getSplineColumnIndex (const int splineIdx) const
 
void addInitialConditions (const Eigen::VectorXd &initialConditions, unsigned int &constraintIdx)
 
void addFinalConditions (const Eigen::VectorXd &finalConditions, unsigned int &constraintIdx, const double lastSplineDuration, const unsigned int lastSplineId)
 
void addJunctionsConditions (const std::vector< double > &splineDurations, const std::vector< double > &knotPositions, unsigned int &constraintIdx, const unsigned int num_junctions)
 
bool extractSplineCoefficients (const Eigen::VectorXd &coeffs, const std::vector< double > &splineDurations, const unsigned int num_splines)
 

Protected Attributes

SplineList splines_
 Conjunction of smoothly interconnected splines. More...
 
double timeOffset_
 Helper variable. More...
 
double containerTime_
 Current time of spline conjunction. More...
 
double containerDuration_
 Total duration of spline conjunction. More...
 
int activeSplineIdx_
 Spline index currently active. More...
 
Eigen::MatrixXd equalityConstraintJacobian_
 Equality matrix of quadratic program (A in Ax=b). More...
 
Eigen::VectorXd equalityConstraintTargetValues_
 Equality target values of quatratic program (b in Ax=b). More...
 

Detailed Description

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

Definition at line 26 of file PolynomialSplineContainer.hpp.

Member Typedef Documentation

template<int splineOrder_>
using curves::PolynomialSplineContainer< splineOrder_ >::SplineList = std::vector<SplineType>

Definition at line 29 of file PolynomialSplineContainer.hpp.

template<int splineOrder_>
using curves::PolynomialSplineContainer< splineOrder_ >::SplineType = PolynomialSpline<splineOrder_>

Definition at line 28 of file PolynomialSplineContainer.hpp.

Constructor & Destructor Documentation

template<int splineOrder_>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW curves::PolynomialSplineContainer< splineOrder_ >::PolynomialSplineContainer ( )
template<int splineOrder_>
virtual curves::PolynomialSplineContainer< splineOrder_ >::~PolynomialSplineContainer ( )
virtualdefault

Member Function Documentation

template<int splineOrder_>
void curves::PolynomialSplineContainer< splineOrder_ >::addFinalConditions ( const Eigen::VectorXd &  finalConditions,
unsigned int &  constraintIdx,
const double  lastSplineDuration,
const unsigned int  lastSplineId 
)
protected
template<int splineOrder_>
void curves::PolynomialSplineContainer< splineOrder_ >::addInitialConditions ( const Eigen::VectorXd &  initialConditions,
unsigned int &  constraintIdx 
)
protected
template<int splineOrder_>
void curves::PolynomialSplineContainer< splineOrder_ >::addJunctionsConditions ( const std::vector< double > &  splineDurations,
const std::vector< double > &  knotPositions,
unsigned int &  constraintIdx,
const unsigned int  num_junctions 
)
protected
template<int splineOrder_>
template<typename SplineType_ >
bool curves::PolynomialSplineContainer< splineOrder_ >::addSpline ( SplineType_ &&  spline)
inline

Add a spline to the container.

Definition at line 50 of file PolynomialSplineContainer.hpp.

template<int splineOrder_>
bool curves::PolynomialSplineContainer< splineOrder_ >::advance ( double  dt)

Update the spline internal time by dt [seconds].

template<int splineOrder_>
bool curves::PolynomialSplineContainer< splineOrder_ >::extractSplineCoefficients ( const Eigen::VectorXd &  coeffs,
const std::vector< double > &  splineDurations,
const unsigned int  num_splines 
)
protected
template<int splineOrder_>
double curves::PolynomialSplineContainer< splineOrder_ >::getAcceleration ( ) const

Get the acceleration evaluated at the internal time.

template<int splineOrder_>
double curves::PolynomialSplineContainer< splineOrder_ >::getAccelerationAtTime ( double  t) const

Get acceleration at time t[seconds];.

template<int splineOrder_>
int curves::PolynomialSplineContainer< splineOrder_ >::getActiveSplineIndex ( ) const

Return spline index at current time validity.

template<int splineOrder_>
int curves::PolynomialSplineContainer< splineOrder_ >::getActiveSplineIndexAtTime ( double  t,
double &  timeOffset 
) const

Get the index of the spline active at time t [seconds]. Update timeOffset with the duration of the container at the beginning of the active spline.

template<int splineOrder_>
int curves::PolynomialSplineContainer< splineOrder_ >::getCoeffIndex ( const int  splineIdx,
const int  aIdx 
) const
inlineprotected

aijh: i –> spline id (1,...,n) j –> spline coefficient aj (a5,...,a1,a0) h –> dimX, dimY

Coefficient vector is: q = [a15x a14x ... a10x a15y ... a10y a25x ... a20y ... an5x ... an0y]

Definition at line 148 of file PolynomialSplineContainer.hpp.

template<int splineOrder_>
double curves::PolynomialSplineContainer< splineOrder_ >::getContainerDuration ( ) const

Get total trajectory duration.

template<int splineOrder_>
double curves::PolynomialSplineContainer< splineOrder_ >::getContainerTime ( ) const

Get currently active time point.

template<int splineOrder_>
double curves::PolynomialSplineContainer< splineOrder_ >::getEndAcceleration ( ) const

Get acceleration at the end of the spline.

template<int splineOrder_>
double curves::PolynomialSplineContainer< splineOrder_ >::getEndPosition ( ) const

Get position at the end of the spline.

template<int splineOrder_>
double curves::PolynomialSplineContainer< splineOrder_ >::getEndVelocity ( ) const

Get velocity at the end of the spline.

template<int splineOrder_>
double curves::PolynomialSplineContainer< splineOrder_ >::getPosition ( ) const

Get the position evaluated at the internal time.

template<int splineOrder_>
double curves::PolynomialSplineContainer< splineOrder_ >::getPositionAtTime ( double  t) const

Get position at time t[seconds];.

template<int splineOrder_>
SplineType* curves::PolynomialSplineContainer< splineOrder_ >::getSpline ( int  splineIndex)

Get a pointer to the spline with a given index.

template<int splineOrder_>
int curves::PolynomialSplineContainer< splineOrder_ >::getSplineColumnIndex ( const int  splineIdx) const
inlineprotected

Definition at line 152 of file PolynomialSplineContainer.hpp.

template<int splineOrder_>
const SplineList& curves::PolynomialSplineContainer< splineOrder_ >::getSplines ( ) const

Get a reference to the spline with a given index.

template<int splineOrder_>
double curves::PolynomialSplineContainer< splineOrder_ >::getVelocity ( ) const

Get the velocity evaluated at the internal time.

template<int splineOrder_>
double curves::PolynomialSplineContainer< splineOrder_ >::getVelocityAtTime ( double  t) const

Get velocity at time t[seconds];.

template<int splineOrder_>
bool curves::PolynomialSplineContainer< splineOrder_ >::isEmpty ( ) const

True if splines are empty.

template<int splineOrder_>
bool curves::PolynomialSplineContainer< splineOrder_ >::reserveSplines ( const unsigned int  numSplines)

Reserve memory for the spline container.

template<int splineOrder_>
bool curves::PolynomialSplineContainer< splineOrder_ >::reset ( )

Clear spline container.

template<int splineOrder_>
bool curves::PolynomialSplineContainer< splineOrder_ >::resetTime ( )

Set container.

template<int splineOrder_>
void curves::PolynomialSplineContainer< splineOrder_ >::setContainerTime ( double  t)

Jump to a specific point in time domain.

template<int splineOrder_>
bool curves::PolynomialSplineContainer< splineOrder_ >::setData ( const std::vector< double > &  knotDurations,
const std::vector< double > &  knotPositions,
double  initialVelocity,
double  initialAcceleration,
double  finalVelocity,
double  finalAcceleration 
)

Minimize spline coefficients s.t. position, velocity and acceleration constraints are satisfied (i.e., s.t. the spline conjunction is smooth up the second derivative).

template<int splineOrder_>
bool curves::PolynomialSplineContainer< splineOrder_ >::setData ( const std::vector< double > &  knotDurations,
const std::vector< double > &  knotPositions,
double  initialVelocity,
double  finalVelocity 
)

Minimize spline coefficients s.t. position and velocity constraints are satisfied (i.e., s.t. the spline conjunction is smooth up the first derivative).

template<int splineOrder_>
virtual bool curves::PolynomialSplineContainer< splineOrder_ >::setData ( const std::vector< double > &  knotDurations,
const std::vector< double > &  knotPositions 
)
virtual

Find linear part of the spline coefficients (a0, a1) s.t. position constraints are satisfied. If the spline order is larger than 1, the remaining spline coefficients are set to zero.

Member Data Documentation

template<int splineOrder_>
int curves::PolynomialSplineContainer< splineOrder_ >::activeSplineIdx_
protected

Spline index currently active.

Definition at line 190 of file PolynomialSplineContainer.hpp.

template<int splineOrder_>
double curves::PolynomialSplineContainer< splineOrder_ >::containerDuration_
protected

Total duration of spline conjunction.

Definition at line 187 of file PolynomialSplineContainer.hpp.

template<int splineOrder_>
double curves::PolynomialSplineContainer< splineOrder_ >::containerTime_
protected

Current time of spline conjunction.

Definition at line 184 of file PolynomialSplineContainer.hpp.

template<int splineOrder_>
Eigen::MatrixXd curves::PolynomialSplineContainer< splineOrder_ >::equalityConstraintJacobian_
protected

Equality matrix of quadratic program (A in Ax=b).

Definition at line 193 of file PolynomialSplineContainer.hpp.

template<int splineOrder_>
Eigen::VectorXd curves::PolynomialSplineContainer< splineOrder_ >::equalityConstraintTargetValues_
protected

Equality target values of quatratic program (b in Ax=b).

Definition at line 196 of file PolynomialSplineContainer.hpp.

template<int splineOrder_>
SplineList curves::PolynomialSplineContainer< splineOrder_ >::splines_
protected

Conjunction of smoothly interconnected splines.

Definition at line 178 of file PolynomialSplineContainer.hpp.

template<int splineOrder_>
double curves::PolynomialSplineContainer< splineOrder_ >::timeOffset_
protected

Helper variable.

Definition at line 181 of file PolynomialSplineContainer.hpp.

template<int splineOrder_>
constexpr double curves::PolynomialSplineContainer< splineOrder_ >::undefinedValue = std::numeric_limits<double>::quiet_NaN()
static

Definition at line 136 of file PolynomialSplineContainer.hpp.


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