DART  6.10.1
dart::constraint::ConstraintSolver Class Referenceabstract

ConstraintSolver manages constraints and computes constraint impulses. More...

#include <ConstraintSolver.hpp>

Inheritance diagram for dart::constraint::ConstraintSolver:
dart::constraint::BoxedLcpConstraintSolver

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::ConstraintBasePtrgetConstraints ()
 Returns all the constraints added to this ConstraintSolver. More...
 
std::vector< constraint::ConstConstraintBasePtrgetConstraints () 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::CollisionOptiongetCollisionOption ()
 Returns collision option that is used for collision checkings in this ConstraintSolver to generate contact constraints. More...
 
const collision::CollisionOptiongetCollisionOption () const
 Returns collision option that is used for collision checkings in this ConstraintSolver to generate contact constraints. More...
 
collision::CollisionResultgetLastCollisionResult ()
 Return the last collision checking result. More...
 
const collision::CollisionResultgetLastCollisionResult () const
 Return the last collision checking result. More...
 
void setLCPSolver (std::unique_ptr< LCPSolver > lcpSolver)
 Set LCP solver. More...
 
LCPSolvergetLCPSolver () 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::SkeletonPtrmSkeletons
 Skeleton list. More...
 
std::vector< ContactConstraintPtrmContactConstraints
 Contact constraints those are automatically created. More...
 
std::vector< SoftContactConstraintPtrmSoftContactConstraints
 Soft contact constraints those are automatically created. More...
 
std::vector< JointLimitConstraintPtrmJointLimitConstraints
 Joint limit constraints those are automatically created. More...
 
std::vector< ServoMotorConstraintPtrmServoMotorConstraints
 Servo motor constraints those are automatically created. More...
 
std::vector< MimicMotorConstraintPtrmMimicMotorConstraints
 Mimic motor constraints those are automatically created. More...
 
std::vector< JointCoulombFrictionConstraintPtrmJointCoulombFrictionConstraints
 Joint Coulomb friction constraints those are automatically created. More...
 
std::vector< ConstraintBasePtrmManualConstraints
 Constraints that manually added. More...
 
std::vector< ConstraintBasePtrmActiveConstraints
 Active constraints. More...
 
std::vector< ConstrainedGroupmConstrainedGroups
 Constraint group list. More...
 

Detailed Description

ConstraintSolver manages constraints and computes constraint impulses.

Member Typedef Documentation

◆ CollisionDetector

Constructor & Destructor Documentation

◆ ConstraintSolver() [1/3]

dart::constraint::ConstraintSolver::ConstraintSolver ( double  timeStep)
explicit

Constructor.

Deprecated:
Deprecated in DART 6.8. Please use other constructors that doesn't take timespte. Timestep should be set by the owner of this solver such as dart::simulation::World when the solver added.

◆ ConstraintSolver() [2/3]

dart::constraint::ConstraintSolver::ConstraintSolver ( )

Default constructor.

◆ ConstraintSolver() [3/3]

dart::constraint::ConstraintSolver::ConstraintSolver ( const ConstraintSolver other)
delete

Copy constructor.

◆ ~ConstraintSolver()

virtual dart::constraint::ConstraintSolver::~ConstraintSolver ( )
virtualdefault

Destructor.

Member Function Documentation

◆ addConstraint()

void dart::constraint::ConstraintSolver::addConstraint ( const ConstraintBasePtr constraint)

Add a constraint.

◆ addSkeleton()

void dart::constraint::ConstraintSolver::addSkeleton ( const dynamics::SkeletonPtr skeleton)

Add single skeleton.

◆ addSkeletons()

void dart::constraint::ConstraintSolver::addSkeletons ( const std::vector< dynamics::SkeletonPtr > &  skeletons)

Add mutiple skeletons.

◆ buildConstrainedGroups()

void dart::constraint::ConstraintSolver::buildConstrainedGroups ( )
protected

Build constrained groupsContact.

◆ checkAndAddConstraint()

bool dart::constraint::ConstraintSolver::checkAndAddConstraint ( const ConstraintBasePtr constraint)
protected

Add constraint if the constraint is not contained in this solver.

◆ checkAndAddSkeleton()

bool dart::constraint::ConstraintSolver::checkAndAddSkeleton ( const dynamics::SkeletonPtr skeleton)
protected

