#include <mc_solver/CollisionsConstraint.h>
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::Collision > | cols |
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 |
Creates a collision constraint manager between two robots.
If the two robots are the same, this effectively creates a self-collision constraint
mc_solver::CollisionsConstraint::CollisionsConstraint | ( | const mc_rbdyn::Robots & | robots, |
unsigned int | r1Index, | ||
unsigned int | r2Index, | ||
double | timeStep | ||
) |
Constructor
robots | The robots for which the constraint will apply |
r1Index | Index of the first robot affected by the constraint |
r2Index | Index of the second robot affected by the constraint |
Timestep | timeStep of the control |
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)
solver | The solver into which this constraint was added |
col | The collision that should be added |
void mc_solver::CollisionsConstraint::addCollisions | ( | QPSolver & | solver, |
const std::vector< mc_rbdyn::Collision > & | cols | ||
) |
Add a set of collisions
solver | The solver into which this constraint was added |
cols | The set of collisions that should be added |
|
overridevirtual |
Should take care of the actual insertion into a concrete solver
Implements mc_solver::ConstraintSet.
|
inlinenoexcept |
Get the automated monitoring setting
|
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
|
noexcept |
Returns true if the given collision is in this constraint
bool mc_solver::CollisionsConstraint::removeCollision | ( | QPSolver & | solver, |
const std::string & | b1Name, | ||
const std::string & | b2Name | ||
) |
Remove a collision between two convexes
solver | The solver into which this constraint was added |
b1Name | Name of the first convex |
b2Name | Name of the second convex |
bool mc_solver::CollisionsConstraint::removeCollisionByBody | ( | QPSolver & | solver, |
const std::string & | byName, | ||
const std::string & | b2Name | ||
) |
Remove all collisions between two bodies
solver | The solver into which this constraint was added |
b1Name | Name of the first body |
b2Name | Name of the second body |
void mc_solver::CollisionsConstraint::removeCollisions | ( | QPSolver & | solver, |
const std::vector< mc_rbdyn::Collision > & | cols | ||
) |
Remove a set of collisions
solver | The solver into which this constraint was added |
cols | List of collisions to remove |
|
overridevirtual |
Should take care of the actual removal from a concrete solver
Implements mc_solver::ConstraintSet.
void mc_solver::CollisionsConstraint::reset | ( | ) |
Remove all collisions from the constraint
|
overridevirtual |
Update the constraint.
This is called at every iteration of the controller once the constraint has been added to a solver
solver | Solver in which the constraint has been inserted |
Reimplemented from mc_solver::ConstraintSet.
std::vector<mc_rbdyn::Collision> mc_solver::CollisionsConstraint::cols |
Curent set of collisions
mc_rtc::void_ptr mc_solver::CollisionsConstraint::constraint_ |
Holds the constraint implementation
In Tasks backend:
In TVM backend:
|
staticconstexpr |
Default value of damping offset
unsigned int mc_solver::CollisionsConstraint::r1Index |
Index of the first robot affected by the constraint
unsigned int mc_solver::CollisionsConstraint::r2Index |
Index of the second robot affected by the constraint