DART
6.10.1
|
ConstraintSolver manages constraints and computes constraint impulses. More...
#include <ConstraintSolver.hpp>
Public Member Functions | |
ConstraintSolver (double timeStep) | |
Constructor. More... | |
ConstraintSolver () | |
Default constructor. More... | |
ConstraintSolver (const ConstraintSolver &other)=delete | |
Copy constructor. More... | |
virtual | ~ConstraintSolver ()=default |
Destructor. More... | |
void | addSkeleton (const dynamics::SkeletonPtr &skeleton) |
Add single skeleton. More... | |
void | addSkeletons (const std::vector< dynamics::SkeletonPtr > &skeletons) |
Add mutiple skeletons. More... | |
const std::vector< dynamics::SkeletonPtr > & | getSkeletons () const |
Returns all the skeletons added to this ConstraintSolver. More... | |
void | removeSkeleton (const dynamics::SkeletonPtr &skeleton) |
Remove single skeleton. More... | |
void | removeSkeletons (const std::vector< dynamics::SkeletonPtr > &skeletons) |
Remove multiple skeletons. More... | |
void | removeAllSkeletons () |
Remove all skeletons in this constraint solver. More... | |
void | addConstraint (const ConstraintBasePtr &constraint) |
Add a constraint. More... | |
void | removeConstraint (const ConstraintBasePtr &constraint) |
Remove a constraint. More... | |
void | removeAllConstraints () |
Remove all constraints. More... | |
std::size_t | getNumConstraints () const |
Returns the number of constraints that was manually added to this ConstraintSolver. More... | |
constraint::ConstraintBasePtr | getConstraint (std::size_t index) |
Returns a constraint by index. More... | |
constraint::ConstConstraintBasePtr | getConstraint (std::size_t index) const |
Returns a constraint by index. More... | |
std::vector< constraint::ConstraintBasePtr > | getConstraints () |
Returns all the constraints added to this ConstraintSolver. More... | |
std::vector< constraint::ConstConstraintBasePtr > | getConstraints () const |
Returns all the constraints added to this ConstraintSolver. More... | |
void | clearLastCollisionResult () |
Clears the last collision result. More... | |
virtual void | setTimeStep (double _timeStep) |
Set time step. More... | |
double | getTimeStep () const |
Get time step. More... | |
void | setCollisionDetector (collision::CollisionDetector *collisionDetector) |
Set collision detector. More... | |
void | setCollisionDetector (const std::shared_ptr< collision::CollisionDetector > &collisionDetector) |
Set collision detector. More... | |
collision::CollisionDetectorPtr | getCollisionDetector () |
Get collision detector. More... | |
collision::ConstCollisionDetectorPtr | getCollisionDetector () const |
Get (const) collision detector. More... | |
collision::CollisionGroupPtr | getCollisionGroup () |
Return collision group of collision objects that are added to this ConstraintSolver. More... | |
collision::ConstCollisionGroupPtr | getCollisionGroup () const |
Return (const) collision group of collision objects that are added to this ConstraintSolver. More... | |
collision::CollisionOption & | getCollisionOption () |
Returns collision option that is used for collision checkings in this ConstraintSolver to generate contact constraints. More... | |
const collision::CollisionOption & | getCollisionOption () const |
Returns collision option that is used for collision checkings in this ConstraintSolver to generate contact constraints. More... | |
collision::CollisionResult & | getLastCollisionResult () |
Return the last collision checking result. More... | |
const collision::CollisionResult & | getLastCollisionResult () const |
Return the last collision checking result. More... | |
void | setLCPSolver (std::unique_ptr< LCPSolver > lcpSolver) |
Set LCP solver. More... | |
LCPSolver * | getLCPSolver () const |
Get LCP solver. More... | |
void | solve () |
Solve constraint impulses and apply them to the skeletons. More... | |
virtual void | setFromOtherConstraintSolver (const ConstraintSolver &other) |
Sets this constraint solver using other constraint solver. More... | |
Protected Types | |
using | CollisionDetector = collision::CollisionDetector |
Protected Member Functions | |
virtual void | solveConstrainedGroup (ConstrainedGroup &group)=0 |
bool | containSkeleton (const dynamics::ConstSkeletonPtr &skeleton) const |
Check if the skeleton is contained in this solver. More... | |
bool | checkAndAddSkeleton (const dynamics::SkeletonPtr &skeleton) |
Add skeleton if the constraint is not contained in this solver. More... | |
bool | containConstraint (const ConstConstraintBasePtr &constraint) const |
Check if the constraint is contained in this solver. More... | |
bool | checkAndAddConstraint (const ConstraintBasePtr &constraint) |
Add constraint if the constraint is not contained in this solver. More... | |
void | updateConstraints () |
Update constraints. More... | |
void | buildConstrainedGroups () |
Build constrained groupsContact. More... | |
void | solveConstrainedGroups () |
Solve constrained groups. More... | |
bool | isSoftContact (const collision::Contact &contact) const |
Return true if at least one of colliding body is soft body. More... | |
Protected Attributes | |
collision::CollisionDetectorPtr | mCollisionDetector |
Collision detector. More... | |
collision::CollisionGroupPtr | mCollisionGroup |
Collision group. More... | |
collision::CollisionOption | mCollisionOption |
Collision detection option. More... | |
collision::CollisionResult | mCollisionResult |
Last collision checking result. More... | |
double | mTimeStep |
Time step. More... | |
std::vector< dynamics::SkeletonPtr > | mSkeletons |
Skeleton list. More... | |
std::vector< ContactConstraintPtr > | mContactConstraints |
Contact constraints those are automatically created. More... | |
std::vector< SoftContactConstraintPtr > | mSoftContactConstraints |
Soft contact constraints those are automatically created. More... | |
std::vector< JointLimitConstraintPtr > | mJointLimitConstraints |
Joint limit constraints those are automatically created. More... | |
std::vector< ServoMotorConstraintPtr > | mServoMotorConstraints |
Servo motor constraints those are automatically created. More... | |
std::vector< MimicMotorConstraintPtr > | mMimicMotorConstraints |
Mimic motor constraints those are automatically created. More... | |
std::vector< JointCoulombFrictionConstraintPtr > | mJointCoulombFrictionConstraints |
Joint Coulomb friction constraints those are automatically created. More... | |
std::vector< ConstraintBasePtr > | mManualConstraints |
Constraints that manually added. More... | |
std::vector< ConstraintBasePtr > | mActiveConstraints |
Active constraints. More... | |
std::vector< ConstrainedGroup > | mConstrainedGroups |
Constraint group list. More... | |
ConstraintSolver manages constraints and computes constraint impulses.
|
protected |
|
explicit |
Constructor.
dart::constraint::ConstraintSolver::ConstraintSolver | ( | ) |
Default constructor.
|
delete |
Copy constructor.
|
virtualdefault |
Destructor.
void dart::constraint::ConstraintSolver::addConstraint | ( | const ConstraintBasePtr & | constraint | ) |
Add a constraint.
void dart::constraint::ConstraintSolver::addSkeleton | ( | const dynamics::SkeletonPtr & | skeleton | ) |
Add single skeleton.
void dart::constraint::ConstraintSolver::addSkeletons | ( | const std::vector< dynamics::SkeletonPtr > & | skeletons | ) |
Add mutiple skeletons.
|
protected |
Build constrained groupsContact.
|
protected |
Add constraint if the constraint is not contained in this solver.
|
protected |
Add skeleton if the constraint is not contained in this solver.
void dart::constraint::ConstraintSolver::clearLastCollisionResult | ( | ) |
Clears the last collision result.
|
protected |
Check if the constraint is contained in this solver.
|
protected |
Check if the skeleton is contained in this solver.
collision::CollisionDetectorPtr dart::constraint::ConstraintSolver::getCollisionDetector | ( | ) |
Get collision detector.
collision::ConstCollisionDetectorPtr dart::constraint::ConstraintSolver::getCollisionDetector | ( | ) | const |
Get (const) collision detector.
collision::CollisionGroupPtr dart::constraint::ConstraintSolver::getCollisionGroup | ( | ) |
Return collision group of collision objects that are added to this ConstraintSolver.
collision::ConstCollisionGroupPtr dart::constraint::ConstraintSolver::getCollisionGroup | ( | ) | const |
Return (const) collision group of collision objects that are added to this ConstraintSolver.
collision::CollisionOption & dart::constraint::ConstraintSolver::getCollisionOption | ( | ) |
Returns collision option that is used for collision checkings in this ConstraintSolver to generate contact constraints.
const collision::CollisionOption & dart::constraint::ConstraintSolver::getCollisionOption | ( | ) | const |
Returns collision option that is used for collision checkings in this ConstraintSolver to generate contact constraints.
ConstraintBasePtr dart::constraint::ConstraintSolver::getConstraint | ( | std::size_t | index | ) |
Returns a constraint by index.
ConstConstraintBasePtr dart::constraint::ConstraintSolver::getConstraint | ( | std::size_t | index | ) | const |
Returns a constraint by index.
std::vector< ConstraintBasePtr > dart::constraint::ConstraintSolver::getConstraints | ( | ) |
Returns all the constraints added to this ConstraintSolver.
std::vector< ConstConstraintBasePtr > dart::constraint::ConstraintSolver::getConstraints | ( | ) | const |
Returns all the constraints added to this ConstraintSolver.
collision::CollisionResult & dart::constraint::ConstraintSolver::getLastCollisionResult | ( | ) |
Return the last collision checking result.
const collision::CollisionResult & dart::constraint::ConstraintSolver::getLastCollisionResult | ( | ) | const |
Return the last collision checking result.
LCPSolver * dart::constraint::ConstraintSolver::getLCPSolver | ( | ) | const |
Get LCP solver.
std::size_t dart::constraint::ConstraintSolver::getNumConstraints | ( | ) | const |
Returns the number of constraints that was manually added to this ConstraintSolver.
const std::vector< SkeletonPtr > & dart::constraint::ConstraintSolver::getSkeletons | ( | ) | const |
Returns all the skeletons added to this ConstraintSolver.
double dart::constraint::ConstraintSolver::getTimeStep | ( | ) | const |
Get time step.
|
protected |
Return true if at least one of colliding body is soft body.
void dart::constraint::ConstraintSolver::removeAllConstraints | ( | ) |
Remove all constraints.
void dart::constraint::ConstraintSolver::removeAllSkeletons | ( | ) |
Remove all skeletons in this constraint solver.
void dart::constraint::ConstraintSolver::removeConstraint | ( | const ConstraintBasePtr & | constraint | ) |
Remove a constraint.
void dart::constraint::ConstraintSolver::removeSkeleton | ( | const dynamics::SkeletonPtr & | skeleton | ) |
Remove single skeleton.
void dart::constraint::ConstraintSolver::removeSkeletons | ( | const std::vector< dynamics::SkeletonPtr > & | skeletons | ) |
Remove multiple skeletons.
void dart::constraint::ConstraintSolver::setCollisionDetector | ( | collision::CollisionDetector * | collisionDetector | ) |
Set collision detector.
This function acquires ownership of the CollisionDetector passed as an argument. This method is deprecated in favor of the overload that accepts a std::shared_ptr.
void dart::constraint::ConstraintSolver::setCollisionDetector | ( | const std::shared_ptr< collision::CollisionDetector > & | collisionDetector | ) |
Set collision detector.
|
virtual |
Sets this constraint solver using other constraint solver.
All the properties and registered skeletons and constraints will be copied over.
void dart::constraint::ConstraintSolver::setLCPSolver | ( | std::unique_ptr< LCPSolver > | lcpSolver | ) |
Set LCP solver.
|
virtual |
Set time step.
void dart::constraint::ConstraintSolver::solve | ( | ) |
Solve constraint impulses and apply them to the skeletons.
|
protectedpure virtual |
Implemented in dart::constraint::BoxedLcpConstraintSolver.
|
protected |
Solve constrained groups.
|
protected |
Update constraints.
|
protected |
Active constraints.
|
protected |
Collision detector.
|
protected |
Collision group.
|
protected |
Collision detection option.
|
protected |
Last collision checking result.
|
protected |
Constraint group list.
|
protected |
Contact constraints those are automatically created.
|
protected |
Joint Coulomb friction constraints those are automatically created.
|
protected |
Joint limit constraints those are automatically created.
|
protected |
Constraints that manually added.
|
protected |
Mimic motor constraints those are automatically created.
|
protected |
Servo motor constraints those are automatically created.
|
protected |
Skeleton list.
|
protected |
Soft contact constraints those are automatically created.
|
protected |
Time step.