All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
roboptim::trajectory::VectorInterpolation Class Reference

Takes a vector or argument and differentiate it. More...

#include <roboptim/trajectory/vector-interpolation.hh>

Inheritance diagram for roboptim::trajectory::VectorInterpolation:
roboptim::trajectory::Trajectory< 3 >

Public Types

typedef boost::shared_ptr
< VectorInterpolation
VectorInterpolationShPtr_t
 
- Public Types inherited from roboptim::trajectory::Trajectory< 3 >
typedef parent_t::interval_t interval_t
 Import interval type. More...
 

Public Member Functions

 ROBOPTIM_NTIMES_DERIVABLE_FUNCTION_FWD_TYPEDEFS (Trajectory< 3 >)
 
 ROBOPTIM_IMPLEMENT_CLONE (VectorInterpolation)
 
 VectorInterpolation (const_vector_ref x, size_type outputSize, value_type dt)
 Vector interpolation constructor. More...
 
 ~VectorInterpolation ()
 
 VectorInterpolation (const VectorInterpolation &vi)
 
void setParameters (const_vector_ref)
 Store parameters and update coefficients. More...
 
size_type numFrames () const
 
jacobian_t variationConfigWrtParam (double t) const
 Get the variation of a configuration with respect to parameter vector. More...
 
jacobian_t variationDerivWrtParam (double t, size_type order) const
 Get the variation of a derivative with respect to parameter vector. More...
 
value_type singularPointAtRank (size_type rank) const
 Get singular point at given rank. More...
 
vector_t derivBeforeSingularPoint (size_type rank, size_type order) const
 Get left limit value of derivative at given singular point. More...
 
vector_t derivAfterSingularPoint (size_type rank, size_type order) const
 Get right limit value of derivative at given singular point. More...
 
jacobian_t variationConfigWrtParam (StableTimePoint tp) const
 
jacobian_t variationDerivWrtParam (StableTimePoint tp, size_type order) const
 
boost::shared_ptr
< VectorInterpolation
trim (size_type start, size_type length) const
 Instantiate a trajectory corresponding to a sub-part of this trajectory. More...
 
- Public Member Functions inherited from roboptim::trajectory::Trajectory< 3 >
 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
 
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 std::ostream & print (std::ostream &) const
 
const vector_t & parameters () const
 
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
 
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
 
size_type singularPoints () const
 Get number of singular points. More...
 
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 result, double t) const
 
void impl_derivative (derivative_ref derivative, double argument, size_type order=1) const
 
void impl_derivative (derivative_ref g, StableTimePoint, size_type order) const
 
Trajectory< 3 > * resize (interval_t timeRange) const
 Clone and resize a trajectory. More...
 
- Protected Member Functions inherited from roboptim::trajectory::Trajectory< 3 >
virtual void normalizeAngles (size_type index, size_type offset)
 Internal version of normalizeAngles allowing an optional offset. More...
 
void impl_compute (result_ref, StableTimePoint) const
 
 Trajectory (interval_t, size_type, const vector_t &, std::string name=std::string())
 

Additional Inherited Members

- Protected Attributes inherited from roboptim::trajectory::Trajectory< 3 >
interval_t timeRange_
 
vector_t parameters_
 
size_type singularPoints_
 

Detailed Description

Takes a vector or argument and differentiate it.

It is common to have an optimization vector where a pattern is repeated:

[x_0^0 ... x_N^0 ... x_0^M x_N^M]

The pattern is here of length N and repeated M times.

By using numerical interpolation, it is possible to differentiate this pattern.

A classical example are trajectories.

Member Typedef Documentation

Constructor & Destructor Documentation

roboptim::trajectory::VectorInterpolation::VectorInterpolation ( const_vector_ref  x,
size_type  outputSize,
value_type  dt 
)
inlineexplicit

Vector interpolation constructor.

Exceptions
std::runtime_error
roboptim::trajectory::VectorInterpolation::~VectorInterpolation ( )
inline
roboptim::trajectory::VectorInterpolation::VectorInterpolation ( const VectorInterpolation vi)
inline

