roboptim::trajectory::BSpline< N > Class Template Reference

#include <roboptim/trajectory/b-spline.hh>

Inheritance diagram for roboptim::trajectory::BSpline< N >:
roboptim::trajectory::Trajectory< N > NTimesDerivableFunction roboptim::trajectory::ConstrainedBSpline< N >

List of all members.

Public Types

typedef parent_t::interval_t interval_t
 Import interval type.
typedef Polynomial< N > polynomial_t
typedef Monomial< N > monomial_t
typedef std::map< int,
polynomial_t, std::less< int >
, Eigen::aligned_allocator
< std::pair< const int,
polynomial_t > > > 
cox_map
typedef cox_map::iterator cox_map_itr_t
typedef std::vector
< polynomial_t,
Eigen::aligned_allocator
< polynomial_t > > 
basisPolynomials_t
typedef std::vector
< basisPolynomials_t
basisPolynomialsVector_t

Public Member Functions

 ROBOPTIM_DIFFERENTIABLE_FUNCTION_FWD_TYPEDEFS_ (Trajectory< N >)
 Parent type and imports.
 BSpline (interval_t timeRange, size_type dimension, const vector_t &parameters, const std::string name="B-Spline", bool clamped=false)
 Instantiate a B-Spline from its definition.
 BSpline (interval_t tr, size_type dimension, const vector_t &parameters, const_vector_ref knots, std::string name="B-Spline")
 Instantiate a B-Spline with parameters and knot points.
 BSpline (const BSpline< N > &spline)
 Copy constructor.
virtual ~BSpline ()
virtual void setParameters (const vector_t &)
 Modify spline parameters.
virtual jacobian_t variationConfigWrtParam (value_type t) const
virtual jacobian_t variationDerivWrtParam (value_type t, size_type order) const
virtual value_type singularPointAtRank (size_type rank) const
 Get singular point at given rank.
virtual vector_t derivBeforeSingularPoint (size_type rank, size_type order) const
 Get left limit value of derivative at given singular point.
virtual vector_t derivAfterSingularPoint (size_type rank, size_type order) const
 Get right limit value of derivative at given singular point.
virtual Trajectory< N > * resize (interval_t timeRange) const
 Clone and resize a trajectory.
virtual std::ostream & print (std::ostream &o) const
 Display the function on the specified output stream.
jacobian_t variationConfigWrtParam (StableTimePoint tp) const
jacobian_t variationDerivWrtParam (StableTimePoint tp, size_type order) const
value_type Dt () const ROBOPTIM_TRAJECTORY_DEPRECATED
const vector_t & knotVector () const
 Return the knot vector of the spline.
size_type interval (value_type t) const
size_type getNumberControlPoints () const
 Get the number of control points of the spline.
const basisPolynomialsVector_tbasisPolynomials () const
 Constant getter for the basis polynomials of the B-spline.

Protected Member Functions

void impl_compute (result_ref, value_type) const
void impl_derivative (gradient_ref g, value_type x, size_type order) const
void impl_derivative (gradient_ref g, StableTimePoint, size_type order) const
vector_t basisFunctions (value_type t, size_type order) const ROBOPTIM_TRAJECTORY_DEPRECATED
void computeBasisPolynomials ()
cox_map cox_de_boor (size_type j, size_type n) const
 Generate base polynomial set For the basic spline formula noted in the pdf from the docs section, this implements (3), the recursion formula.

Static Protected Attributes

static const size_type order_ = N
 order of the B-Spline
static log4cxx::LoggerPtr logger
 Pointer to B-spline logger (see log4cxx documentation).

template<int N>
class roboptim::trajectory::BSpline< N >


Member Typedef Documentation

template<int N>
typedef std::vector< polynomial_t, Eigen::aligned_allocator<polynomial_t> > roboptim::trajectory::BSpline< N >::basisPolynomials_t
template<int N>
typedef std::map< int, polynomial_t, std::less<int>, Eigen::aligned_allocator<std::pair<const int, polynomial_t> > > roboptim::trajectory::BSpline< N >::cox_map
template<int N>
typedef cox_map::iterator roboptim::trajectory::BSpline< N >::cox_map_itr_t
template<int N>
typedef parent_t::interval_t roboptim::trajectory::BSpline< N >::interval_t

Import interval type.

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

Reimplemented in roboptim::trajectory::ConstrainedBSpline< N >.

template<int N>
typedef Monomial<N> roboptim::trajectory::BSpline< N >::monomial_t
template<int N>
typedef Polynomial<N> roboptim::trajectory::BSpline< N >::polynomial_t

Constructor & Destructor Documentation

template<int N>
roboptim::trajectory::BSpline< N >::BSpline ( interval_t  timeRange,
size_type  dimension,
const vector_t &  parameters,
const std::string  name = "B-Spline",
bool  clamped = false 
)

Instantiate a B-Spline from its definition.

Parameters:
timeRangespline time range: $ $[t_3,t_n]$
dimensionspline dimension: $n$
parametersvector of parameters defining control points
namefunction title
clampedwhether the spline should be clamped

Number of control points is inferred from dimension of dimenion of parameter vector.

