Public Types | Public Member Functions | Private Types | Static Private Member Functions | Private Attributes | List of all members
trajectory_interface::QuinticSplineSegment< ScalarType > Class Template Reference

Class representing a multi-dimensional quintic spline segment with a start and end time. More...

#include <quintic_spline_segment.h>

Public Types

typedef ScalarType Scalar
 
typedef PosVelAccState< ScalarState
 
typedef Scalar Time
 

Public Member Functions

Time endTime () const
 
void init (const Time &start_time, const State &start_state, const Time &end_time, const State &end_state)
 Initialize segment from start and end states (boundary conditions). More...
 
 QuinticSplineSegment ()
 Creates an empty segment. More...
 
 QuinticSplineSegment (const Time &start_time, const State &start_state, const Time &end_time, const State &end_state)
 Construct segment from start and end states (boundary conditions). More...
 
void sample (const Time &time, State &state) const
 Sample the segment at a specified time. More...
 
unsigned int size () const
 
Time startTime () const
 

Private Types

typedef boost::array< Scalar, 6 > SplineCoefficients
 

Static Private Member Functions

static void computeCoefficients (const Scalar &start_pos, const Scalar &end_pos, const Scalar &time, SplineCoefficients &coefficients)
 
static void computeCoefficients (const Scalar &start_pos, const Scalar &start_vel, const Scalar &end_pos, const Scalar &end_vel, const Scalar &time, SplineCoefficients &coefficients)
 
static void computeCoefficients (const Scalar &start_pos, const Scalar &start_vel, const Scalar &start_acc, const Scalar &end_pos, const Scalar &end_vel, const Scalar &end_acc, const Scalar &time, SplineCoefficients &coefficients)
 
static void generatePowers (int n, const Scalar &x, Scalar *powers)
 
static void sample (const SplineCoefficients &coefficients, const Scalar &time, Scalar &position, Scalar &velocity, Scalar &acceleration)
 
static void sampleWithTimeBounds (const SplineCoefficients &coefficients, const Scalar &duration, const Scalar &time, Scalar &position, Scalar &velocity, Scalar &acceleration)
 

Private Attributes

std::vector< SplineCoefficientscoefs_
 
Time duration_
 
Time start_time_
 

Detailed Description

template<class ScalarType>
class trajectory_interface::QuinticSplineSegment< ScalarType >

Class representing a multi-dimensional quintic spline segment with a start and end time.

Template Parameters
ScalarTypeScalar type

Definition at line 51 of file quintic_spline_segment.h.

Member Typedef Documentation

template<class ScalarType >
typedef ScalarType trajectory_interface::QuinticSplineSegment< ScalarType >::Scalar

Definition at line 54 of file quintic_spline_segment.h.

template<class ScalarType >
typedef boost::array<Scalar, 6> trajectory_interface::QuinticSplineSegment< ScalarType >::SplineCoefficients
private

Definition at line 146 of file quintic_spline_segment.h.

template<class ScalarType >
typedef PosVelAccState<Scalar> trajectory_interface::QuinticSplineSegment< ScalarType >::State

Definition at line 56 of file quintic_spline_segment.h.

template<class ScalarType >
typedef Scalar trajectory_interface::QuinticSplineSegment< ScalarType >::Time

Definition at line 55 of file quintic_spline_segment.h.

Constructor & Destructor Documentation

template<class ScalarType >
trajectory_interface::QuinticSplineSegment< ScalarType >::QuinticSplineSegment ( )
inline

Creates an empty segment.

Note
Calling size() on an empty segment will yield zero, and sampling it will yield a state with empty data.

Definition at line 64 of file quintic_spline_segment.h.

template<class ScalarType >
trajectory_interface::QuinticSplineSegment< ScalarType >::QuinticSplineSegment ( const Time start_time,
const State start_state,
const Time end_time,
const State end_state 
)
inline

Construct segment from start and end states (boundary conditions).

Please refer to the init method documentation for the description of each parameter and the exceptions that can be thrown.

Definition at line 76 of file quintic_spline_segment.h.

Member Function Documentation

template<class ScalarType >
void trajectory_interface::QuinticSplineSegment< ScalarType >::computeCoefficients ( const Scalar start_pos,
const Scalar end_pos,
const Scalar time,
SplineCoefficients coefficients 
)
staticprivate

Definition at line 284 of file quintic_spline_segment.h.

