hpp::core::ConfigProjector Class Reference

Implicit non-linear constraint. More...

#include <hpp/core/config-projector.hh>

Inheritance diagram for hpp::core::ConfigProjector:
Collaboration diagram for hpp::core::ConfigProjector:

Public Member Functions

void addFunction (const DifferentiableFunctionPtr_t &function, ComparisonTypePtr_t comp=ComparisonType::createDefault()) HPP_CORE_DEPRECATED
 Add a function. More...
 
void addConstraint (const DifferentiableFunctionPtr_t &constraint, ComparisonTypePtr_t comp=ComparisonType::createDefault()) HPP_CORE_DEPRECATED
 Add constraint. More...
 
void add (const NumericalConstraintPtr_t &numericalConstraint, const SizeIntervals_t &passiveDofs=SizeIntervals_t(0))
 Add a numerical constraint. More...
 
void add (const LockedJointPtr_t &lockedJoint)
 Add a locked joint. More...
 
const DevicePtr_trobot () const
 Get robot. More...
 
virtual void projectOnKernel (ConfigurationIn_t from, ConfigurationIn_t to, ConfigurationOut_t result)
 Project configuration "to" on constraint tangent space in "from". More...
 
void maxIterations (size_type iterations)
 Set maximal number of iterations. More...
 
size_type maxIterations () const
 Get maximal number of iterations in config projector. More...
 
void errorThreshold (const value_type &threshold)
 Set error threshold. More...
 
value_type errorThreshold () const
 Get errorimal number of threshold in config projector. More...
 
value_type residualError () const
 
virtual bool isSatisfied (ConfigurationIn_t config)
 Check whether a configuration statisfies the constraint. More...
 
::hpp::statistics::SuccessStatistics & statistics ()
 Get the statistics. More...
 
Right hand side of equalities - inequalities
vector_t rightHandSideFromConfig (ConfigurationIn_t config)
 Set the right hand side from a configuration. More...
 
void rightHandSide (const vector_t &param)
 Set the level set parameter. More...
 
vector_t rightHandSide () const
 Get the level set parameter. More...
 
void updateRightHandSide ()
 Regenerate the right hand side from the numerical constraint right hand sides. More...
 
- Public Member Functions inherited from hpp::core::Constraint
bool apply (ConfigurationOut_t configuration)
 Function that applies the constraint. More...
 
const std::string & name () const
 Get name of constraint. More...
 

Static Public Member Functions

static ConfigProjectorPtr_t create (const DevicePtr_t &robot, const std::string &name, value_type errorThreshold, size_type maxIterations)
 Return shared pointer to new object. More...
 

Protected Member Functions

 ConfigProjector (const DevicePtr_t &robot, const std::string &name, value_type errorThreshold, size_type maxIterations)
 Constructor. More...
 
void init (const ConfigProjectorPtr_t &self)
 Store weak pointer to itself. More...
 
virtual bool impl_compute (ConfigurationOut_t configuration)
 Numerically solve constraint. More...
 
void computeLockedDofs (ConfigurationOut_t configuration)
 Set locked degrees of freedom to their locked values. More...
 
- Protected Member Functions inherited from hpp::core::Constraint
 Constraint (const std::string &name)
 Constructor. More...
 
void init (const ConstraintPtr_t &self)
 Store shared pointer to itself. More...
 

Detailed Description

Implicit non-linear constraint.

This class defines a numerical constraints on a robot configuration of the form:

\begin{eqnarray*} f_1 (\mathbf{q}) & = \mbox{or} \leq & f_1^0 \\ & \vdots\\ f_m (\mathbf{q}) & = \mbox{or} \leq & f_m^0 \end{eqnarray*}

Functions $f_i$ are differentiable functions. Vectors $f_i^0$ are called right hand side.

The constraints are solved numerically by a Newton Raphson like method. Instances store locked degrees of freedom for performance optimisation.

Numerical constraints can be added using method ConfigProjector::addFunction. Default parameter of this method define equality constraints, but inequality constraints can also be defined by passing an object of type ComparisonType to method.

Constructor & Destructor Documentation

◆ ConfigProjector()

hpp::core::ConfigProjector::ConfigProjector ( const DevicePtr_t robot,
const std::string &  name,
value_type  errorThreshold,
size_type  maxIterations 
)
protected

Constructor.

Parameters
robotrobot the constraint applies to.
errorThresholdnorm of the value of the constraint under which the constraint is considered satified,
maxIterationsmaximal number of iteration in the resolution of the constraint.

Member Function Documentation

◆ add() [1/2]

void hpp::core::ConfigProjector::add ( const NumericalConstraintPtr_t numericalConstraint,
const SizeIntervals_t passiveDofs = SizeIntervals_t(0) 
)

Add a numerical constraint.

Parameters
numericalConstraintThe numerical constraint.
passiveDofscolumn indexes of the jacobian vector that will be set to zero when solving.
Note
The intervals are interpreted as a list of couple (index_start, length) and NOT as (index_start, index_end).

◆ add() [2/2]

void hpp::core::ConfigProjector::add ( const LockedJointPtr_t lockedJoint)

Add a locked joint.