Add skeleton if the constraint is not contained in this solver.

◆ clearLastCollisionResult()

void dart::constraint::ConstraintSolver::clearLastCollisionResult ( )

Clears the last collision result.

◆ containConstraint()

bool dart::constraint::ConstraintSolver::containConstraint ( const ConstConstraintBasePtr constraint) const
protected

Check if the constraint is contained in this solver.

◆ containSkeleton()

bool dart::constraint::ConstraintSolver::containSkeleton ( const dynamics::ConstSkeletonPtr skeleton) const
protected

Check if the skeleton is contained in this solver.

◆ getCollisionDetector() [1/2]

collision::CollisionDetectorPtr dart::constraint::ConstraintSolver::getCollisionDetector ( )

Get collision detector.

◆ getCollisionDetector() [2/2]

collision::ConstCollisionDetectorPtr dart::constraint::ConstraintSolver::getCollisionDetector ( ) const

Get (const) collision detector.

◆ getCollisionGroup() [1/2]

collision::CollisionGroupPtr dart::constraint::ConstraintSolver::getCollisionGroup ( )

Return collision group of collision objects that are added to this ConstraintSolver.

◆ getCollisionGroup() [2/2]

collision::ConstCollisionGroupPtr dart::constraint::ConstraintSolver::getCollisionGroup ( ) const

Return (const) collision group of collision objects that are added to this ConstraintSolver.

◆ getCollisionOption() [1/2]

collision::CollisionOption & dart::constraint::ConstraintSolver::getCollisionOption ( )

Returns collision option that is used for collision checkings in this ConstraintSolver to generate contact constraints.

◆ getCollisionOption() [2/2]

const collision::CollisionOption & dart::constraint::ConstraintSolver::getCollisionOption ( ) const

Returns collision option that is used for collision checkings in this ConstraintSolver to generate contact constraints.

◆ getConstraint() [1/2]

ConstraintBasePtr dart::constraint::ConstraintSolver::getConstraint ( std::size_t  index)

Returns a constraint by index.

◆ getConstraint() [2/2]

ConstConstraintBasePtr dart::constraint::ConstraintSolver::getConstraint ( std::size_t  index) const

Returns a constraint by index.

◆ getConstraints() [1/2]

std::vector< ConstraintBasePtr > dart::constraint::ConstraintSolver::getConstraints ( )

Returns all the constraints added to this ConstraintSolver.

◆ getConstraints() [2/2]

std::vector< ConstConstraintBasePtr > dart::constraint::ConstraintSolver::getConstraints ( ) const

Returns all the constraints added to this ConstraintSolver.

◆ getLastCollisionResult() [1/2]

collision::CollisionResult & dart::constraint::ConstraintSolver::getLastCollisionResult ( )

Return the last collision checking result.

◆ getLastCollisionResult() [2/2]

const collision::CollisionResult & dart::constraint::ConstraintSolver::getLastCollisionResult ( ) const

Return the last collision checking result.

◆ getLCPSolver()

LCPSolver * dart::constraint::ConstraintSolver::getLCPSolver ( ) const

Get LCP solver.

◆ getNumConstraints()

std::size_t dart::constraint::ConstraintSolver::getNumConstraints ( ) const

Returns the number of constraints that was manually added to this ConstraintSolver.

◆ getSkeletons()

const std::vector< SkeletonPtr > & dart::constraint::ConstraintSolver::getSkeletons ( ) const

Returns all the skeletons added to this ConstraintSolver.

◆ getTimeStep()

double dart::constraint::ConstraintSolver::getTimeStep ( ) const

Get time step.

◆ isSoftContact()

bool dart::constraint::ConstraintSolver::isSoftContact ( const collision::Contact contact) const
protected

Return true if at least one of colliding body is soft body.

◆ removeAllConstraints()

void dart::constraint::ConstraintSolver::removeAllConstraints ( )

Remove all constraints.

◆ removeAllSkeletons()

void dart::constraint::ConstraintSolver::removeAllSkeletons ( )

Remove all skeletons in this constraint solver.

◆ removeConstraint()

void dart::constraint::ConstraintSolver::removeConstraint ( const ConstraintBasePtr constraint)

Remove a constraint.

◆ removeSkeleton()

