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< Scalar > | State |
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). | |
QuinticSplineSegment () | |
Creates an empty segment. | |
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). | |
void | sample (const Time &time, State &state) const |
Sample the segment at a specified time. | |
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< SplineCoefficients > | coefs_ |
Time | duration_ |
Time | start_time_ |
Class representing a multi-dimensional quintic spline segment with a start and end time.
ScalarType | Scalar type |
Definition at line 51 of file quintic_spline_segment.h.
typedef ScalarType trajectory_interface::QuinticSplineSegment< ScalarType >::Scalar |
Definition at line 54 of file quintic_spline_segment.h.
typedef boost::array<Scalar, 6> trajectory_interface::QuinticSplineSegment< ScalarType >::SplineCoefficients [private] |
Definition at line 146 of file quintic_spline_segment.h.
typedef PosVelAccState<Scalar> trajectory_interface::QuinticSplineSegment< ScalarType >::State |
Definition at line 56 of file quintic_spline_segment.h.
typedef Scalar trajectory_interface::QuinticSplineSegment< ScalarType >::Time |
Definition at line 55 of file quintic_spline_segment.h.
trajectory_interface::QuinticSplineSegment< ScalarType >::QuinticSplineSegment | ( | ) | [inline] |
Creates an empty segment.
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.
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.
void trajectory_interface::QuinticSplineSegment< ScalarType >::computeCoefficients | ( | const Scalar & | start_pos, |
const Scalar & | end_pos, | ||
const Scalar & | time, | ||
SplineCoefficients & | coefficients | ||
) | [static, private] |
Definition at line 284 of file quintic_spline_segment.h.
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 | ||
) | [static, private] |
Definition at line 299 of file quintic_spline_segment.h.
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 | ||
) | [static, private] |
Definition at line 327 of file quintic_spline_segment.h.
Time trajectory_interface::QuinticSplineSegment< ScalarType >::endTime | ( | ) | const [inline] |
Definition at line 140 of file quintic_spline_segment.h.
void trajectory_interface::QuinticSplineSegment< ScalarType >::generatePowers | ( | int | n, |
const Scalar & | x, | ||
Scalar * | powers | ||
) | [inline, static, private] |
Definition at line 273 of file quintic_spline_segment.h.
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:
start_time | Time at which the segment state equals start_state . |
start_state | State at start_time . |
end_time | Time at which the segment state equals end_state . |
end_state | State at time end_time . |
std::invalid_argument | If 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.
void trajectory_interface::QuinticSplineSegment< ScalarType >::sample | ( | const Time & | time, |
State & | state | ||
) | const [inline] |
Sample the segment at a specified time.
[start_time, end_time]
interval, spline interpolation takes place, outside it this method will output the start/end states with zero velocity and acceleration.[in] | time | Where the segment is to be sampled. |
[out] | state | Segment state at time . |
Definition at line 118 of file quintic_spline_segment.h.
void trajectory_interface::QuinticSplineSegment< ScalarType >::sample | ( | const SplineCoefficients & | coefficients, |
const Scalar & | time, | ||
Scalar & | position, | ||
Scalar & | velocity, | ||
Scalar & | acceleration | ||
) | [static, private] |
Definition at line 360 of file quintic_spline_segment.h.
void trajectory_interface::QuinticSplineSegment< ScalarType >::sampleWithTimeBounds | ( | const SplineCoefficients & | coefficients, |
const Scalar & | duration, | ||
const Scalar & | time, | ||
Scalar & | position, | ||
Scalar & | velocity, | ||
Scalar & | acceleration | ||
) | [static, private] |
Definition at line 388 of file quintic_spline_segment.h.
unsigned int trajectory_interface::QuinticSplineSegment< ScalarType >::size | ( | ) | const [inline] |
Definition at line 143 of file quintic_spline_segment.h.
Time trajectory_interface::QuinticSplineSegment< ScalarType >::startTime | ( | ) | const [inline] |
Definition at line 137 of file quintic_spline_segment.h.
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.
Time trajectory_interface::QuinticSplineSegment< ScalarType >::duration_ [private] |
Definition at line 153 of file quintic_spline_segment.h.
Time trajectory_interface::QuinticSplineSegment< ScalarType >::start_time_ [private] |
Definition at line 154 of file quintic_spline_segment.h.