All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
roboptim::trajectory::Trajectory< dorder > Class Template Referenceabstract

Abstract trajectory. More...

#include <roboptim/trajectory/trajectory.hh>

Inheritance diagram for roboptim::trajectory::Trajectory< dorder >:

Public Types

typedef parent_t::interval_t interval_t
 Import interval type. More...
 

Public Member Functions

 ROBOPTIM_NTIMES_DERIVABLE_FUNCTION_FWD_TYPEDEFS_ (NTimesDerivableFunction< DerivabilityOrder >)
 Parent type and imports. More...
 
virtual ~Trajectory ()
 
result_t operator() (StableTimePoint argument) const
 
void operator() (result_ref result, StableTimePoint argument) const
 
derivative_t derivative (StableTimePoint argument, size_type order=1) const
 
void derivative (derivative_ref derivative, StableTimePoint argument, size_type order=1) const
 
virtual jacobian_t variationConfigWrtParam (StableTimePoint tp) const =0
 
virtual jacobian_t variationDerivWrtParam (StableTimePoint tp, size_type order) const =0
 
bool isValidTime (value_type t) const
 
virtual void normalizeAngles (size_type index)
 Normalize angles in parameters array. More...
 
virtual Trajectory
< DerivabilityOrder > * 
clone () const =0
 
virtual Trajectory
< DerivabilityOrder > * 
resize (interval_t timeRange) const =0
 Clone and resize a trajectory. More...
 
virtual std::ostream & print (std::ostream &) const
 
Accessing parameters, and state.
const vector_t & parameters () const
 
virtual void setParameters (const_vector_ref)
 Set parameters. More...
 
interval_t timeRange () const
 
value_type length () const
 
virtual vector_t state (double t, size_type order) const
 Get state along trajectory. More...
 
virtual vector_t state (StableTimePoint t, size_type order) const
 
Accessing parameters and gradients
virtual jacobian_t variationConfigWrtParam (double t) const =0
 Get the variation of a configuration with respect to parameter vector. More...
 
virtual jacobian_t variationDerivWrtParam (double t, size_type order) const =0
 Get the variation of a derivative with respect to parameter vector. More...
 
jacobian_t variationStateWrtParam (double t, size_type order) const
 Get the variation of the state with respect to parameter vector. More...
 
jacobian_t variationStateWrtParam (StableTimePoint stp, size_type order) const
 
Singular points
size_type singularPoints () const
 Get number of singular points. More...
 
virtual value_type singularPointAtRank (size_type rank) const =0
 Get singular point at given rank. More...
 
virtual vector_t derivBeforeSingularPoint (size_type rank, size_type order) const =0
 Get left limit value of derivative at given singular point. More...
 
virtual vector_t derivAfterSingularPoint (size_type rank, size_type order) const =0
 Get right limit value of derivative at given singular point. More...
 
Tolerance for inclusion of parameter in interval of definition.

Set tolerance for inclusion of parameter in interval of definition.

void tolerance (const double &tolerance)
 
double tolerance () const
 Get tolerance for inclusion of parameter in interval of definition. More...
 

Protected Member Functions

void impl_compute (result_ref, StableTimePoint) const
 
virtual void impl_derivative (derivative_ref g, StableTimePoint, size_type order) const =0
 
 Trajectory (interval_t, size_type, const vector_t &, std::string name=std::string())
 
virtual void normalizeAngles (size_type index, size_type offset)
 Internal version of normalizeAngles allowing an optional offset. More...
 

Protected Attributes

interval_t timeRange_
 
vector_t parameters_
 
size_type singularPoints_
 

Detailed Description

template<unsigned dorder>
class roboptim::trajectory::Trajectory< dorder >

Abstract trajectory.

A trajectory is a piecewise smooth mapping \(\Gamma\) from

  • the Cartesian product of a definition interval and a vector space of parameters \(\textbf{R}^m\)
  • to a vector space \(\textbf{R}^n\):

    \[ \begin{array}{llll} \Gamma: & [t_{min}, t_{max}] \times \textbf{R}^m & \rightarrow & \textbf{R}^n \\ & (t, \textbf{p}) & \rightarrow & \Gamma_{\textbf{p}}(t) \end{array} \]

    Template Parameters
    DerivabilityOrderderivability order

Member Typedef Documentation

template<unsigned dorder>
typedef parent_t::interval_t roboptim::trajectory::Trajectory< dorder >::interval_t

