Constrained B-spline. More...
#include <roboptim/trajectory/constrained-b-spline.hh>
Public Types | |
typedef parent_t::interval_t | interval_t |
Public Types inherited from roboptim::trajectory::BSpline< N > | |
typedef parent_t::interval_t | interval_t |
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 Types inherited from roboptim::trajectory::Trajectory< N > | |
typedef parent_t::interval_t | interval_t |
Import interval type. More... | |
Public Member Functions | |
ROBOPTIM_NTIMES_DERIVABLE_FUNCTION_FWD_TYPEDEFS_ (BSpline< N >) | |
Parent type and imports. More... | |
ConstrainedBSpline (interval_t timeRange, size_type dimension, const vector_t ¶meters, const std::string name="Constrained B-Spline") | |
see B-Spline constructors for documentation More... | |
ConstrainedBSpline (interval_t tr, size_type dimension, const vector_t ¶meters, const_vector_ref knots, std::string name="Constrained B-Spline") | |
see B-Spline constructors for documentation More... | |
virtual | ~ConstrainedBSpline () |
Destructor of constrained B-spline. More... | |
void | addFixedConstraint (double t, size_type dimension, value_type value, size_type derivative=0) |
Creates a constraint on the basic spline. More... | |
void | addCoupledConstraint (value_type t_1, size_type dimension_1, value_type t_2, size_type dimension_2, size_type derivative=0, value_type factor=1.) |
Create a constraint against another part of the spline. More... | |
const vector_t & | parameters () const |
Overloaded parameters method from Trajectory<N>. More... | |
void | setParameters (const_vector_ref) |
Overloaded setParameters method from Trajectory<N>. More... | |
virtual Trajectory< N > * | resize (interval_t timeRange) const |
Clone and resize a trajectory. More... | |
jacobian_t | variationDerivWrtParam (double t, size_type order) const |
Get the variation of a derivative with respect to parameter vector. More... | |
Public Member Functions inherited from roboptim::trajectory::BSpline< N > | |
ROBOPTIM_NTIMES_DERIVABLE_FUNCTION_FWD_TYPEDEFS_ (Trajectory< N >) | |
Parent type and imports. More... | |
BSpline (const interval_t &timeRange, size_type dimension, const vector_t ¶meters, const std::string name="B-Spline", bool clamped=false) | |
Instantiate a B-Spline from its definition. More... | |
BSpline (const interval_t &tr, size_type dimension, const vector_t ¶meters, const_vector_ref knots, std::string name="B-Spline") | |
Instantiate a B-Spline with parameters and knot points. More... | |
BSpline (const BSpline< N > &spline) | |
Copy constructor. More... | |
template<int M> | |
BSpline< N > | derivative () const |
Compute the derivative of the B-spline for a given order. More... | |
virtual | ~BSpline () |
Virtual destructor. More... | |
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. More... | |
virtual vector_t | derivBeforeSingularPoint (size_type rank, size_type order) const |
Get left limit value of derivative at given singular point. More... | |
virtual vector_t | derivAfterSingularPoint (size_type rank, size_type order) const |
Get right limit value of derivative at given singular point. More... | |
virtual std::ostream & | print (std::ostream &o) const |
Display the function on the specified output stream. More... | |
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. More... | |
size_type | interval (value_type t) const |
size_type | getNumberControlPoints () const |
Get the number of control points of the spline. More... | |
void | toPolynomials (basisPolynomials_t &res) const |
Return the polynomial expression of the B-spline on each time interval. More... | |
const basisPolynomialsVector_t & | basisPolynomials () const |
Constant getter for the basis polynomials of the B-spline. More... | |
int | order () const |
Retrieve the order of the spline. More... | |
template<int M> | |
BSpline< N > ::basisPolynomialsVector_t | deriveBasisPolynomials () const |
Public Member Functions inherited from roboptim::trajectory::Trajectory< N > | |
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 |
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 |
virtual jacobian_t | variationConfigWrtParam (double t) const =0 |
Get the variation of a configuration 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 |
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 | updateProjector () |
Update the projector matrix. Called after adding a constraint. More... | |
Protected Member Functions inherited from roboptim::trajectory::BSpline< N > | |
BSpline (ConstructionMode mode, const interval_t &timeRange, size_type dimension, const vector_t ¶meters, const std::string name="B-Spline", bool clamped=false) | |
Special constructor used internally for specific cases (e.g. More... | |
void | impl_compute (result_ref, value_type) const |
void | impl_derivative (derivative_ref g, value_type x, size_type order) const |
void | impl_derivative (derivative_ref g, StableTimePoint, size_type order) const |
vector_t | basisFunctions (value_type t, size_type order) const ROBOPTIM_TRAJECTORY_DEPRECATED |
void | computeBasisPolynomials () |
Compute the basis polynomials. More... | |
template<int M> | |
basisPolynomialsVector_t | deriveBasisPolynomials () const |
Derive basis polynomials, but express the result as polynomials of BSpline<N> instead of BSpline<N-M>. More... | |
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. More... | |
void | initializeKnots (bool clamped) |
Initialize the knot vector. More... | |
Protected Member Functions inherited from roboptim::trajectory::Trajectory< N > | |
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()) | |
Protected Attributes | |
matrix_t | constraints_ |
Matrix storing constraints. More... | |
vector_t | constraint_values_ |
Constraint values. More... | |
vector_t | tunables_ |
Tunable parameters, i.e. the free parameters. More... | |
matrix_t | projector_ |
Projector matrix. More... | |
vector_t | projector_offset_ |
Result of: Constraints * X = Constraint values. More... | |
Additional Inherited Members | |
Protected Types inherited from roboptim::trajectory::BSpline< N > | |
enum | ConstructionMode { NORMAL = 0, UNINITIALIZED = 1 } |
Enum for special constructors. More... | |
Static Protected Attributes inherited from roboptim::trajectory::BSpline< N > | |
static const size_type | order_ = N |
Order of the B-Spline. More... | |
static log4cxx::LoggerPtr | logger |
Pointer to B-spline logger (see log4cxx documentation). More... | |
Constrained B-spline.
N | B-spline order. |
typedef parent_t::interval_t roboptim::trajectory::ConstrainedBSpline< N >::interval_t |
roboptim::trajectory::ConstrainedBSpline< N >::ConstrainedBSpline | ( | interval_t | timeRange, |
size_type | dimension, | ||
const vector_t & | parameters, | ||
const std::string | name = "Constrained B-Spline" |
||
) |
see B-Spline constructors for documentation
roboptim::trajectory::ConstrainedBSpline< N >::ConstrainedBSpline | ( | interval_t | tr, |
size_type | dimension, | ||
const vector_t & | parameters, | ||
const_vector_ref | knots, | ||
std::string | name = "Constrained B-Spline" |
||
) |
see B-Spline constructors for documentation
|
virtual |
Destructor of constrained B-spline.
void roboptim::trajectory::ConstrainedBSpline< N >::addCoupledConstraint | ( | value_type | t_1, |
size_type | dimension_1, | ||
value_type | t_2, | ||
size_type | dimension_2, | ||
size_type | derivative = 0 , |
||
value_type | factor = 1. |
||
) |
Create a constraint against another part of the spline.
\(\frac{\partial^d}{\partial t^d} f_{d_1}(t_1) = factor * \frac{\partial^d}{\partial t^d} f_{d_2}(t_2) \)
t_1 | first time. |
dimension_1 | first dimension. |
t_2 | second time. |
dimension_2 | second dimension. |
derivative | derivative order ( \(d\)). |
factor | scalar factor. |
References roboptim::trajectory::detail::fixTime().
void roboptim::trajectory::ConstrainedBSpline< N >::addFixedConstraint | ( | double | t, |
size_type | dimension, | ||
value_type | value, | ||
size_type | derivative = 0 |
||
) |
Creates a constraint on the basic spline.
This reduces the number of parameter by one. The constraint equation is: \(value = \frac{\partial^derivative}{\partial t^derivative} f_{dimension}(t) \)
t | time in the spline to constrain. |
dimension | Which dimension of the spline to constrain. |
value | Desired spline value at t. |
derivative | Which derivative of the spline to constrain. |
References roboptim::trajectory::detail::fixTime().
const ConstrainedBSpline< N >::vector_t & roboptim::trajectory::ConstrainedBSpline< N >::parameters | ( | ) | const |
Overloaded parameters method from Trajectory<N>.
Returns only the tunable parameters.
|
virtual |
Clone and resize a trajectory.
timeRange | new time range. |
Reimplemented from roboptim::trajectory::BSpline< N >.
References roboptim::trajectory::ConstrainedBSpline< N >::constraint_values_, roboptim::trajectory::ConstrainedBSpline< N >::constraints_, and roboptim::trajectory::ConstrainedBSpline< N >::tunables_.
roboptim::trajectory::ConstrainedBSpline< N >::ROBOPTIM_NTIMES_DERIVABLE_FUNCTION_FWD_TYPEDEFS_ | ( | BSpline< N > | ) |
Parent type and imports.
|
virtual |
Overloaded setParameters method from Trajectory<N>.
Given the free parameters, it calculates the spline parameters.
Reimplemented from roboptim::trajectory::BSpline< N >.
|
protected |
Update the projector matrix. Called after adding a constraint.
(defined ROBOPTIM_HAS_FENV_H && defined ENABLE_SIGFPE)
|
virtual |
Get the variation of a derivative with respect to parameter vector.
t | value \(t\) in the definition interval. |
order | order \(r\) of the derivative. |
\[ \frac{\partial}{\partial\textbf{p}} \left(\frac{d^r\Gamma_{\textbf{p}}}{dt^r}(t)\right) \]
Implements roboptim::trajectory::Trajectory< N >.
References roboptim::trajectory::Polynomial< N >::derivative().
|
protected |
Constraint values.
Referenced by roboptim::trajectory::ConstrainedBSpline< N >::resize().
|
protected |
Matrix storing constraints.
One row per constraint, one column per parameter.
Referenced by roboptim::trajectory::ConstrainedBSpline< N >::resize().
|
protected |
Projector matrix.
|
protected |
Result of: Constraints * X = Constraint values.
|
protected |
Tunable parameters, i.e. the free parameters.
Referenced by roboptim::trajectory::ConstrainedBSpline< N >::resize().