RobWorkProject
24.8.23-
|
Sequence of interpolators and blends giving a trajectory. More...
#include <InterpolatorTrajectory.hpp>
Inherits Trajectory< T >.
Public Types | |
typedef rw::core::Ptr< InterpolatorTrajectory< T > > | Ptr |
smart pointer type | |
Public Types inherited from Trajectory< T > | |
typedef rw::core::Ptr< Trajectory< T > > | Ptr |
smart pointer type | |
Public Member Functions | |
InterpolatorTrajectory (double startTime=0) | |
Construct an empty trajectory. | |
virtual | ~InterpolatorTrajectory () |
Destructor. | |
T | x (double t) const |
Position of trajectory at time t. More... | |
T | dx (double t) const |
Velocity of trajectory at time t. More... | |
T | ddx (double t) const |
Acceleration of trajectory at time t. More... | |
double | duration () const |
Total duration of the trajectory. More... | |
double | startTime () const |
Returns the startTime of the trajectory. More... | |
rw::trajectory::TrajectoryIterator< T >::Ptr | getIterator (double dt=1) const |
Returns a bi-directional interator for running through the trajectory. More... | |
template<template< typename > class I> | |
void | add (const I< T > &interpolator) |
Adds an interpolator to the end of the trajectory. More... | |
template<template< typename > class B, template< typename > class I> | |
void | add (const B< T > &blend, const I< T > &interpolator) |
Adds a blend and an interpolator to the trajectory. More... | |
void | add (rw::core::Ptr< Interpolator< T >> interpolator) |
Adds an interpolator to the end of the trajectory. More... | |
void | add (rw::core::Ptr< Blend< T >> blend, rw::core::Ptr< Interpolator< T >> interpolator) |
Adds a blend and an interpolator to the trajectory. More... | |
void | add (InterpolatorTrajectory< T > *trajectory) |
Append trajectory to the end. More... | |
size_t | getSegmentsCount () const |
Returns the number of segments. More... | |
std::pair< rw::core::Ptr< Blend< T > >, rw::core::Ptr< Interpolator< T > > > | getSegment (size_t index) const |
Public Member Functions inherited from Trajectory< T > | |
virtual | ~Trajectory () |
Destructor. | |
virtual double | endTime () const |
Returns the endTime of the trajectory. More... | |
std::vector< T > | getPath (double dt, bool uniform=true) |
Constructs a discrete path based on the trajectory. More... | |
Friends | |
class | TrajectoryIterator< T > |
Declares TrajectoryIterator as friend to allow it to use the private parts of Trajectory. | |
Additional Inherited Members | |
Protected Member Functions inherited from Trajectory< T > | |
Trajectory () | |
Construct an empty trajectory. | |
Sequence of interpolators and blends giving a trajectory.
A trajectory is defined as a sequence of interpolators and blends. Multiple interpolators can follow each other, whereas a Blend must be preceded and followed by interpolators.
The length of a Trajectory is defined as the time it takes to go from start to finish.
When performing random queries the trajectory needs to do a binary search through all interpolators and blend, giving the random access an O(lg n) complexity.
For accessing multiple consecutive values use TrajectoryInterpolator.
Example of usage:
|
inline |
Adds a blend and an interpolator to the trajectory.
The Blend added is used to blend between what was previously the last Interpolator of the trajectory onto interpolator, which become the new last interpolator of the trajectory.
When adding the interpolator and blend the Trajectory makes a copy of it
blend | [in] the blend to add |
interpolator | [in] the interpolator to add |
|
inline |
Adds an interpolator to the end of the trajectory.
When adding the interpolator the Trajectory makes a copy of it
interpolator | [in] The interpolator to add |
|
inline |
Append trajectory to the end.
When adding a Trajectory all interpolators and blends of trajectory is added in sequence.
Ownership of the interpolator and blends are shared using std::shared_ptr
trajectory | [in] Trajectory to append |
|
inline |
Adds a blend and an interpolator to the trajectory.
The Blend added is used to blend between what was previously the last Interpolator of the trajectory onto interpolator, which become the new last interpolator of the trajectory.
blend | [in] the blend to add |
interpolator | [in] the interpolator to add |
|
inline |
Adds an interpolator to the end of the trajectory.
When adding the interpolator the Trajectory takes ownership.
interpolator | [in] The interpolator to add |
|
inlinevirtual |
Acceleration of trajectory at time t.
Returns the acceleration of the trajectory at time t \(\in[startTime(), endTime()]\).
t | [in] time between startTime() and endTime() |
Implements Trajectory< T >.
|
inlinevirtual |
Total duration of the trajectory.
The duration of the Trajectory corresponds to the time it takes to run through it.
If the trajectory is empty, then -1 is returned.
Implements Trajectory< T >.
|
inlinevirtual |
Velocity of trajectory at time t.
Returns the velocity of the trajectory at time t \(\in[startTime(), endTime()]\).
t | [in] time between startTime() and endTime() |
Implements Trajectory< T >.
|
inlinevirtual |
Returns a bi-directional interator for running through the trajectory.
For some trajectory types it may be significantly more efficient to run through using an iterator, rather than using random access.
dt | [in] The default time step used when using the ++ or – operators in the iterator |
Pointer to the iterator. The pointer has ownership.
Implements Trajectory< T >.
|
inline |
Returns the number of segments.
A segment contains a description interpolator and the blend used to blend from the previous interpolator
|
inlinevirtual |
|
inlinevirtual |
Position of trajectory at time t.
Returns the position of the trajectory at time t \(\in[startTime(), endTime()]\).
t | [in] time between startTime() and endTime() |
Implements Trajectory< T >.