Aikido
|
An arbitrary dimensional polynomial spline. More...
#include <aikido/common/Spline.hpp>
Public Types | |
using | Scalar = _Scalar |
using | Index = _Index |
using | TimeVector = Eigen::Matrix< Scalar, NumKnotsAtCompileTime, 1 > |
using | SolutionMatrix = Eigen::Matrix< Scalar, NumOutputsAtCompileTime, NumCoefficientsAtCompileTime > |
using | OutputVector = Eigen::Matrix< Scalar, NumOutputsAtCompileTime, 1 > |
using | SolutionMatrices = std::vector< SolutionMatrix, Eigen::aligned_allocator< SolutionMatrix > > |
Public Member Functions | |
SplineND ()=default | |
Constructs an empty spline. More... | |
SplineND (const TimeVector &_times, const std::vector< SolutionMatrix, Eigen::aligned_allocator< SolutionMatrix > > &_solution) | |
Constructs a spline with the specified coefficients. More... | |
SplineND (SplineND &&_other)=default | |
SplineND (const SplineND &_other)=default | |
SplineND & | operator= (SplineND &&_other)=default |
SplineND & | operator= (const SplineND &_other)=default |
void | setTime (Index _index, Scalar _t) |
Sets the time of the _index-th knot point. More... | |
void | setTimes (TimeVector &&_t) |
Sets the times of all knot points. More... | |
void | setTimes (const TimeVector &_t) |
Sets the times of all knot points. More... | |
const TimeVector & | getTimes () const |
Gets times of all knot points. More... | |
const SolutionMatrices & | getCoefficients () const |
Gets polynomial coefficients for all segments. More... | |
Index | getNumKnots () const |
Gets the number of knot points. More... | |
Index | getNumOutputs () const |
Gets the number of outputs points. More... | |
Index | getNumDerivatives () const |
Gets an upperbound on the number of non-zero derivatives. More... | |
Index | getNumCoefficients () const |
Gets the number of polynomial coefficients in each segment. More... | |
Scalar | getDuration () const |
Gets the duration of the spline. More... | |
Index | getSegmentIndex (Scalar _t) const |
Gets the index of the segment that contains time _t . More... | |
OutputVector | evaluate (Scalar _t, Index _derivative=0) const |
Evaluate the _derivative-th order of the spline at time _t . More... | |
Static Public Attributes | |
static constexpr Index | NumCoefficientsAtCompileTime = _NumCoefficients |
static constexpr Index | NumOutputsAtCompileTime = _NumOutputs |
static constexpr Index | NumKnotsAtCompileTime = _NumKnots |
static constexpr Index | NumSegmentsAtCompileTime |
static constexpr Index | DimensionAtCompileTime |
Private Types | |
using | CoefficientVector = Eigen::Matrix< Scalar, NumCoefficientsAtCompileTime, 1 > |
using | CoefficientMatrix = Eigen::Matrix< Scalar, NumCoefficientsAtCompileTime, NumCoefficientsAtCompileTime > |
Private Attributes | |
TimeVector | mTimes |
SolutionMatrices | mSolution |
An arbitrary dimensional polynomial spline.
The number of coefficients, outputs, and knot points may be specified either at compile time (via template parameters) or at runtime (if the template parameters are Eigen::Dynamic
). We suggest setting as many of these parameters at compile time as possible for best performance.
Note that this spline is not guaranteed to be continuous at knot points; this is the responsbility of the user who constructs the splines coefficients. See SplineProblem
for a helper class that constructs a continuous spline from a set of constraints.
_Scalar | floating type used to represent a scalar value |
_Index | integral type used to represent an index |
_NumCoefficients | number of polynomial coefficients, or Dynamic |
_NumOutputs | number of outputs, or Dynamic |
_NumKnots | number of knots, or Dynamic |
|
private |
|
private |
using aikido::common::SplineND< _Scalar, _Index, _NumCoefficients, _NumOutputs, _NumKnots >::Index = _Index |
using aikido::common::SplineND< _Scalar, _Index, _NumCoefficients, _NumOutputs, _NumKnots >::OutputVector = Eigen::Matrix<Scalar, NumOutputsAtCompileTime, 1> |
using aikido::common::SplineND< _Scalar, _Index, _NumCoefficients, _NumOutputs, _NumKnots >::Scalar = _Scalar |
using aikido::common::SplineND< _Scalar, _Index, _NumCoefficients, _NumOutputs, _NumKnots >::SolutionMatrices = std::vector<SolutionMatrix, Eigen::aligned_allocator<SolutionMatrix> > |
using aikido::common::SplineND< _Scalar, _Index, _NumCoefficients, _NumOutputs, _NumKnots >::SolutionMatrix = Eigen:: Matrix<Scalar, NumOutputsAtCompileTime, NumCoefficientsAtCompileTime> |
using aikido::common::SplineND< _Scalar, _Index, _NumCoefficients, _NumOutputs, _NumKnots >::TimeVector = Eigen::Matrix<Scalar, NumKnotsAtCompileTime, 1> |
|
default |
Constructs an empty spline.
aikido::common::SplineND< Scalar, Index, _NumCoefficients, _NumOutputs, _NumKnots >::SplineND | ( | const TimeVector & | _times, |
const std::vector< SolutionMatrix, Eigen::aligned_allocator< SolutionMatrix > > & | _solution | ||
) |
Constructs a spline with the specified coefficients.
The _solution
is a vector of _times.size()
- 1 spline coefficients, where the i-th matrix defines the polynomial coefficients for the segment between knot points (i) and (i + 1). Each coefficient matrix of size (num outputs) x (num coefficients), where element (i, j) is the coefficient on the x^j
term for output i
.
_times | times of knot points, must be monotone increasing |
_solution | list of polynomial coefficients for each segment |
|
default |
|
default |
auto aikido::common::SplineND< Scalar, Index, _NumCoefficients, _NumOutputs, _NumKnots >::evaluate | ( | Scalar | _t, |
Index | _derivative = 0 |
||
) | const |
Evaluate the _derivative-th
order of the spline at time _t
.
The zero-th order derivative is function value. All derivatives greater than getNumDerivatives()
are guaranteed to be zero.
_t | time parameter |
_derivative | order of derivative to evaluate |
_t
auto aikido::common::SplineND< Scalar, Index, _NumCoefficients, _NumOutputs, _NumKnots >::getCoefficients |
Gets polynomial coefficients for all segments.
Scalar aikido::common::SplineND< Scalar, Index, _NumCoefficients, _NumOutputs, _NumKnots >::getDuration |
Gets the duration of the spline.
This is the difference between the time of the first and last knot points.
Index aikido::common::SplineND< Scalar, Index, _NumCoefficients, _NumOutputs, _NumKnots >::getNumCoefficients |
Gets the number of polynomial coefficients in each segment.
Index aikido::common::SplineND< Scalar, Index, _NumCoefficients, _NumOutputs, _NumKnots >::getNumDerivatives |
Gets an upperbound on the number of non-zero derivatives.
Index aikido::common::SplineND< Scalar, Index, _NumCoefficients, _NumOutputs, _NumKnots >::getNumKnots |
Gets the number of knot points.
Index aikido::common::SplineND< Scalar, Index, _NumCoefficients, _NumOutputs, _NumKnots >::getNumOutputs |
Gets the number of outputs points.
auto aikido::common::SplineND< Scalar, Index, _NumCoefficients, _NumOutputs, _NumKnots >::getSegmentIndex | ( | Scalar | _t | ) | const |
Gets the index of the segment that contains time _t
.
_t | time parameter |
auto aikido::common::SplineND< Scalar, Index, _NumCoefficients, _NumOutputs, _NumKnots >::getTimes |
Gets times of all knot points.
|
default |
|
default |
void aikido::common::SplineND< Scalar, Index, _NumCoefficients, _NumOutputs, _NumKnots >::setTime | ( | Index | _index, |
Scalar | _t | ||
) |
Sets the time of the _index-th
knot point.
Times must remain monotone after performing this operation.
_index | index of a knot point |
_t | new time for that knot point |
void aikido::common::SplineND< Scalar, Index, _NumCoefficients, _NumOutputs, _NumKnots >::setTimes | ( | const TimeVector & | _t | ) |
Sets the times of all knot points.
_t | new times, must be monotone increasing |
void aikido::common::SplineND< Scalar, Index, _NumCoefficients, _NumOutputs, _NumKnots >::setTimes | ( | TimeVector && | _t | ) |
Sets the times of all knot points.
_t | new times, must be monotone increasing |
|
staticconstexpr |
|
private |
|
private |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |