mc_solver::CollisionsConstraint Class Reference

#include <mc_solver/CollisionsConstraint.h>

Inheritance diagram for mc_solver::CollisionsConstraint:
Collaboration diagram for mc_solver::CollisionsConstraint:

Public Member Functions

 CollisionsConstraint (const mc_rbdyn::Robots &robots, unsigned int r1Index, unsigned int r2Index, double timeStep)
 
bool removeCollision (QPSolver &solver, const std::string &b1Name, const std::string &b2Name)
 
void removeCollisions (QPSolver &solver, const std::vector< mc_rbdyn::Collision > &cols)
 
bool removeCollisionByBody (QPSolver &solver, const std::string &byName, const std::string &b2Name)
 
void addCollision (QPSolver &solver, const mc_rbdyn::Collision &col)
 
void addCollisions (QPSolver &solver, const std::vector< mc_rbdyn::Collision > &cols)
 
bool hasCollision (const std::string &c1, const std::string &c2) const noexcept
 
void reset ()
 
bool automaticMonitor () const noexcept
 
void automaticMonitor (bool a) noexcept
 
void addToSolverImpl (QPSolver &solver) override
 
void update (QPSolver &solver) override
 Update the constraint. More...
 
void removeFromSolverImpl (QPSolver &solver) override
 
- Public Member Functions inherited from mc_solver::ConstraintSet
 ConstraintSet ()
 
void addToSolver (mc_solver::QPSolver &solver)
 
void removeFromSolver (mc_solver::QPSolver &solver)
 
virtual ~ConstraintSet ()
 
bool inSolver () const noexcept
 
QPSolver::Backend backend () const noexcept
 

Public Attributes

mc_rtc::void_ptr constraint_
 
unsigned int r1Index
 
unsigned int r2Index
 
std::vector< mc_rbdyn::Collisioncols
 

Static Public Attributes

constexpr static double defaultDampingOffset = 0.1
 

Additional Inherited Members

- Protected Attributes inherited from mc_solver::ConstraintSet
QPSolver::Backend backend_
 
bool inSolver_ = false
 

Detailed Description

Creates a collision constraint manager between two robots.

If the two robots are the same, this effectively creates a self-collision constraint

Constructor & Destructor Documentation

◆ CollisionsConstraint()

mc_solver::CollisionsConstraint::CollisionsConstraint ( const mc_rbdyn::Robots robots,
unsigned int  r1Index,
unsigned int  r2Index,
double  timeStep 
)

Constructor

Parameters
robotsThe robots for which the constraint will apply
r1IndexIndex of the first robot affected by the constraint
r2IndexIndex of the second robot affected by the constraint
TimesteptimeStep of the control

Member Function Documentation

◆ addCollision()

void mc_solver::CollisionsConstraint::addCollision ( QPSolver solver,
const mc_rbdyn::Collision col 
)

Add a collision represented by mc_rbdyn::Collision

The collision object is allowed to specify wildcard names to add multiple collisions at once, if body1 is named bodyA* and body2 is named bodyB* then collision constraints will be added for all convex objects in robot1 (resp. robot2) that start with bodyA (resp. bodyB)

Parameters
solverThe solver into which this constraint was added
colThe collision that should be added

◆ addCollisions()

void mc_solver::CollisionsConstraint::addCollisions ( QPSolver solver,
const std::vector< mc_rbdyn::Collision > &  cols 
)

Add a set of collisions

See also
addCollision for details on wildcard collision specification
Parameters
solverThe solver into which this constraint was added
colsThe set of collisions that should be added

◆ addToSolverImpl()

void mc_solver::CollisionsConstraint::addToSolverImpl ( QPSolver solver)
overridevirtual

Should take care of the actual insertion into a concrete solver

Implements mc_solver::ConstraintSet.

◆ automaticMonitor() [1/2]

bool mc_solver::CollisionsConstraint::automaticMonitor ( ) const
inlinenoexcept

Get the automated monitoring setting

◆ automaticMonitor() [2/2]

void mc_solver::CollisionsConstraint::automaticMonitor ( bool  a)
inlinenoexcept

Set the automated monitoring setting

If true collisions, monitors are automatically added/removed depending on the collision activation

If false, monitors are managed by the user

◆ hasCollision()

bool mc_solver::CollisionsConstraint::hasCollision ( const std::string &  c1,
const std::string &  c2 
) const
noexcept

Returns true if the given collision is in this constraint

◆ removeCollision()

bool mc_solver::CollisionsConstraint::removeCollision ( QPSolver solver,
const std::string &  b1Name,
const std::string &  b2Name 
)

Remove a collision between two convexes

Parameters
solverThe solver into which this constraint was added
b1NameName of the first convex
b2NameName of the second convex
Returns
True if the collision was found and removed, false otherwise

◆ removeCollisionByBody()

bool mc_solver::CollisionsConstraint::removeCollisionByBody ( QPSolver solver,
const std::string &  byName,
const std::string &  b2Name 
)

Remove all collisions between two bodies

Parameters
solverThe solver into which this constraint was added
b1NameName of the first body
b2NameName of the second body
Returns
True if at least one collision was removed, false otherwise

◆ removeCollisions()

void mc_solver::CollisionsConstraint::removeCollisions ( QPSolver solver,
const std::vector< mc_rbdyn::Collision > &  cols 
)

Remove a set of collisions

Parameters
solverThe solver into which this constraint was added
colsList of collisions to remove

◆ removeFromSolverImpl()

void mc_solver::CollisionsConstraint::removeFromSolverImpl ( QPSolver solver)
overridevirtual

Should take care of the actual removal from a concrete solver

Implements mc_solver::ConstraintSet.

◆ reset()

void mc_solver::CollisionsConstraint::reset ( )

Remove all collisions from the constraint

◆ update()

void mc_solver::CollisionsConstraint::update ( QPSolver )
overridevirtual

Update the constraint.

This is called at every iteration of the controller once the constraint has been added to a solver

Parameters
solverSolver in which the constraint has been inserted

Reimplemented from mc_solver::ConstraintSet.

Member Data Documentation

◆ cols

std::vector<mc_rbdyn::Collision> mc_solver::CollisionsConstraint::cols

Curent set of collisions

◆ constraint_

mc_rtc::void_ptr mc_solver::CollisionsConstraint::constraint_

Holds the constraint implementation

In Tasks backend:

  • tasks::qp::CollisionConstr

In TVM backend:

  • details::TVMCollisionConstraint

◆ defaultDampingOffset

constexpr static double mc_solver::CollisionsConstraint::defaultDampingOffset = 0.1
staticconstexpr

Default value of damping offset

◆ r1Index

unsigned int mc_solver::CollisionsConstraint::r1Index

Index of the first robot affected by the constraint

◆ r2Index

unsigned int mc_solver::CollisionsConstraint::r2Index

Index of the second robot affected by the constraint


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