Member Function Documentation

VectorInterpolation::vector_t roboptim::trajectory::VectorInterpolation::derivAfterSingularPoint ( size_type  rank,
size_type  order 
) const
inlinevirtual

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.

Implements roboptim::trajectory::Trajectory< 3 >.

VectorInterpolation::vector_t roboptim::trajectory::VectorInterpolation::derivBeforeSingularPoint ( size_type  rank,
size_type  order 
) const
inlinevirtual

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.

Implements roboptim::trajectory::Trajectory< 3 >.

void roboptim::trajectory::VectorInterpolation::impl_compute ( result_ref  result,
double  t 
) const
inlineprotected
void roboptim::trajectory::VectorInterpolation::impl_derivative ( derivative_ref  derivative,
double  argument,
size_type  order = 1 
) const
inlineprotected
void roboptim::trajectory::VectorInterpolation::impl_derivative ( derivative_ref  g,
StableTimePoint  stp,
size_type  order 
) const
inlineprotectedvirtual
VectorInterpolation::size_type roboptim::trajectory::VectorInterpolation::numFrames ( ) const
inline
Trajectory< 3 > * roboptim::trajectory::VectorInterpolation::resize ( interval_t  timeRange) const
inlineprotectedvirtual

Clone and resize a trajectory.

Implements roboptim::trajectory::Trajectory< 3 >.

roboptim::trajectory::VectorInterpolation::ROBOPTIM_IMPLEMENT_CLONE ( VectorInterpolation  )
roboptim::trajectory::VectorInterpolation::ROBOPTIM_NTIMES_DERIVABLE_FUNCTION_FWD_TYPEDEFS ( Trajectory< 3 >  )
void roboptim::trajectory::VectorInterpolation::setParameters ( const_vector_ref  x)
inlinevirtual

Store parameters and update coefficients.

Parameters
vector_tvector of parameters.
Exceptions
std::runtime_error

Reimplemented from roboptim::trajectory::Trajectory< 3 >.

References roboptim::trajectory::Trajectory< 3 >::parameters(), roboptim::trajectory::Trajectory< dorder >::setParameters(), and roboptim::trajectory::Trajectory< 3 >::singularPoints_.

Referenced by VectorInterpolation().

VectorInterpolation::value_type roboptim::trajectory::VectorInterpolation::singularPointAtRank ( size_type  rank) const
inlinevirtual

Get singular point at given rank.

Implements roboptim::trajectory::Trajectory< 3 >.

boost::shared_ptr< VectorInterpolation > roboptim::trajectory::VectorInterpolation::trim ( size_type  start,
size_type  length 
) const
inline

Instantiate a trajectory corresponding to a sub-part of this trajectory.

This function can be called to exclude some frames at the beginning and/or the end of the trajectory.

Parameters
[in]startstarting frame (0 is the first frame)
[out]lengthlength of the output trajectory (0 means maximum length)
Returns
build sub-trajectory (data are copied)

References numFrames(), and roboptim::trajectory::Trajectory< 3 >::parameters().

VectorInterpolation::jacobian_t roboptim::trajectory::VectorInterpolation::variationConfigWrtParam ( double  t) const
inlinevirtual

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}}\]

Implements roboptim::trajectory::Trajectory< 3 >.

References variationDerivWrtParam().

VectorInterpolation::jacobian_t roboptim::trajectory::VectorInterpolation::variationConfigWrtParam ( StableTimePoint  tp) const
inlinevirtual
VectorInterpolation::jacobian_t roboptim::trajectory::VectorInterpolation::variationDerivWrtParam ( double  t,
size_type  order 
) const
inlinevirtual

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) \]

Implements roboptim::trajectory::Trajectory< 3 >.

References roboptim::trajectory::Trajectory< 3 >::parameters().

Referenced by variationConfigWrtParam().

VectorInterpolation::jacobian_t roboptim::trajectory::VectorInterpolation::variationDerivWrtParam ( StableTimePoint  tp,
size_type  order 
) const
inlinevirtual