dart
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
dart::dynamics::ConstraintSolver Class Referenceabstract

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

#include <ConstraintSolver.hpp>

Inheritance diagram for dart::dynamics::ConstraintSolver:
Inheritance graph
[legend]
Collaboration diagram for dart::dynamics::ConstraintSolver:
Collaboration graph
[legend]

Public Member Functions

 ConstraintSolver (double timeStep)
 Constructor. More...
 
 ConstraintSolver ()
 Default constructor.
 
 ConstraintSolver (const ConstraintSolver &other)=delete
 Copy constructor.
 
virtual ~ConstraintSolver ()=default
 Destructor.
 
void addSkeleton (const dynamics::SkeletonPtr &skeleton)
 Add single skeleton.
 
void addSkeletons (const std::vector< dynamics::SkeletonPtr > &skeletons)
 Add mutiple skeletons.
 
const std::vector< dynamics::SkeletonPtr > & getSkeletons () const
 Returns all the skeletons added to this ConstraintSolver.
 
void removeSkeleton (const dynamics::SkeletonPtr &skeleton)
 Remove single skeleton.
 
void removeSkeletons (const std::vector< dynamics::SkeletonPtr > &skeletons)
 Remove multiple skeletons.
 
void removeAllSkeletons ()
 Remove all skeletons in this constraint solver.
 
void addConstraint (const ConstraintBasePtr &constraint)
 Add a constraint.
 
void removeConstraint (const ConstraintBasePtr &constraint)
 Remove a constraint.
 
void removeAllConstraints ()
 Remove all constraints.
 
std::size_t getNumConstraints () const
 Returns the number of constraints that was manually added to this ConstraintSolver. More...
 
dynamics::ConstraintBasePtr getConstraint (std::size_t index)
 Returns a constraint by index.
 
dynamics::ConstConstraintBasePtr getConstraint (std::size_t index) const
 Returns a constraint by index.
 
std::vector< dynamics::ConstraintBasePtr > getConstraints ()
 Returns all the constraints added to this ConstraintSolver.
 
std::vector< dynamics::ConstConstraintBasePtr > getConstraints () const
 Returns all the constraints added to this ConstraintSolver.
 
void clearLastCollisionResult ()
 Clears the last collision result.
 
virtual void setTimeStep (double _timeStep)
 Set time step.
 
double getTimeStep () const
 Get time step.
 
void setCollisionDetector (collision::CollisionDetector *collisionDetector)
 Set collision detector. More...
 
void setCollisionDetector (const std::shared_ptr< collision::CollisionDetector > &collisionDetector)
 Set collision detector.
 
collision::CollisionDetectorPtr getCollisionDetector ()
 Get collision detector.
 
collision::ConstCollisionDetectorPtr getCollisionDetector () const
 Get (const) collision detector.
 
collision::CollisionGroupPtr getCollisionGroup ()
 Return collision group of collision objects that are added to this ConstraintSolver.
 
collision::ConstCollisionGroupPtr getCollisionGroup () const
 Return (const) collision group of collision objects that are added to this ConstraintSolver.
 
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.
 
const collision::CollisionResultgetLastCollisionResult () const
 Return the last collision checking result.
 
void setLCPSolver (std::unique_ptr< LCPSolver > lcpSolver)
 Set LCP solver.
 
LCPSolvergetLCPSolver () const
 Get LCP solver.
 
void solve ()
 Solve constraint impulses and apply them to the skeletons.
 
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.
 
bool checkAndAddSkeleton (const dynamics::SkeletonPtr &skeleton)
 Add skeleton if the constraint is not contained in this solver.
 
bool containConstraint (const ConstConstraintBasePtr &constraint) const
 Check if the constraint is contained in this solver.
 
bool checkAndAddConstraint (const ConstraintBasePtr &constraint)
 Add constraint if the constraint is not contained in this solver.
 
void updateConstraints ()
 Update constraints.
 
void buildConstrainedGroups ()
 Build constrained groupsContact.
 
void solveConstrainedGroups ()
 Solve constrained groups.
 
bool isSoftContact (const collision::Contact &contact) const
 Return true if at least one of colliding body is soft body.
 

Protected Attributes

collision::CollisionDetectorPtr mCollisionDetector
 Collision detector.
 
collision::CollisionGroupPtr mCollisionGroup
 Collision group.
 
collision::CollisionOption mCollisionOption
 Collision detection option.
 
collision::CollisionResult mCollisionResult
 Last collision checking result.
 
double mTimeStep
 Time step.
 
std::vector< dynamics::SkeletonPtr > mSkeletons
 Skeleton list.
 
std::vector< ContactConstraintPtr > mContactConstraints
 Contact constraints those are automatically created.
 
std::vector< SoftContactConstraintPtr > mSoftContactConstraints
 Soft contact constraints those are automatically created.
 
std::vector< JointLimitConstraintPtr > mJointLimitConstraints
 Joint limit constraints those are automatically created.
 
std::vector< ServoMotorConstraintPtr > mServoMotorConstraints
 Servo motor constraints those are automatically created.
 
std::vector< MimicMotorConstraintPtr > mMimicMotorConstraints
 Mimic motor constraints those are automatically created.
 
std::vector< JointCoulombFrictionConstraintPtr > mJointCoulombFrictionConstraints
 Joint Coulomb friction constraints those are automatically created.
 
std::vector< ConstraintBasePtr > mManualConstraints
 Constraints that manually added.
 
std::vector< ConstraintBasePtr > mActiveConstraints
 Active constraints.
 
std::vector< ConstrainedGroupmConstrainedGroups
 Constraint group list.
 

Detailed Description

ConstraintSolver manages constraints and computes constraint impulses.

Constructor & Destructor Documentation

◆ ConstraintSolver()

dart::dynamics::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.

Member Function Documentation

◆ getCollisionOption() [1/2]

collision::CollisionOption & dart::dynamics::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::dynamics::ConstraintSolver::getCollisionOption ( ) const

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

◆ getNumConstraints()

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

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

◆ setCollisionDetector()

void dart::dynamics::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.

◆ setFromOtherConstraintSolver()

void dart::dynamics::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.


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