roboptim::Trajectory< dorder > Class Template Referenceabstract

Abstract trajectory. More...

#include <roboptim/trajectory/trajectory.hh>

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

Public Types

typedef
NTimesDerivableFunction
< DerivabilityOrder > 
parent_t
 Parent type. More...
 
typedef parent_t::value_type value_type
 Import value type. More...
 
typedef parent_t::size_type size_type
 Import size type. More...
 
typedef parent_t::vector_t vector_t
 Import vector type. More...
 
typedef parent_t::result_t result_t
 Import result type. More...
 
typedef parent_t::gradient_t gradient_t
 Import gradient type. More...
 
typedef parent_t::jacobian_t jacobian_t
 Import jacobian type. More...
 
typedef parent_t::interval_t interval_t
 Import interval type. More...
 

Public Member Functions

virtual ~Trajectory () throw ()
 
result_t operator() (StableTimePoint argument) const throw ()
 
void operator() (result_t &result, StableTimePoint argument) const throw ()
 
gradient_t derivative (StableTimePoint argument, size_type order=1) const throw ()
 
void derivative (gradient_t &derivative, StableTimePoint argument, size_type order=1) const throw ()
 
virtual jacobian_t variationConfigWrtParam (StableTimePoint tp) const =0 throw ()
 
virtual jacobian_t variationDerivWrtParam (StableTimePoint tp, size_type order) const =0 throw ()
 
bool isValidTime (value_type t) const throw ()
 
virtual void normalizeAngles (size_type index) throw ()
 Normalize angles in parameters array. More...
 
virtual Trajectory
< DerivabilityOrder > * 
clone () const =0 throw ()
 
virtual Trajectory
< DerivabilityOrder > * 
resize (interval_t timeRange) const =0 throw ()
 Clone and resize a trajectory. More...
 
virtual std::ostream & print (std::ostream &) const throw ()
 
Accessing parameters, and state.
const vector_tparameters () const throw ()
 
virtual void setParameters (const vector_t &) throw ()
 
interval_t timeRange () const throw ()
 
value_type length () const throw ()
 
virtual vector_t state (double t, size_type order) const throw ()
 Get state along trajectory. More...
 
virtual vector_t state (StableTimePoint t, size_type order) const throw ()
 
Accessing parameters and gradients
virtual jacobian_t variationConfigWrtParam (double t) const =0 throw ()
 Get the variation of a configuration with respect to parameter vector. More...
 
virtual jacobian_t variationDerivWrtParam (double t, size_type order) const =0 throw ()
 Get the variation of a derivative with respect to parameter vector. More...
 
jacobian_t variationStateWrtParam (double t, size_type order) const throw ()
 Get the variation of the state with respect to parameter vector. More...
 
jacobian_t variationStateWrtParam (StableTimePoint stp, size_type order) const throw ()
 
Singular points
size_type singularPoints () const throw ()
 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...
 

Protected Member Functions

void impl_compute (result_t &, StableTimePoint) const throw ()
 
virtual void impl_derivative (gradient_t &g, StableTimePoint, size_type order) const =0 throw ()
 
 Trajectory (interval_t, size_type, const vector_t &, std::string name=std::string()) throw ()
 
virtual void normalizeAngles (size_type index, size_type offset) throw ()
 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< 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::gradient_t roboptim::Trajectory< dorder >::gradient_t

Import gradient type.

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

Import interval type.

template<unsigned dorder>
typedef parent_t::jacobian_t roboptim::Trajectory< dorder >::jacobian_t

Import jacobian type.

template<unsigned dorder>
typedef NTimesDerivableFunction<DerivabilityOrder> roboptim::Trajectory< dorder >::parent_t

Parent type.

template<unsigned dorder>
typedef parent_t::result_t roboptim::Trajectory< dorder >::result_t

Import result type.

template<unsigned dorder>
typedef parent_t::size_type roboptim::Trajectory< dorder >::size_type

Import size type.

template<unsigned dorder>
typedef parent_t::value_type roboptim::Trajectory< dorder >::value_type

Import value type.

template<unsigned dorder>
typedef parent_t::vector_t roboptim::Trajectory< dorder >::vector_t

Import vector type.

Constructor & Destructor Documentation

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

Member Function Documentation

template<unsigned dorder>
virtual Trajectory<DerivabilityOrder>* roboptim::Trajectory< dorder >::clone ( ) const
throw (
)
pure virtual
template<unsigned dorder>
virtual vector_t roboptim::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::FreeTimeTrajectory< T >, and roboptim::CubicBSpline.

template<unsigned dorder>
gradient_t roboptim::Trajectory< dorder >::derivative ( StableTimePoint  argument,
size_type  order = 1 
) const
throw (
)
inline
template<unsigned dorder>
void roboptim::Trajectory< dorder >::derivative ( gradient_t derivative,
StableTimePoint  argument,
size_type  order = 1 
) const
throw (
)
inline
template<unsigned dorder>
virtual vector_t roboptim::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::FreeTimeTrajectory< T >, and roboptim::CubicBSpline.

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

Normalize angles in parameters array.

Make sure angles are continuous.

Parameters
indexAngles index in parameter array.

Reimplemented in roboptim::FreeTimeTrajectory< T >.

template<unsigned dorder>
void roboptim::Trajectory< dorder >::normalizeAngles ( size_type  index,
size_type  offset 
)
throw (
)
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< dorder >::operator() ( StableTimePoint  argument) const
throw (
)
inline
template<unsigned dorder>
void roboptim::Trajectory< dorder >::operator() ( result_t result,
StableTimePoint  argument 
) const
throw (
)
inline
template<unsigned dorder>
const Trajectory< dorder >::vector_t & roboptim::Trajectory< dorder >::parameters ( ) const
throw (
)
template<unsigned dorder>
std::ostream & roboptim::Trajectory< dorder >::print ( std::ostream &  o) const
throw (
)
virtual
template<unsigned dorder>
virtual Trajectory<DerivabilityOrder>* roboptim::Trajectory< dorder >::resize ( interval_t  timeRange) const
throw (
)
pure virtual

Clone and resize a trajectory.

Implemented in roboptim::FreeTimeTrajectory< T >, and roboptim::CubicBSpline.

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

Get singular point at given rank.

Implemented in roboptim::FreeTimeTrajectory< T >, and roboptim::CubicBSpline.

template<unsigned dorder>
Trajectory< dorder >::size_type roboptim::Trajectory< dorder >::singularPoints ( ) const
throw (
)

Get number of singular points.

template<unsigned dorder>
Trajectory< dorder >::vector_t roboptim::Trajectory< dorder >::state ( double  t,
size_type  order 
) const
throw (
)
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< dorder >::state ( StableTimePoint  t,
size_type  order 
) const
throw (
)
virtual
template<unsigned dorder>
virtual jacobian_t roboptim::Trajectory< dorder >::variationConfigWrtParam ( double  t) const
throw (
)
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::FreeTimeTrajectory< T >, and roboptim::CubicBSpline.

template<unsigned dorder>
virtual jacobian_t roboptim::Trajectory< dorder >::variationConfigWrtParam ( StableTimePoint  tp) const
throw (
)
pure virtual
template<unsigned dorder>
virtual jacobian_t roboptim::Trajectory< dorder >::variationDerivWrtParam ( double  t,
size_type  order 
) const
throw (
)
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::FreeTimeTrajectory< T >, and roboptim::CubicBSpline.

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

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< dorder >::variationStateWrtParam ( StableTimePoint  stp,
size_type  order 
) const
throw (
)

Member Data Documentation

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