Parameters
lockedJointThe locked joint.

◆ addConstraint()

void hpp::core::ConfigProjector::addConstraint ( const DifferentiableFunctionPtr_t constraint,
ComparisonTypePtr_t  comp = ComparisonType::createDefault () 
)
inline

Add constraint.

Parameters
constraintThe function.
compFor equality constraint, keep the default value. For inequality constraint, it does a comparison to whether the constraint is active.
Deprecated:
Use hpp::core::ConfigProjector::add (NumericalConstraintPtr_t) instead.

References hpp::core::NumericalConstraint::create().

◆ addFunction()

void hpp::core::ConfigProjector::addFunction ( const DifferentiableFunctionPtr_t function,
ComparisonTypePtr_t  comp = ComparisonType::createDefault() 
)
inline

Add a function.

Parameters
functionThe function.
compFor equality constraint, keep the default value. For inequality constraint, it does a comparison to whether the constraint is active.
Deprecated:
Use hpp::core::ConfigProjector::add (NumericalConstraintPtr_t) instead.

References hpp::core::NumericalConstraint::create().

◆ computeLockedDofs()

void hpp::core::ConfigProjector::computeLockedDofs ( ConfigurationOut_t  configuration)
protected

Set locked degrees of freedom to their locked values.

◆ create()

static ConfigProjectorPtr_t hpp::core::ConfigProjector::create ( const DevicePtr_t robot,
const std::string &  name,
value_type  errorThreshold,
size_type  maxIterations 
)
static

Return shared pointer to new object.

Parameters
robotrobot the constraint applies to.
errorThresholdnorm of the value of the constraint under which the constraint is considered satified,
maxIterationsmaximal number of iteration in the resolution of the constraint.

◆ errorThreshold() [1/2]

void hpp::core::ConfigProjector::errorThreshold ( const value_type threshold)
inline

Set error threshold.

◆ errorThreshold() [2/2]

value_type hpp::core::ConfigProjector::errorThreshold ( ) const
inline

Get errorimal number of threshold in config projector.

◆ impl_compute()

virtual bool hpp::core::ConfigProjector::impl_compute ( ConfigurationOut_t  configuration)
protectedvirtual

Numerically solve constraint.

Implements hpp::core::Constraint.

◆ init()

void hpp::core::ConfigProjector::init ( const ConfigProjectorPtr_t self)
inlineprotected

Store weak pointer to itself.

References hpp::core::Constraint::init().

◆ isSatisfied()

virtual bool hpp::core::ConfigProjector::isSatisfied ( ConfigurationIn_t  config)
virtual

Check whether a configuration statisfies the constraint.

Implements hpp::core::Constraint.

◆ maxIterations() [1/2]

void hpp::core::ConfigProjector::maxIterations ( size_type  iterations)
inline

Set maximal number of iterations.

◆ maxIterations() [2/2]

size_type hpp::core::ConfigProjector::maxIterations ( ) const
inline

Get maximal number of iterations in config projector.

◆ projectOnKernel()

virtual void hpp::core::ConfigProjector::projectOnKernel ( ConfigurationIn_t  from,
ConfigurationIn_t  to,
ConfigurationOut_t  result 
)
virtual

Project configuration "to" on constraint tangent space in "from".

Parameters
fromconfiguration,
toconfiguration to project

\[ \textbf{q}_{res} = \textbf{q}_{from} + \left(I_n - J^{+}J(\textbf{q}_{from})\right) (\textbf{q}_{to} - \textbf{q}_{from}) \]

◆ residualError()

value_type hpp::core::ConfigProjector::residualError ( ) const
inline

◆ rightHandSide() [1/2]

void hpp::core::ConfigProjector::rightHandSide ( const vector_t param)

Set the level set parameter.

Parameters
paramthe level set parameter.

◆ rightHandSide() [2/2]

vector_t hpp::core::ConfigProjector::rightHandSide ( ) const

Get the level set parameter.

Returns
the parameter.

◆ rightHandSideFromConfig()

vector_t hpp::core::ConfigProjector::rightHandSideFromConfig ( ConfigurationIn_t  config)

Set the right hand side from a configuration.

in such a way that the configuration satisfies the numerical constraints

Parameters
configthe input configuration.
Returns
the right hand side
Warning
Only values of the right hand side corresponding to "equality constraints" are set. As a result, the input configuration may not satisfy the other constraints. The rationale is the following. Equality constraints define a foliation of the configuration space. Leaves of the foliation are defined by the value of the right hand side of the equality constraints. This method is mainly used in manipulation planning to retrieve the leaf a configuration lies on.

◆ robot()

const DevicePtr_t& hpp::core::ConfigProjector::robot ( ) const
inline

Get robot.

◆ statistics()

::hpp::statistics::SuccessStatistics& hpp::core::ConfigProjector::statistics ( )
inline

Get the statistics.

◆ updateRightHandSide()

void hpp::core::ConfigProjector::updateRightHandSide ( )

Regenerate the right hand side from the numerical constraint right hand sides.

Note
Class NumericalConstraint contains a cache for its own RHS. Its value is simply copied in the ConfigProjector RHS. This allow a finer control on the RHS.