References roboptim::trajectory::BSpline< N >::computeBasisPolynomials(), roboptim::trajectory::BSpline< N >::order_, roboptim::trajectory::Trajectory< N >::parameters_, and roboptim::trajectory::BSpline< N >::setParameters().

template<int N>
roboptim::trajectory::BSpline< N >::BSpline ( interval_t  tr,
size_type  dimension,
const vector_t &  parameters,
const_vector_ref  knots,
std::string  name = "B-Spline" 
)

Instantiate a B-Spline with parameters and knot points.

Parameters:
timeRangespline time range: $ $[t_3,t_n]$
dimensionspline dimension: $n$
parametersvector of parameters
knotsvector of control points
namefunction title The number of knot points must be the number of parameters + N + 1. In the knot vector, N knots at the beginning must lie before the start of the spline. The rest of the knot point must lie before the end of the spline interval.

References roboptim::trajectory::BSpline< N >::computeBasisPolynomials(), roboptim::trajectory::BSpline< N >::order_, roboptim::trajectory::Trajectory< N >::parameters_, and roboptim::trajectory::BSpline< N >::setParameters().

template<int N>
virtual roboptim::trajectory::BSpline< N >::~BSpline ( ) [inline, virtual]

Member Function Documentation

template<int N>
BSpline< N >::vector_t roboptim::trajectory::BSpline< N >::basisFunctions ( value_type  t,
size_type  order 
) const [protected]
template<int N>
const basisPolynomialsVector_t& roboptim::trajectory::BSpline< N >::basisPolynomials ( ) const [inline]

Constant getter for the basis polynomials of the B-spline.

Note: computeBasisPolynomials() needs to be called beforehand (which is done in the BSpline constructor).

Returns:
constant reference to the basis polynomials.
template<int N>
BSpline< N >::cox_map roboptim::trajectory::BSpline< N >::cox_de_boor ( size_type  j,
size_type  n 
) const [protected]

Generate base polynomial set For the basic spline formula noted in the pdf from the docs section, this implements (3), the recursion formula.

It returns the results as factors of b_j,0 where j is the index of the returned map.

Parameters:
jcurrent knot index
ncurrent basis function order
Returns:
a std::map. Call this with j as the index of the knot for which spline segment your want to generate the basis function for, and n as the order of your spline.

References roboptim::trajectory::Polynomial< N >::coefs().

template<int N>
BSpline< N >::vector_t roboptim::trajectory::BSpline< N >::derivAfterSingularPoint ( size_type  rank,
size_type  order 
) const [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.

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

template<int N>
BSpline< N >::vector_t roboptim::trajectory::BSpline< N >::derivBeforeSingularPoint ( size_type  rank,
size_type  order 
) const [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.

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

template<int N>
BSpline< N >::value_type roboptim::trajectory::BSpline< N >::Dt ( ) const
template<int N>
size_type roboptim::trajectory::BSpline< N >::getNumberControlPoints ( ) const [inline]

Get the number of control points of the spline.

Returns:
Number of control points of the spline.
template<int N>
void roboptim::trajectory::BSpline< N >::impl_compute ( result_ref  derivative,
value_type  t 
) const [protected]
template<int N>
void roboptim::trajectory::BSpline< N >::impl_derivative ( gradient_ref  g,
value_type  x,
size_type  order 
) const [protected]
template<int N>
void roboptim::trajectory::BSpline< N >::impl_derivative ( gradient_ref  g,
StableTimePoint  stp,
size_type  order 
) const [protected, virtual]
template<int N>
BSpline< N >::size_type roboptim::trajectory::BSpline< N >::interval ( value_type  t) const
template<int N>
const BSpline< N >::vector_t & roboptim::trajectory::BSpline< N >::knotVector ( ) const

Return the knot vector of the spline.

Returns:
knot vector of the spline (const).
template<int N>
std::ostream & roboptim::trajectory::BSpline< N >::print ( std::ostream &  o) const [virtual]

Display the function on the specified output stream.

Parameters:
ooutput stream used for display
Returns:
output stream

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

template<int N>
Trajectory< N > * roboptim::trajectory::BSpline< N >::resize ( interval_t  timeRange) const [virtual]

Clone and resize a trajectory.

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

Reimplemented in roboptim::trajectory::ConstrainedBSpline< N >.

Parent type and imports.

template<int N>
void roboptim::trajectory::BSpline< N >::setParameters ( const vector_t &  p) [virtual]
template<int N>
BSpline< N >::value_type roboptim::trajectory::BSpline< N >::singularPointAtRank ( size_type  rank) const [virtual]

Get singular point at given rank.

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

template<int N>
BSpline< N >::jacobian_t roboptim::trajectory::BSpline< N >::variationConfigWrtParam ( value_type  t) const [virtual]
template<int N>
BSpline< N >::jacobian_t roboptim::trajectory::BSpline< N >::variationDerivWrtParam ( value_type  t,
size_type  order 
) const [virtual]
template<int N>
BSpline< N >::jacobian_t roboptim::trajectory::BSpline< N >::variationDerivWrtParam ( StableTimePoint  tp,
size_type  order 
) const [virtual]

Member Data Documentation

template<int N>
const size_type roboptim::trajectory::BSpline< N >::order_ = N [static, protected]

order of the B-Spline

Referenced by roboptim::trajectory::BSpline< N >::BSpline().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines