trajectory_collection
Public Member Functions | Protected Attributes | List of all members
TrajColl::BangBangInterpolator< T, U > Class Template Reference

Interpolator with bang-bang control. More...

#include <BangBangInterpolator.h>

Inheritance diagram for TrajColl::BangBangInterpolator< T, U >:
Inheritance graph
[legend]
Collaboration diagram for TrajColl::BangBangInterpolator< T, U >:
Collaboration graph
[legend]

Public Member Functions

 BangBangInterpolator (const std::map< double, T > &points={}, const std::vector< double > &accelDurationList={})
 Constructor. More...
 
 BangBangInterpolator (const BangBangInterpolator &inst)
 Copy constructor. More...
 
virtual std::shared_ptr< Interpolator< T, U > > clone () const override
 Clone this instance and get shared pointer. More...
 
virtual void clearPoints () override
 Clear points. More...
 
virtual void appendPoint (const std::pair< double, T > &point) override
 Add point. More...
 
void appendPoint (const std::pair< double, T > &point, double accelDuration)
 Add point. More...
 
virtual void calcCoeff () override
 Calculate coefficients. More...
 
virtual T operator() (double t) const override
 Calculate interpolated value. More...
 
virtual U derivative (double t, int order=1) const override
 Calculate the derivative of interpolated value. More...
 
- Public Member Functions inherited from TrajColl::Interpolator< T, T >
 Interpolator (const std::map< double, T > &points={})
 Constructor. More...
 
 Interpolator (const Interpolator &inst)
 Copy constructor. More...
 
virtual std::shared_ptr< Interpolator< T, T > > clone () const=0
 Clone this instance and get shared pointer. More...
 
double startTime () const
 Get start time. More...
 
double endTime () const
 Get end time. More...
 
const std::map< double, T > & points () const
 Get points. More...
 

Protected Attributes

std::vector< double > accelDurationList_
 List of acceleration/deceleration duration. More...
 
std::shared_ptr< PiecewiseFunc< double > > func_
 Function to calculate the ratio of interpolation points. More...
 
- Protected Attributes inherited from TrajColl::Interpolator< T, T >
std::map< double, T > points_
 Times and values to be interpolated. More...
 

Detailed Description

template<class T, class U = T>
class TrajColl::BangBangInterpolator< T, U >

Interpolator with bang-bang control.

Template Parameters
Tvalue type
Uderivative type

The velocity of each waypoint is assumed to be zero.

Definition at line 16 of file BangBangInterpolator.h.

Constructor & Destructor Documentation

◆ BangBangInterpolator() [1/2]

template<class T , class U = T>
TrajColl::BangBangInterpolator< T, U >::BangBangInterpolator ( const std::map< double, T > &  points = {},
const std::vector< double > &  accelDurationList = {} 
)
inline

Constructor.

Parameters
pointstimes and values to be interpolated
accelDurationListlist of acceleration/deceleration duration

Definition at line 23 of file BangBangInterpolator.h.

◆ BangBangInterpolator() [2/2]

template<class T , class U = T>
TrajColl::BangBangInterpolator< T, U >::BangBangInterpolator ( const BangBangInterpolator< T, U > &  inst)
inline

Copy constructor.

Definition at line 42 of file BangBangInterpolator.h.

Member Function Documentation

◆ appendPoint() [1/2]

template<class T , class U = T>
virtual void TrajColl::BangBangInterpolator< T, U >::appendPoint ( const std::pair< double, T > &  point)
inlineoverridevirtual

Add point.

Parameters
pointtime and value
Note
BangBangInterpolator::calcCoeff should be called before calling BangBangInterpolator::operator().

Implements TrajColl::Interpolator< T, T >.

Definition at line 66 of file BangBangInterpolator.h.

◆ appendPoint() [2/2]

template<class T , class U = T>
void TrajColl::BangBangInterpolator< T, U >::appendPoint ( const std::pair< double, T > &  point,
double  accelDuration 
)
inline

Add point.

Parameters
pointtime and value
accelDurationacceleration/deceleration duration (automatically determined if zero is specified)
Note
BangBangInterpolator::calcCoeff should be called before calling BangBangInterpolator::operator().

Definition at line 77 of file BangBangInterpolator.h.

◆ calcCoeff()

template<class T , class U = T>
virtual void TrajColl::BangBangInterpolator< T, U >::calcCoeff ( )
inlineoverridevirtual

Calculate coefficients.

Implements TrajColl::Interpolator< T, T >.

Definition at line 113 of file BangBangInterpolator.h.

◆ clearPoints()

template<class T , class U = T>
virtual void TrajColl::BangBangInterpolator< T, U >::clearPoints ( )
inlineoverridevirtual

Clear points.

Reimplemented from TrajColl::Interpolator< T, T >.

Definition at line 55 of file BangBangInterpolator.h.

◆ clone()

template<class T , class U = T>
virtual std::shared_ptr<Interpolator<T, U> > TrajColl::BangBangInterpolator< T, U >::clone ( ) const
inlineoverridevirtual

Clone this instance and get shared pointer.

Definition at line 49 of file BangBangInterpolator.h.

◆ derivative()

template<class T , class U = T>
virtual U TrajColl::BangBangInterpolator< T, U >::derivative ( double  t,
int  order = 1 
) const
inlineoverridevirtual

Calculate the derivative of interpolated value.

Parameters
ttime
orderderivative order

It is assumed that interpolateDerivative() returns zero if derivative order is greater than or equal to 2.

Implements TrajColl::Interpolator< T, T >.

Definition at line 169 of file BangBangInterpolator.h.

◆ operator()()

template<class T , class U = T>
virtual T TrajColl::BangBangInterpolator< T, U >::operator() ( double  t) const
inlineoverridevirtual

Calculate interpolated value.

Parameters
ttime

Implements TrajColl::Interpolator< T, T >.

Definition at line 155 of file BangBangInterpolator.h.

Member Data Documentation

◆ accelDurationList_

template<class T , class U = T>
std::vector<double> TrajColl::BangBangInterpolator< T, U >::accelDurationList_
protected

List of acceleration/deceleration duration.

Definition at line 181 of file BangBangInterpolator.h.

◆ func_

template<class T , class U = T>
std::shared_ptr<PiecewiseFunc<double> > TrajColl::BangBangInterpolator< T, U >::func_
protected

Function to calculate the ratio of interpolation points.

Definition at line 184 of file BangBangInterpolator.h.


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