hpp-constraints  6.0.0
Definition of basic geometric constraints for motion planning
hpp::constraints::Implicit Class Reference

#include <hpp/constraints/implicit.hh>

Inheritance diagram for hpp::constraints::Implicit:

Public Member Functions

bool operator== (const Implicit &other) const
 Operator equality. More...
 
Implicitoperator= (const Implicit &other)
 Operator assignation. More...
 
virtual ImplicitPtr_t copy () const
 Copy object and return shared pointer to copy. More...
 
virtual ~Implicit ()
 
const ComparisonTypes_tcomparisonType () const
 Return the ComparisonType. More...
 
void comparisonType (const ComparisonTypes_t &comp)
 Set the comparison type. More...
 
const segments_tactiveRows () const
 
bool checkAllRowsActive () const
 Check if all rows are active (no inactive rows) More...
 
const Eigen::RowBlockIndicesequalityIndices () const
 Get indices of constraint coordinates that are equality. More...
 
void setInactiveRowsToZero (vectorOut_t error) const
 
DifferentiableFunctionfunction () const
 Return a reference to function \(h\). More...
 
const DifferentiableFunctionPtr_tfunctionPtr () const
 Return a reference to function \(h\). More...
 
virtual std::pair< JointConstPtr_t, JointConstPtr_tdoesConstrainRelPoseBetween (DeviceConstPtr_t robot) const
 
Right hand side
void rightHandSideFromConfig (ConfigurationIn_t config, LiegroupElementRef rhs)
 
bool checkRightHandSide (LiegroupElementConstRef rhs) const
 
size_type parameterSize () const
 
size_type rightHandSideSize () const
 
void rightHandSideFunction (const DifferentiableFunctionPtr_t &rhsF)
 
const DifferentiableFunctionPtr_trightHandSideFunction () const
 
vectorIn_t rightHandSideAt (const value_type &s)
 

Static Public Member Functions

static ImplicitPtr_t create (const DifferentiableFunctionPtr_t &func, ComparisonTypes_t comp, std::vector< bool > mask=std::vector< bool >())
 
static ImplicitPtr_t createCopy (const ImplicitPtr_t &other)
 Create a copy and return shared pointer. More...
 

Protected Member Functions

 Implicit (const DifferentiableFunctionPtr_t &function, ComparisonTypes_t comp, std::vector< bool > mask)
 
 Implicit (const Implicit &other)
 Copy constructor. More...
 
virtual bool isEqual (const Implicit &other, bool swapAndTest) const
 
void init (const ImplicitWkPtr_t &weak)
 
 Implicit ()
 

Friends

class ImplicitConstraintSet
 

Detailed Description

This class represents a parameterizable numerical constraint that compares the output of a function \(h\) to a right hand side Lie group element.

Definition
  • The function \(h\) takes input in a configuration space \(\mathcal{C}\) and output in a Lie group \(\mathbf{L}\),
  • the dimensions of \(\mathbf{L}\) and of its tangent space are respectively \((n_q,n_v)\).
  • The comparison is represented by a vector \(\mathbf{c}\) of dimension \(n_v\) with values in enum hpp::constraints::ComparisonType = { \(\mathbf{Equality}\), \(\mathbf{EqualToZero}\), \(\mathbf{Inferior}\), \(\mathbf{Superior}\) }.
  • The right hand side is Lie group element of dimension \(n_q\).
Error

A configuration \(\mathbf{q}\) is said to satisfy the constraint for a given right hand side if and only if the error \(e\) as computed below is smaller in norm than a given threshold.

Let

\[ \Delta = h (\mathbf{q}) - rhs \in \mathbf{R}^{n_v}, \]

for each component \(i\in\{0,\cdots,n_v-1\}\),

  • if \(c_i\) is \(\mathbf{Inferior}\), \(e_i = \max (0,\Delta_i)\),
  • if \(c_i\) is \(\mathbf{Superior}\), \(e_i = \min (0,\Delta_i)\),
  • if \(c_i\) is \(\mathbf{Equality}\), \(e_i = \Delta_i\),
  • if \(c_i\) is \(\mathbf{EqualToZero}\), \(e_i = \Delta_i\).
