gtsam
Loading...
Searching...
No Matches
gtsam::CumulativeSplineTrajectory< T > Class Template Reference

Detailed Description

template<class T>
class gtsam::CumulativeSplineTrajectory< T >

Factory for expressions that sample a cumulative spline on a Lie group.

For control points \(T_0,\ldots,T_{N-1}\), define consecutive tangent increments \(\xi_i=\operatorname{Log}(T_{i-1}^{-1}T_i)\). The sampled curve is

\[T(t)=T_0\operatorname{Exp}\left(\sum_{i=1}^{N-1}c_i(t)\xi_i\right), \]

where each \(c_i\) is a shifted cumulative kernel. This is the cumulative Lie-group spline formulation of Sommer et al., "Efficient Derivative Computation for Cumulative B-Splines on Lie Groups" (CVPR 2020). Time-reversed Irwin-Hall CDF kernels produce uniform cardinal splines. Control points and the sample coordinate are expressions, so both may be optimized in a factor graph. The optional sample window keeps the resulting expression sparse by excluding control points outside the kernel support.

Template Parameters
TLie-group value represented by each control point.

Public Member Functions

 CumulativeSplineTrajectory (double density=1.0, const KernelBase &kernel=kernels::IrwinHallCDF2, const std::vector< Expression< T > > &points={}, bool padFront=false)
 Construct a trajectory model.
 CumulativeSplineTrajectory (double density, bool padFront)
 Construct a trajectory with the default cubic kernel and padding mode.
double density () const
 Number of control points per unit sample coordinate.
const KernelBase & kernel () const
 Kernel used to interpolate the trajectory.
bool padFront () const
 Whether kernel support is padded before each control point.
void addControlPoint (const Expression< T > &point)
 Append a key, constant, or computed expression as a control point.
void addControlPoint (const T &point)
 Append a constant value as a control point.
const std::vector< Expression< T > > & getControlPoints () const
 Read-only access to the control-point expressions.
Expression< T > sampleTrajectory (const Double_ &timestamp, double windowStart=0.0, double windowEnd=-1.0) const
 Create an expression that samples the trajectory.
T sampleTrajectory (double timestamp, double windowStart=0.0, double windowEnd=-1.0) const
 Sample a constant-control trajectory at a numeric timestamp.
TangentExpression sampleTrajectoryDerivative (const Double_ &timestamp, double windowStart=0.0, double windowEnd=-1.0, size_t derivative=1) const
 Create an expression for a trajectory derivative in the tangent space.
TangentVector sampleTrajectoryDerivative (double timestamp, double windowStart=0.0, double windowEnd=-1.0, size_t derivative=1) const
 Evaluate a tangent derivative for constant controls and numeric time.

Public Types

using TangentVector = typename traits<T>::TangentVector
 Tangent-space value associated with one trajectory sample.
using TangentExpression = Expression<TangentVector>
 Expression whose value is a trajectory tangent vector.

Constructor & Destructor Documentation

◆ CumulativeSplineTrajectory()

template<class T>
gtsam::CumulativeSplineTrajectory< T >::CumulativeSplineTrajectory ( double density = 1.0,
const KernelBase & kernel = kernels::IrwinHallCDF2,
const std::vector< Expression< T > > & points = {},
bool padFront = false )
inlineexplicit

Construct a trajectory model.

Parameters
densityNumber of control points per unit sample coordinate.
kernelIntegrated interpolation kernel. The default produces a cubic cardinal spline.
pointsInitial control-point expressions.
padFrontIf true, place the kernel support before each control point; otherwise place it after the point.

Member Function Documentation

◆ sampleTrajectory() [1/2]

template<class T>
Expression< T > gtsam::CumulativeSplineTrajectory< T >::sampleTrajectory ( const Double_ & timestamp,
double windowStart = 0.0,
double windowEnd = -1.0 ) const
inline

Create an expression that samples the trajectory.

windowStart and windowEnd bound the plausible sample coordinate and prune unrelated control points from the expression. A negative windowEnd includes all remaining control points.

◆ sampleTrajectory() [2/2]

template<class T>
T gtsam::CumulativeSplineTrajectory< T >::sampleTrajectory ( double timestamp,
double windowStart = 0.0,
double windowEnd = -1.0 ) const
inline

Sample a constant-control trajectory at a numeric timestamp.

This value-based overload evaluates the same expression tree as the expression API and is convenient for language wrappers and visualization. Every control point must be constant; keyed expressions require the expression overload and a Values assignment.

◆ sampleTrajectoryDerivative() [1/2]

template<class T>
TangentExpression gtsam::CumulativeSplineTrajectory< T >::sampleTrajectoryDerivative ( const Double_ & timestamp,
double windowStart = 0.0,
double windowEnd = -1.0,
size_t derivative = 1 ) const
inline

Create an expression for a trajectory derivative in the tangent space.

Parameters
derivativeDerivative order: 1 for velocity, 2 for acceleration, and so on. Zero returns the cumulative tangent displacement.

◆ sampleTrajectoryDerivative() [2/2]

template<class T>
TangentVector gtsam::CumulativeSplineTrajectory< T >::sampleTrajectoryDerivative ( double timestamp,
double windowStart = 0.0,
double windowEnd = -1.0,
size_t derivative = 1 ) const
inline

Evaluate a tangent derivative for constant controls and numeric time.

The result is the derivative of the accumulated tangent coordinate. It is not a body-frame velocity without the appropriate Lie-group Jacobian.


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