void dart::constraint::ConstraintSolver::removeSkeleton ( const dynamics::SkeletonPtr skeleton)

Remove single skeleton.

◆ removeSkeletons()

void dart::constraint::ConstraintSolver::removeSkeletons ( const std::vector< dynamics::SkeletonPtr > &  skeletons)

Remove multiple skeletons.

◆ setCollisionDetector() [1/2]

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.

◆ setCollisionDetector() [2/2]

void dart::constraint::ConstraintSolver::setCollisionDetector ( const std::shared_ptr< collision::CollisionDetector > &  collisionDetector)

Set collision detector.

◆ setFromOtherConstraintSolver()

void dart::constraint::ConstraintSolver::setFromOtherConstraintSolver ( const ConstraintSolver other)
virtual

Sets this constraint solver using other constraint solver.

All the properties and registered skeletons and constraints will be copied over.

◆ setLCPSolver()

void dart::constraint::ConstraintSolver::setLCPSolver ( std::unique_ptr< LCPSolver lcpSolver)

Set LCP solver.

◆ setTimeStep()

void dart::constraint::ConstraintSolver::setTimeStep ( double  _timeStep)
virtual

Set time step.

◆ solve()

void dart::constraint::ConstraintSolver::solve ( )

Solve constraint impulses and apply them to the skeletons.

◆ solveConstrainedGroup()

virtual void dart::constraint::ConstraintSolver::solveConstrainedGroup ( ConstrainedGroup group)
protectedpure virtual

◆ solveConstrainedGroups()

void dart::constraint::ConstraintSolver::solveConstrainedGroups ( )
protected

Solve constrained groups.

◆ updateConstraints()

void dart::constraint::ConstraintSolver::updateConstraints ( )
protected

Update constraints.

Member Data Documentation

◆ mActiveConstraints

std::vector<ConstraintBasePtr> dart::constraint::ConstraintSolver::mActiveConstraints
protected

Active constraints.

◆ mCollisionDetector

collision::CollisionDetectorPtr dart::constraint::ConstraintSolver::mCollisionDetector
protected

Collision detector.

◆ mCollisionGroup

collision::CollisionGroupPtr dart::constraint::ConstraintSolver::mCollisionGroup
protected

Collision group.

◆ mCollisionOption

collision::CollisionOption dart::constraint::ConstraintSolver::mCollisionOption
protected

Collision detection option.

◆ mCollisionResult

collision::CollisionResult dart::constraint::ConstraintSolver::mCollisionResult
protected

Last collision checking result.

◆ mConstrainedGroups

std::vector<ConstrainedGroup> dart::constraint::ConstraintSolver::mConstrainedGroups
protected

Constraint group list.

◆ mContactConstraints

std::vector<ContactConstraintPtr> dart::constraint::ConstraintSolver::mContactConstraints
protected

Contact constraints those are automatically created.

◆ mJointCoulombFrictionConstraints

std::vector<JointCoulombFrictionConstraintPtr> dart::constraint::ConstraintSolver::mJointCoulombFrictionConstraints
protected

Joint Coulomb friction constraints those are automatically created.

◆ mJointLimitConstraints

std::vector<JointLimitConstraintPtr> dart::constraint::ConstraintSolver::mJointLimitConstraints
protected

Joint limit constraints those are automatically created.

◆ mManualConstraints

std::vector<ConstraintBasePtr> dart::constraint::ConstraintSolver::mManualConstraints
protected

Constraints that manually added.

◆ mMimicMotorConstraints

std::vector<MimicMotorConstraintPtr> dart::constraint::ConstraintSolver::mMimicMotorConstraints
protected

Mimic motor constraints those are automatically created.

◆ mServoMotorConstraints

std::vector<ServoMotorConstraintPtr> dart::constraint::ConstraintSolver::mServoMotorConstraints
protected

Servo motor constraints those are automatically created.

◆ mSkeletons

std::vector<dynamics::SkeletonPtr> dart::constraint::ConstraintSolver::mSkeletons
protected

Skeleton list.

◆ mSoftContactConstraints

std::vector<SoftContactConstraintPtr> dart::constraint::ConstraintSolver::mSoftContactConstraints
protected

Soft contact constraints those are automatically created.

◆ mTimeStep

double dart::constraint::ConstraintSolver::mTimeStep
protected

Time step.