template<class ScalarType >
void trajectory_interface::QuinticSplineSegment< ScalarType >::computeCoefficients ( const Scalar start_pos,
const Scalar start_vel,
const Scalar end_pos,
const Scalar end_vel,
const Scalar time,
SplineCoefficients coefficients 
)
staticprivate

Definition at line 299 of file quintic_spline_segment.h.

template<class ScalarType >
void trajectory_interface::QuinticSplineSegment< ScalarType >::computeCoefficients ( const Scalar start_pos,
const Scalar start_vel,
const Scalar start_acc,
const Scalar end_pos,
const Scalar end_vel,
const Scalar end_acc,
const Scalar time,
SplineCoefficients coefficients 
)
staticprivate

Definition at line 327 of file quintic_spline_segment.h.

template<class ScalarType >
Time trajectory_interface::QuinticSplineSegment< ScalarType >::endTime ( ) const
inline
Returns
Segment end time.

Definition at line 140 of file quintic_spline_segment.h.

template<class ScalarType >
void trajectory_interface::QuinticSplineSegment< ScalarType >::generatePowers ( int  n,
const Scalar x,
Scalar powers 
)
inlinestaticprivate

Definition at line 273 of file quintic_spline_segment.h.

template<class ScalarType >
void trajectory_interface::QuinticSplineSegment< ScalarType >::init ( const Time start_time,
const State start_state,
const Time end_time,
const State end_state 
)

Initialize segment from start and end states (boundary conditions).

The start and end states need not necessarily be specified all the way to the acceleration level:

  • If only positions are specified, linear interpolation will be used.
  • If positions and velocities are specified, a cubic spline will be used.
  • If positions, velocities and accelerations are specified, a quintic spline will be used.
Note
If start and end states have different specifications (eg. start is positon-only, end is position-velocity), the lowest common specification will be used (position-only in the example).
Parameters
start_timeTime at which the segment state equals start_state.
start_stateState at start_time.
end_timeTime at which the segment state equals end_state.
end_stateState at time end_time.
Exceptions
std::invalid_argumentIf the end_time is earlier than start_time or if one of the states is uninitialized.

Definition at line 183 of file quintic_spline_segment.h.

template<class ScalarType >
void trajectory_interface::QuinticSplineSegment< ScalarType >::sample ( const Time time,
State state 
) const
inline

Sample the segment at a specified time.

Note
Within the [start_time, end_time] interval, spline interpolation takes place, outside it this method will output the start/end states with zero velocity and acceleration.
Parameters
[in]timeWhere the segment is to be sampled.
[out]stateSegment state at time.

Definition at line 118 of file quintic_spline_segment.h.

template<class ScalarType >
void trajectory_interface::QuinticSplineSegment< ScalarType >::sample ( const SplineCoefficients coefficients,
const Scalar time,
Scalar position,
Scalar velocity,
Scalar acceleration 
)
staticprivate

Definition at line 360 of file quintic_spline_segment.h.

template<class ScalarType >
void trajectory_interface::QuinticSplineSegment< ScalarType >::sampleWithTimeBounds ( const SplineCoefficients coefficients,
const Scalar duration,
const Scalar time,
Scalar position,
Scalar velocity,
Scalar acceleration 
)
staticprivate

Definition at line 388 of file quintic_spline_segment.h.

template<class ScalarType >
unsigned int trajectory_interface::QuinticSplineSegment< ScalarType >::size ( ) const
inline
Returns
Segment size (dimension).

Definition at line 143 of file quintic_spline_segment.h.

template<class ScalarType >
Time trajectory_interface::QuinticSplineSegment< ScalarType >::startTime ( ) const
inline
Returns
Segment start time.

Definition at line 137 of file quintic_spline_segment.h.

Member Data Documentation

template<class ScalarType >
std::vector<SplineCoefficients> trajectory_interface::QuinticSplineSegment< ScalarType >::coefs_
private

Coefficients represent a quintic polynomial like so:

coefs_[0] + coefs_[1]*x + coefs_[2]*x^2 + coefs_[3]*x^3 + coefs_[4]*x^4 + coefs_[5]*x^5

Definition at line 152 of file quintic_spline_segment.h.

template<class ScalarType >
Time trajectory_interface::QuinticSplineSegment< ScalarType >::duration_
private

Definition at line 153 of file quintic_spline_segment.h.

template<class ScalarType >
Time trajectory_interface::QuinticSplineSegment< ScalarType >::start_time_
private

Definition at line 154 of file quintic_spline_segment.h.


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


joint_trajectory_controller
Author(s): Adolfo Rodriguez Tsouroukdissian
autogenerated on Thu Apr 11 2019 03:08:37