hpp-constraints
6.0.0
Definition of basic geometric constraints for motion planning
|
#include <hpp/constraints/solver/hierarchical-iterative.hh>
Classes | |
struct | Data |
Public Types | |
enum | Status { ERROR_INCREASED , MAX_ITERATION_REACHED , INFEASIBLE , SUCCESS } |
typedef Eigen::RowBlockIndices | Indices_t |
typedef lineSearch::FixedSequence | DefaultLineSearch |
typedef shared_ptr< saturation::Base > | Saturation_t |
Public Member Functions | |
HierarchicalIterative (const LiegroupSpacePtr_t &configSpace) | |
HierarchicalIterative (const HierarchicalIterative &other) | |
virtual | ~HierarchicalIterative () |
value_type | residualError () const |
Returns the squared norm of the error vector. More... | |
void | residualError (vectorOut_t error) const |
Returns the error vector. More... | |
bool | definesSubmanifoldOf (const HierarchicalIterative &solver) const |
virtual std::ostream & | print (std::ostream &os) const |
template<typename LineSearchType > | |
solver::HierarchicalIterative::Status | solve (vectorOut_t arg, LineSearchType lineSearch) const |
Problem definition | |
const LiegroupSpacePtr_t & | configSpace () const |
Get configuration space on which constraints are defined. More... | |
virtual bool | contains (const ImplicitPtr_t &numericalConstraint) const |
virtual bool | add (const ImplicitPtr_t &constraint, const std::size_t &priority) |
virtual void | merge (const HierarchicalIterative &other) |
void | saturation (const Saturation_t &saturate) |
Set the saturation function. More... | |
const Saturation_t & | saturation () const |
Get the saturation function. More... | |
Problem resolution | |
template<typename LineSearchType > | |
Status | solve (vectorOut_t arg, LineSearchType ls=LineSearchType()) const |
Status | solve (vectorOut_t arg) const |
bool | isSatisfied (vectorIn_t arg) const |
bool | isSatisfied (vectorIn_t arg, value_type errorThreshold) const |
bool | isConstraintSatisfied (const ImplicitPtr_t &constraint, vectorIn_t arg, vectorOut_t error, bool &constraintFound) const |
const value_type & | sigma () const |
Parameters | |
void | freeVariables (const segments_t intervals) |
void | freeVariables (const Indices_t &indices) |
const Indices_t & | freeVariables () const |
Get free velocity variables. 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 error threshold. More... | |
value_type | squaredErrorThreshold () const |
Get error threshold. More... | |
value_type | inequalityThreshold () const |
Get the inequality threshold. More... | |
void | inequalityThreshold (const value_type &it) |
set the inequality threshold More... | |
void | lastIsOptional (bool optional) |
bool | lastIsOptional () const |
void | solveLevelByLevel (bool solveLevelByLevel) |
bool | solveLevelByLevel () const |
Stack | |
const ImplicitConstraintSet & | constraints (const std::size_t priority) |
Get set of constraints for a give priority level. More... | |
const NumericalConstraints_t & | constraints () const |
Get constraints (implicit and explicit) More... | |
std::size_t | numberStacks () const |
const size_type & | dimension () const |
const size_type & | reducedDimension () const |
ArrayXb | activeParameters () const |
Configuration parameters involved in the constraint resolution. More... | |
ArrayXb | activeDerivativeParameters () const |
Velocity parameters involved in the constraint resolution. More... | |
Right hand side accessors | |
vector_t | rightHandSideFromConfig (ConfigurationIn_t config) |
virtual bool | rightHandSideFromConfig (const ImplicitPtr_t &constraint, ConfigurationIn_t config) |
virtual bool | rightHandSide (const ImplicitPtr_t &constraint, vectorIn_t rhs) |
virtual bool | getRightHandSide (const ImplicitPtr_t &constraint, vectorOut_t rhs) const |
Get right hand side of a constraints. More... | |
virtual void | rightHandSide (vectorIn_t rhs) |
void | rightHandSideAt (const value_type &s) |
vector_t | rightHandSide () const |
size_type | rightHandSideSize () const |
Access to internal data | |
You should know what you do when you call these functions | |
template<bool ComputeJac> | |
void | computeValue (vectorIn_t arg) const |
Compute the value of each level, and the jacobian if ComputeJac is true. More... | |
void | computeSaturation (vectorIn_t arg) const |
void | getValue (vectorOut_t v) const |
void | getReducedJacobian (matrixOut_t J) const |
void | computeError () const |
const vector_t & | lastStep () const |
Accessor to the last step done. More... | |
virtual bool | integrate (vectorIn_t from, vectorIn_t velocity, vectorOut_t result) const |
Protected Types | |
typedef Eigen::JacobiSVD< matrix_t > | SVD_t |
Protected Member Functions | |
void | update () |
virtual void | computeActiveRowsOfJ (std::size_t iStack) |
void | computeDescentDirection () const |
void | expandDqSmall () const |
void | saturate (vectorOut_t arg) const |
HierarchicalIterative () | |
Friends | |
struct | lineSearch::Backtracking |
Solve a system of non-linear equations on a robot configuration
The non-linear system of equations is built by adding equations with method HierarchicalIterative::add.
Note that a hierarchy between the equations can be provided. In this case, the solver will try to solve the highest priority equations first, and then to solve the lower priority equations. Note that priorities are in decreasing order: 0 has higher priority than 1.
The algorithm used is a Newton-Raphson like algorithm that works as follows: for a single level of priority, let \(f (\mathbf{q}) = 0\) be the system of equations where \(f\) is a \(C^1\) mapping from the robot configuration space to a Lie group space \(\mathcal{L}\).
Starting from initial guess \(\mathbf{q}_0\), the method HierarchicalIterative::solve builds a sequence of configurations \(\mathbf{q}_i\) as follows:
\begin{eqnarray*} \mathbf{q}_{i+1} = \mathbf{q}_i - \alpha_i \frac{\partial f}{\partial \mathbf{q}}(\mathbf{q}_i)^{+} f (\mathbf{q}_i) \end{eqnarray*}
where
The computation of the direction of descent in the case of multiple level of hierarchy is described in this paper.
The error threshold can be accessed by methods HierarchicalIterative::errorThreshold. The maximal number of iterations can be accessed by methods HierarchicalIterative::maxIterations.
For some applications, it can be more efficient to solve a set of equations one after the other. In other words, an equation is ignored until the previous one is solved (norm below the threshold). To do so, introduce the equations using method HierarchicalIterative::add with increasing value of priority
, and call method HierarchicalIterative::solveLevelByLevel(true)
.
The unknowns \(\mathbf{q}\) may take values in a more general set than the configuration space of a robot. This set should be a Cartesian product of Lie groups: hpp::pinocchio::LiegroupSpace.
Instead of \(f(\mathbf{q}) = 0\), other constraints can be defined. Several comparison types are available:
Some variables can be locked, or computed explicitely. In this case, the iterative resolution will only change the other variables called free variables.
typedef lineSearch::FixedSequence hpp::constraints::solver::HierarchicalIterative::DefaultLineSearch |
typedef shared_ptr<saturation::Base> hpp::constraints::solver::HierarchicalIterative::Saturation_t |
|
protected |
hpp::constraints::solver::HierarchicalIterative::HierarchicalIterative | ( | const LiegroupSpacePtr_t & | configSpace | ) |
hpp::constraints::solver::HierarchicalIterative::HierarchicalIterative | ( | const HierarchicalIterative & | other | ) |
|
inlinevirtual |
|
inlineprotected |
ArrayXb hpp::constraints::solver::HierarchicalIterative::activeDerivativeParameters | ( | ) | const |
Velocity parameters involved in the constraint resolution.
ArrayXb hpp::constraints::solver::HierarchicalIterative::activeParameters | ( | ) | const |
Configuration parameters involved in the constraint resolution.
|
virtual |
Add an implicit constraint
constraint | implicit constraint |
priority | level of priority of the constraint: priority are in decreasing order: 0 is the highest priority level, |
Reimplemented in hpp::constraints::solver::BySubstitution.
|
protectedvirtual |
Compute which rows of the jacobian of stack_[iStack] are not zero, using the activeDerivativeParameters of the functions. The result is stored in datas_[i].activeRowsOfJ
Reimplemented in hpp::constraints::solver::BySubstitution.
|
protected |
Compute a SVD decomposition of each level and find the best descent direction at the first order. Linearization of the system of equations rhs - v_{i} = J (q_i) (dq_{i+1} - q_{i}) q_{i+1} - q_{i} = J(q_i)^{+} ( rhs - v_{i} ) dq = J(q_i)^{+} ( rhs - v_{i} )
void hpp::constraints::solver::HierarchicalIterative::computeError | ( | ) | const |
If lastIsOptional() is true, then the last level is ignored.
void hpp::constraints::solver::HierarchicalIterative::computeSaturation | ( | vectorIn_t | arg | ) | const |
void hpp::constraints::solver::HierarchicalIterative::computeValue | ( | vectorIn_t | arg | ) | const |
Compute the value of each level, and the jacobian if ComputeJac is true.
|
inline |
Get configuration space on which constraints are defined.
|
inline |
Get constraints (implicit and explicit)
|
inline |
Get set of constraints for a give priority level.
|
virtual |
Check whether a numerical constraint has been added
numericalConstraint | numerical constraint |
bool hpp::constraints::solver::HierarchicalIterative::definesSubmanifoldOf | ( | const HierarchicalIterative & | solver | ) | const |
Inclusion of manifolds
solver | another solver |
This function returns true if the solution manifold of the solver given as input is a submanifold of the solution manifold of this solver. The function tests whether constraints of the input solver are also in this solver.
|
inline |
|
inline |
Get error threshold.
|
inline |
Set error threshold.
|
protected |
|
inline |
Get free velocity variables.
|
inline |
Set free velocity variables
The other variables will be left unchanged by the iterative resolution.
|
inline |
Set free velocity variables
The other variables will be left unchanged by the iterative resolution.
intervals | set of index intervals |
void hpp::constraints::solver::HierarchicalIterative::getReducedJacobian | ( | matrixOut_t | J | ) | const |
|
virtual |
Get right hand side of a constraints.
Reimplemented in hpp::constraints::solver::BySubstitution.
void hpp::constraints::solver::HierarchicalIterative::getValue | ( | vectorOut_t | v | ) | const |
|
inline |
Get the inequality threshold.
|
inline |
set the inequality threshold
|
virtual |
Reimplemented in hpp::constraints::solver::BySubstitution.
bool hpp::constraints::solver::HierarchicalIterative::isConstraintSatisfied | ( | const ImplicitPtr_t & | constraint, |
vectorIn_t | arg, | ||
vectorOut_t | error, | ||
bool & | constraintFound | ||
) | const |
Whether a constraint is satisfied for an input vector
constraint,the | constraint in the solver, |
arg | the input vector |
error | the error of the constraint. |
constraintFound | whether the constraint belongs to the solver, |
|
inline |
Whether input vector satisfies the constraints of the solver
arg | input vector Compares to internal error threshold. |
|
inline |
Whether input vector satisfies the constraints of the solver
arg | input vector |
errorThreshold | threshold to use instead of the value stored in the solver. |
|
inline |
|
inline |
|
inline |
Accessor to the last step done.
|
inline |
Get maximal number of iterations in config projector.
|
inline |
Set maximal number of iterations.
|
virtual |
add constraints of another solver
other | other solver |
Add constraints of other to this solver.
|
inline |
|
virtual |
Reimplemented in hpp::constraints::solver::BySubstitution.
|
inline |
Dimension of the problem after removing the rows of the jacobian which do not influence the error (only zeros along those lines).
|
inline |
Returns the squared norm of the error vector.
void hpp::constraints::solver::HierarchicalIterative::residualError | ( | vectorOut_t | error | ) | const |
Returns the error vector.
vector_t hpp::constraints::solver::HierarchicalIterative::rightHandSide | ( | ) | const |
Get the right hand side
|
virtual |
Set right hand side of a constraints
constraint | the constraint, |
rhs | right hand side. |
Reimplemented in hpp::constraints::solver::BySubstitution.
|
virtual |
Set the right hand side
rhs | the right hand side |
Reimplemented in hpp::constraints::solver::BySubstitution.
void hpp::constraints::solver::HierarchicalIterative::rightHandSideAt | ( | const value_type & | s | ) |
Set the right hand side at a given parameter.
s | parameter passed to Implicit::rightHandSideAt |
vector_t hpp::constraints::solver::HierarchicalIterative::rightHandSideFromConfig | ( | ConfigurationIn_t | config | ) |
Compute right hand side of equality constraints from a configuration
config | a configuration. |
for each constraint of type Equality, set right hand side as \(rhs = f(\mathbf{q})\).
|
virtual |
Compute right hand side of a constraint from a configuration
constraint | the constraint, |
config | a configuration. |
Set right hand side as \(rhs = f(\mathbf{q})\).
Reimplemented in hpp::constraints::solver::BySubstitution.
size_type hpp::constraints::solver::HierarchicalIterative::rightHandSideSize | ( | ) | const |
Get size of the right hand side
|
protected |
|
inline |
Get the saturation function.
|
inline |
Set the saturation function.
|
inline |
Returns the lowest singular value. If the jacobian has maximum rank r, then it corresponds to r-th greatest singular value. This value is zero when the jacobian is singular.
|
inline |
Solve the system of non linear equations
arg | initial guess, |
Use Newton Rhapson like iterative method until the error is below the threshold, or until the maximal number of iterations has been reached. Use the default line search method (fixed sequence of \(\alpha_i\)).
|
inline |
Status hpp::constraints::solver::HierarchicalIterative::solve | ( | vectorOut_t | arg, |
LineSearchType | ls = LineSearchType() |
||
) | const |
Solve the system of non linear equations
arg | initial guess, |
ls | line search method used. |
Use Newton Rhapson like iterative method until the error is below the threshold, or until the maximal number of iterations has been reached.
|
inline |
|
inline |
|
inline |
Get error threshold.
|
protected |
Allocate datas and update sizes of the problem Should be called whenever the stack is modified.
|
friend |
|
protected |
|
protected |
Members moved from core::ConfigProjector.
|
mutableprotected |
|
protected |
|
mutableprotected |
|
protected |
|
protected |
Unknown of the set of implicit constraints.
|
protected |
|
protected |
Value rank of constraint in its priority level.
|
protected |
Derivative rank of constraint in its priority level.
|
protected |
|
protected |
|
mutableprotected |
|
mutableprotected |
|
protected |
Priority level of constraint.
|
mutableprotected |
|
protected |
|
mutableprotected |
|
protected |
|
protected |
|
mutableprotected |
|
mutableprotected |
The smallest non-zero singular value.
|
protected |
|
protected |
|
mutableprotected |
|
protected |
|
mutableprotected |
|
mutableprotected |