Import interval type.

Constructor & Destructor Documentation

template<unsigned dorder>
roboptim::trajectory::Trajectory< dorder >::~Trajectory ( )
virtual
template<unsigned dorder>
roboptim::trajectory::Trajectory< dorder >::Trajectory ( interval_t  tr,
size_type  outputSize,
const vector_t &  p,
std::string  name = std::string () 
)
protected

Member Function Documentation

template<unsigned dorder>
virtual Trajectory<DerivabilityOrder>* roboptim::trajectory::Trajectory< dorder >::clone ( ) const
pure virtual
template<unsigned dorder>
virtual vector_t roboptim::trajectory::Trajectory< dorder >::derivAfterSingularPoint ( size_type  rank,
size_type  order 
) const
pure virtual

Get right limit value of derivative at given singular point.

Parameters
rankrank of the singular points.
orderorder of derivation.
Return values
derivativeLimit of the derivative at singular point for decreasing parameter values.

Implemented in roboptim::trajectory::BSpline< N >, roboptim::trajectory::CubicBSpline, roboptim::trajectory::FreeTimeTrajectory< T >, and roboptim::trajectory::VectorInterpolation.

template<unsigned dorder>
derivative_t roboptim::trajectory::Trajectory< dorder >::derivative ( StableTimePoint  argument,
size_type  order = 1 
) const
inline
template<unsigned dorder>
void roboptim::trajectory::Trajectory< dorder >::derivative ( derivative_ref  derivative,
StableTimePoint  argument,
size_type  order = 1 
) const
inline
template<unsigned dorder>
virtual vector_t roboptim::trajectory::Trajectory< dorder >::derivBeforeSingularPoint ( size_type  rank,
size_type  order 
) const
pure virtual

Get left limit value of derivative at given singular point.

Parameters
rankrank of the singular points.
orderorder of derivation.
Returns
Limit of the derivative at singular point for increasing parameter values.

Implemented in roboptim::trajectory::BSpline< N >, roboptim::trajectory::CubicBSpline, roboptim::trajectory::FreeTimeTrajectory< T >, and roboptim::trajectory::VectorInterpolation.

template<unsigned dorder>
void roboptim::trajectory::Trajectory< dorder >::impl_compute ( result_ref  res,
StableTimePoint  stp 
) const
protected
template<unsigned dorder>
virtual void roboptim::trajectory::Trajectory< dorder >::impl_derivative ( derivative_ref  g,
StableTimePoint  ,
size_type  order 
) const
protectedpure virtual
template<unsigned dorder>
bool roboptim::trajectory::Trajectory< dorder >::isValidTime ( value_type  t) const
template<unsigned dorder>
Trajectory< dorder >::value_type roboptim::trajectory::Trajectory< dorder >::length ( ) const
template<unsigned dorder>
void roboptim::trajectory::Trajectory< dorder >::normalizeAngles ( size_type  index)
virtual

Normalize angles in parameters array.

Make sure angles are continuous.

Parameters
indexAngles index in parameter array.

Reimplemented in roboptim::trajectory::FreeTimeTrajectory< T >.

template<unsigned dorder>
void roboptim::trajectory::Trajectory< dorder >::normalizeAngles ( size_type  index,
size_type  offset 
)
protectedvirtual

Internal version of normalizeAngles allowing an optional offset.

Used to factorize code between trajectories and free time trajectories.

Parameters
indexAngles index in parameter array.
offsetIndex of the first control point in the parameter vector.
template<unsigned dorder>
result_t roboptim::trajectory::Trajectory< dorder >::operator() ( StableTimePoint  argument) const
inline
template<unsigned dorder>
void roboptim::trajectory::Trajectory< dorder >::operator() ( result_ref  result,
StableTimePoint  argument 
) const
inline
template<unsigned dorder>
std::ostream & roboptim::trajectory::Trajectory< dorder >::print ( std::ostream &  o) const
virtual
template<unsigned dorder>
virtual Trajectory<DerivabilityOrder>* roboptim::trajectory::Trajectory< dorder >::resize ( interval_t  timeRange) const
pure virtual
template<unsigned dorder>
roboptim::trajectory::Trajectory< dorder >::ROBOPTIM_NTIMES_DERIVABLE_FUNCTION_FWD_TYPEDEFS_ ( NTimesDerivableFunction< DerivabilityOrder >  )

Parent type and imports.

