Aikido
aikido::trajectory::Interpolated Class Reference

Trajectory that uses an Interpolator to interpolate between waypoints. More...

#include <aikido/trajectory/Interpolated.hpp>

Inheritance diagram for aikido::trajectory::Interpolated:
aikido::trajectory::Trajectory

Classes

struct  Waypoint
 Waypoint in the trajectory. More...
 

Public Member Functions

 Interpolated (statespace::ConstStateSpacePtr _stateSpace, statespace::ConstInterpolatorPtr _interpolator)
 Constructs an empty trajectory. More...
 
virtual ~Interpolated ()
 
void addWaypoint (double _t, const statespace::StateSpace::State *_state)
 Add a waypoint to the trajectory at the given time. More...
 
const statespace::StateSpace::StategetWaypoint (std::size_t _index) const
 Gets a waypoint. More...
 
double getWaypointTime (std::size_t _index) const
 Gets the time of a waypoint. More...
 
std::size_t getNumWaypoints () const
 Gets the number of waypoints. More...
 
statespace::ConstStateSpacePtr getStateSpace () const override
 Gets the StateSpace that this trajectory is defined in. More...
 
statespace::ConstInterpolatorPtr getInterpolator () const
 Gets the interpolator used to interpolate between waypoints. More...
 
std::size_t getNumDerivatives () const override
 Gets an upper bound on the number of non-zero derivatives available in this parameterization. More...
 
double getStartTime () const override
 Time at which the trajectory starts. More...
 
double getEndTime () const override
 Time at which the trajectory ends. More...
 
double getDuration () const override
 Duration of the trajectory. More...
 
void evaluate (double _t, statespace::StateSpace::State *_state) const override
 Evaluates the state of the trajectory at time _t and store the result in a _state allocated by getStateSpace(). More...
 
void evaluateDerivative (double _t, int _derivative, Eigen::VectorXd &_tangentVector) const override
 Evaluates the derivative of the trajectory at time _t. More...
 
- Public Member Functions inherited from aikido::trajectory::Trajectory
virtual ~Trajectory ()=default
 

Private Member Functions

int getWaypointIndexAfterTime (double _t) const
 Get the index of the first waypoint whose time value is larger than _t. More...
 

Private Attributes

statespace::ConstStateSpacePtr mStateSpace
 
statespace::ConstInterpolatorPtr mInterpolator
 
std::vector< WaypointmWaypoints
 

Additional Inherited Members

- Public Attributes inherited from aikido::trajectory::Trajectory
TrajectoryMetadata metadata
 Trajectory metadata. More...
 

Detailed Description

Trajectory that uses an Interpolator to interpolate between waypoints.

Constructor & Destructor Documentation

◆ Interpolated()

aikido::trajectory::Interpolated::Interpolated ( statespace::ConstStateSpacePtr  _stateSpace,
statespace::ConstInterpolatorPtr  _interpolator 
)

Constructs an empty trajectory.

Parameters
_stateSpacestate space this trajectory is defined in
_interpolatorinterpolator used to interpolate between waypoints

◆ ~Interpolated()

virtual aikido::trajectory::Interpolated::~Interpolated ( )
virtual

Member Function Documentation

◆ addWaypoint()

void aikido::trajectory::Interpolated::addWaypoint ( double  _t,
const statespace::StateSpace::State _state 
)

Add a waypoint to the trajectory at the given time.

Parameters
_ttime of the waypoint
_statestate at the waypoint

◆ evaluate()

void aikido::trajectory::Interpolated::evaluate ( double  _t,
statespace::StateSpace::State _state 
) const
overridevirtual

Evaluates the state of the trajectory at time _t and store the result in a _state allocated by getStateSpace().

The output of this function is implementation-defined if _t is not between getStartTime() and getEndTime().

Parameters
_ttime parameter
[out]_stateoutput state of the trajectory at time _t

Implements aikido::trajectory::Trajectory.

◆ evaluateDerivative()

void aikido::trajectory::Interpolated::evaluateDerivative ( double  _t,
int  _derivative,
Eigen::VectorXd &  _tangentVector 
) const
overridevirtual

Evaluates the derivative of the trajectory at time _t.

The _tangentVector is defined in the local frame (i.e. "body frame") and is implementation-defined if not between getStartTime() and getEndTime(). Derivatives of order higher than getNumDerivatives are guaranteed to be zero.

Parameters
_ttime parameter
_derivativeorder of derivative
[out]_tangentVectoroutput tangent vector in the local frame

Implements aikido::trajectory::Trajectory.

◆ getDuration()

double aikido::trajectory::Interpolated::getDuration ( ) const
overridevirtual

Duration of the trajectory.

Note that getStartTime() may not be zero.

Returns
duration of the trajectory

Implements aikido::trajectory::Trajectory.

◆ getEndTime()

double aikido::trajectory::Interpolated::getEndTime ( ) const
overridevirtual

Time at which the trajectory ends.

This may not be getDuration() if getStartTime() is not zero.

Returns
time at which the trajectory ends

Implements aikido::trajectory::Trajectory.

◆ getInterpolator()

statespace::ConstInterpolatorPtr aikido::trajectory::Interpolated::getInterpolator ( ) const

Gets the interpolator used to interpolate between waypoints.

◆ getNumDerivatives()

std::size_t aikido::trajectory::Interpolated::getNumDerivatives ( ) const
overridevirtual

Gets an upper bound on the number of non-zero derivatives available in this parameterization.

Note that evaluateDerivative may return zero before this value for some trajectories.

Returns
upper bound on the number of non-zero derivatives

Implements aikido::trajectory::Trajectory.

◆ getNumWaypoints()

std::size_t aikido::trajectory::Interpolated::getNumWaypoints ( ) const

Gets the number of waypoints.

◆ getStartTime()

double aikido::trajectory::Interpolated::getStartTime ( ) const
overridevirtual

Time at which the trajectory starts.

This may not be zero.

Returns
time at which the trajectory starts

Implements aikido::trajectory::Trajectory.

◆ getStateSpace()

statespace::ConstStateSpacePtr aikido::trajectory::Interpolated::getStateSpace ( ) const
overridevirtual

Gets the StateSpace that this trajectory is defined in.

Returns
state space this trajectory is defined in.

Implements aikido::trajectory::Trajectory.

◆ getWaypoint()

const statespace::StateSpace::State* aikido::trajectory::Interpolated::getWaypoint ( std::size_t  _index) const

Gets a waypoint.

Parameters
_indexwaypoint index
Returns
state of the waypoint at index _index

◆ getWaypointIndexAfterTime()

int aikido::trajectory::Interpolated::getWaypointIndexAfterTime ( double  _t) const
private

Get the index of the first waypoint whose time value is larger than _t.

Throws std::domain_error if _t is larger than last waypoint in the trajectory.

◆ getWaypointTime()

double aikido::trajectory::Interpolated::getWaypointTime ( std::size_t  _index) const

Gets the time of a waypoint.

Parameters
_indexwaypoint index
Returns
time of the waypoint at index _index

Member Data Documentation

◆ mInterpolator

statespace::ConstInterpolatorPtr aikido::trajectory::Interpolated::mInterpolator
private

◆ mStateSpace

statespace::ConstStateSpacePtr aikido::trajectory::Interpolated::mStateSpace
private

◆ mWaypoints

std::vector<Waypoint> aikido::trajectory::Interpolated::mWaypoints
private