Mask

A mask is a vector of Boolean values of size \(n_v\). Values set to false means that the corresponding component of the error defined above is not taken into account to determine whether the constraint is satisfied. The active rows of the constraint may be accessed via method activeRows.

Parameterizable right hand side

Lines with \(\mathbf{Equality}\) comparator in the above definition of the error need a parameter, while lines with comparators \(\mathbf{Inferior}\), \(\mathbf{Superior}\), or \(\mathbf{EqualToZero}\) do not. As a consequence, the right hand side of the constraint is defined by a vector \(\lambda\) of parameters of size the number of \(\mathbf{Equality}\) occurences in vector \(\mathbf{c}\). The right hand side is then defined as in the following example:

\[ rhs = \exp\left(\begin{array}{c}\lambda_1 \\ 0 \\ 0 \\ \lambda_2 \\ \vdots \end{array}\right) \ \ \ \ \mathbf{c} = \left(\begin{array}{c}\mathbf{Equality} \\ \mathbf{EqualToZero} \\ \mathbf{Inferior} \\ \mathbf{Equality} \\ \vdots \end{array}\right) \]

To retrieve the size of vector \(\lambda\), call method Implicit::parameterSize (). To set and get the right hand side value, use method Implicit::rightHandSide.

Time varying right hand side

The right hand side of the constraint may depend on time, for instance if the constraint is associated to a trajectory following task. In this case, the right hand side is a function from \(\mathbf{R}\) to \(\mathbf{L}\).

Constructor & Destructor Documentation

◆ ~Implicit()

virtual hpp::constraints::Implicit::~Implicit ( )
inlinevirtual

◆ Implicit() [1/3]

hpp::constraints::Implicit::Implicit ( const DifferentiableFunctionPtr_t function,
ComparisonTypes_t  comp,
std::vector< bool >  mask 
)
protected

Constructor

Parameters
functionthe differentiable function
compvector of comparison \(\mathbf{c}\).
maskmask defining which components of the error are taken into account to determine whether the constraint is satisfied. \precond sizes of comp and of mask should be equal to size of tangent space to function output space \(\mathbf{L}\).

◆ Implicit() [2/3]

hpp::constraints::Implicit::Implicit ( const Implicit other)
protected

Copy constructor.

◆ Implicit() [3/3]

hpp::constraints::Implicit::Implicit ( )
inlineprotected

Member Function Documentation

◆ activeRows()

const segments_t& hpp::constraints::Implicit::activeRows ( ) const
inline

Return the active rows taken into account to determine whether the constraint is satisfied

◆ checkAllRowsActive()

bool hpp::constraints::Implicit::checkAllRowsActive ( ) const
inline

Check if all rows are active (no inactive rows)

◆ checkRightHandSide()

bool hpp::constraints::Implicit::checkRightHandSide ( LiegroupElementConstRef  rhs) const

Check right hand side with regard to comparison types

Parameters
rhsright hand side,
Returns
true if right hand side is correct

This method checks that elements of the right hand side log corresponding to comparison types different from Equality are equal to 0.

◆ comparisonType() [1/2]

const ComparisonTypes_t& hpp::constraints::Implicit::comparisonType ( ) const

Return the ComparisonType.

◆ comparisonType() [2/2]

void hpp::constraints::Implicit::comparisonType ( const ComparisonTypes_t comp)

Set the comparison type.

◆ copy()

virtual ImplicitPtr_t hpp::constraints::Implicit::copy ( ) const
virtual

◆ create()

static ImplicitPtr_t hpp::constraints::Implicit::create ( const DifferentiableFunctionPtr_t func,
ComparisonTypes_t  comp,
std::vector< bool >  mask = std::vector< bool >() 
)
static

Create a shared pointer to a new instance.

See also
constructors

◆ createCopy()

static ImplicitPtr_t hpp::constraints::Implicit::createCopy ( const ImplicitPtr_t other)
static

Create a copy and return shared pointer.