template<unsigned dorder>
void roboptim::trajectory::Trajectory< dorder >::setParameters ( const_vector_ref  p)
virtual
template<unsigned dorder>
virtual value_type roboptim::trajectory::Trajectory< dorder >::singularPointAtRank ( size_type  rank) const
pure virtual
template<unsigned dorder>
Trajectory< dorder >::size_type roboptim::trajectory::Trajectory< dorder >::singularPoints ( ) const

Get number of singular points.

template<unsigned dorder>
Trajectory< dorder >::vector_t roboptim::trajectory::Trajectory< dorder >::state ( double  t,
size_type  order 
) const
virtual

Get state along trajectory.

Parameters
tvalue \(t\) in the definition interval.
orderthe higher order \(r\) of the required derivative
Returns
the state defined as the vector containing the config and first derivatives:

\[ \textbf{X}(t) = \left(\Gamma_{\textbf{p}}(t), \frac{d\Gamma_{\textbf{p}}}{dt}(t),\cdots, \frac{d^{r}\Gamma_{\textbf{p}}}{dt^{r}}(t)\right) \]

The configuration and derivatives are concatenated in one vector.
template<unsigned dorder>
Trajectory< dorder >::vector_t roboptim::trajectory::Trajectory< dorder >::state ( StableTimePoint  t,
size_type  order 
) const
virtual
template<unsigned dorder>
void roboptim::trajectory::Trajectory< dorder >::tolerance ( const double &  tolerance)
template<unsigned dorder>
double roboptim::trajectory::Trajectory< dorder >::tolerance ( ) const

Get tolerance for inclusion of parameter in interval of definition.

template<unsigned dorder>
virtual jacobian_t roboptim::trajectory::Trajectory< dorder >::variationConfigWrtParam ( double  t) const
pure virtual

Get the variation of a configuration with respect to parameter vector.

Parameters
tvalue \(t\) in the definition interval.
Returns
Jacobian:

\[\frac{\partial\Gamma_{\textbf{p}}(t)}{\partial\textbf{p}}\]

Implemented in roboptim::trajectory::FreeTimeTrajectory< T >, and roboptim::trajectory::VectorInterpolation.

template<unsigned dorder>
virtual jacobian_t roboptim::trajectory::Trajectory< dorder >::variationConfigWrtParam ( StableTimePoint  tp) const
pure virtual
template<unsigned dorder>
virtual jacobian_t roboptim::trajectory::Trajectory< dorder >::variationDerivWrtParam ( double  t,
size_type  order 
) const
pure virtual

Get the variation of a derivative with respect to parameter vector.

Parameters
tvalue \(t\) in the definition interval.
orderorder \(r\) of the derivative.
Returns
jacobian

\[ \frac{\partial}{\partial\textbf{p}} \left(\frac{d^r\Gamma_{\textbf{p}}}{dt^r}(t)\right) \]

Implemented in roboptim::trajectory::ConstrainedBSpline< N >, roboptim::trajectory::FreeTimeTrajectory< T >, and roboptim::trajectory::VectorInterpolation.

template<unsigned dorder>
virtual jacobian_t roboptim::trajectory::Trajectory< dorder >::variationDerivWrtParam ( StableTimePoint  tp,
size_type  order 
) const
pure virtual
template<unsigned dorder>
Trajectory< dorder >::jacobian_t roboptim::trajectory::Trajectory< dorder >::variationStateWrtParam ( double  t,
size_type  order 
) const

Get the variation of the state with respect to parameter vector.

Parameters
tvalue \(t\) in the definition interval.
orderorder \(r\) of the derivative.
Returns
jacobian

\[ \left(\begin{array}{c}\frac{\partial}{\partial \lambda} \Gamma_{\textbf{p}}(t) \\ \vdots \\ \frac{\partial}{\partial \lambda}\frac{d\Gamma_{\textbf{p}}^r}{dt^r}(t) \end{array}\right) \]

template<unsigned dorder>
Trajectory< dorder >::jacobian_t roboptim::trajectory::Trajectory< dorder >::variationStateWrtParam ( StableTimePoint  stp,
size_type  order 
) const

Member Data Documentation

template<unsigned dorder>
vector_t roboptim::trajectory::Trajectory< dorder >::parameters_
protected
template<unsigned dorder>
size_type roboptim::trajectory::Trajectory< dorder >::singularPoints_
protected
template<unsigned dorder>
interval_t roboptim::trajectory::Trajectory< dorder >::timeRange_
protected