◆ doesConstrainRelPoseBetween()

virtual std::pair<JointConstPtr_t, JointConstPtr_t> hpp::constraints::Implicit::doesConstrainRelPoseBetween ( DeviceConstPtr_t  robot) const
virtual

Get pair of joints whose relative pose is fully constrained

If the function value depends on the relative pose between j1 and j2 and if the relative pose between j1 and j2 is fully constrained because of Implicit constraint (relative transformation may still differ from one path to another), return these two joints.

Parameters
robotthe device that this constraint is applied to
Returns
the pair of joints constrained, in order of increasing joint index, or a pair of empty shared pointers
Note
absolute pose is considered relative pose with respect to "universe". "universe" is returned as a nullpointer as the first element of the pair, if applicable.

Reimplemented in hpp::constraints::LockedJoint.

◆ equalityIndices()

const Eigen::RowBlockIndices& hpp::constraints::Implicit::equalityIndices ( ) const
inline

Get indices of constraint coordinates that are equality.

◆ function()

DifferentiableFunction& hpp::constraints::Implicit::function ( ) const
inline

Return a reference to function \(h\).

◆ functionPtr()

const DifferentiableFunctionPtr_t& hpp::constraints::Implicit::functionPtr ( ) const
inline

Return a reference to function \(h\).

◆ init()

void hpp::constraints::Implicit::init ( const ImplicitWkPtr_t &  weak)
inlineprotected

◆ isEqual()

virtual bool hpp::constraints::Implicit::isEqual ( const Implicit other,
bool  swapAndTest 
) const
protectedvirtual

Test equality with other instance

Parameters
otherobject to copy
swapAndTestwhether we should also check other == this

Reimplemented in hpp::constraints::LockedJoint, and hpp::constraints::Explicit.

◆ operator=()

Implicit& hpp::constraints::Implicit::operator= ( const Implicit other)
inline

Operator assignation.

◆ operator==()

bool hpp::constraints::Implicit::operator== ( const Implicit other) const

Operator equality.

◆ parameterSize()

size_type hpp::constraints::Implicit::parameterSize ( ) const

Get size of parameter defining the right hand side of the constraint

See class documentation for details.

◆ rightHandSideAt()

vectorIn_t hpp::constraints::Implicit::rightHandSideAt ( const value_type s)

Evaluate and set right hand side at given time

Parameters
stime

◆ rightHandSideFromConfig()

void hpp::constraints::Implicit::rightHandSideFromConfig ( ConfigurationIn_t  config,
LiegroupElementRef  rhs 
)

Computes the right hand side from a configuration

in such a way that the configuration satisfies the numerical constraints

Parameters
configthe input configuration.
Return values
rhsright hand side as a Lie group element. \precond rhs should be initialized with the right LiegroupSpace (ie the output space of the function).
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.

◆ rightHandSideFunction() [1/2]

const DifferentiableFunctionPtr_t& hpp::constraints::Implicit::rightHandSideFunction ( ) const
inline

Get time-varying right hand side

Returns
the mapping from \(\mathbf{R}\) to output space \(\mathbf{L}\) of \(h\) defining the variation along time of the right hand side.

◆ rightHandSideFunction() [2/2]

void hpp::constraints::Implicit::rightHandSideFunction ( const DifferentiableFunctionPtr_t rhsF)

Set time-varying right hand side

Parameters
rhsFMapping from \(\mathbf{R}\) to output space \(\mathbf{L}\) of \(h\) defining the variation along time of the right hand side.

◆ rightHandSideSize()

size_type hpp::constraints::Implicit::rightHandSideSize ( ) const

Get size of right hand side of the constraint

This is the dimension (nq) of the output space of the function

◆ setInactiveRowsToZero()

void hpp::constraints::Implicit::setInactiveRowsToZero ( vectorOut_t  error) const

Set inactive components of error to 0

Return values
errorerror vector computed by substracting a right hand side to the output to the value of the function.

Friends And Related Function Documentation

◆ ImplicitConstraintSet

friend class ImplicitConstraintSet
friend

The documentation for this class was generated from the following file: