DART  6.7.3
dart::constraint::ContactConstraint Class Reference

ContactConstraint represents a contact constraint between two bodies. More...

#include <ContactConstraint.hpp>

Inheritance diagram for dart::constraint::ContactConstraint:
dart::constraint::ConstraintBase

Public Member Functions

 ContactConstraint (collision::Contact &contact, double timeStep)
 Constructor. More...
 
 ~ContactConstraint () override=default
 Destructor. More...
 
void setFrictionDirection (const Eigen::Vector3d &dir)
 Set first frictional direction. More...
 
const Eigen::Vector3d & getFrictionDirection1 () const
 Get first frictional direction. More...
 
std::size_t getDimension () const
 Return dimesion of this constranit. More...
 

Static Public Member Functions

static void setErrorAllowance (double allowance)
 Set global error reduction parameter. More...
 
static double getErrorAllowance ()
 Get global error reduction parameter. More...
 
static void setErrorReductionParameter (double erp)
 Set global error reduction parameter. More...
 
static double getErrorReductionParameter ()
 Get global error reduction parameter. More...
 
static void setMaxErrorReductionVelocity (double erv)
 Set global error reduction parameter. More...
 
static double getMaxErrorReductionVelocity ()
 Get global error reduction parameter. More...
 
static void setConstraintForceMixing (double cfm)
 Set global constraint force mixing parameter. More...
 
static double getConstraintForceMixing ()
 Get global constraint force mixing parameter. More...
 
static dynamics::SkeletonPtr getRootSkeleton (dynamics::SkeletonPtr skeleton)
 
static dynamics::SkeletonPtr compressPath (dynamics::SkeletonPtr skeleton)
 

Protected Member Functions

void update () override
 Update constraint using updated Skeleton's states. More...
 
void getInformation (ConstraintInfo *info) override
 Fill LCP variables. More...
 
void applyUnitImpulse (std::size_t index) override
 Apply unit impulse to constraint space. More...
 
void getVelocityChange (double *vel, bool withCfm) override
 Get velocity change due to the uint impulse. More...
 
void excite () override
 Excite the constraint. More...
 
void unexcite () override
 Unexcite the constraint. More...
 
void applyImpulse (double *lambda) override
 Apply computed constraint impulse to constrained skeletons. More...
 
dynamics::SkeletonPtr getRootSkeleton () const override
 
void uniteSkeletons () override
 
bool isActive () const override
 Return true if this constraint is active. More...
 

Protected Attributes

std::size_t mDim
 Dimension of constraint. More...
 

Private Types

using TangentBasisMatrix = Eigen::Matrix< double, 3, 2 >
 

Private Member Functions

void getRelVelocity (double *relVel)
 Get change in relative velocity at contact point due to external impulse. More...
 
void updateFirstFrictionalDirection ()
 
TangentBasisMatrix getTangentBasisMatrixODE (const Eigen::Vector3d &n)
 

Private Attributes

double mTimeStep
 Time step. More...
 
dynamics::BodyNodemBodyNodeA
 Fircst body node. More...
 
dynamics::BodyNodemBodyNodeB
 Second body node. More...
 
collision::ContactmContact
 Contact between mBodyNode1 and mBodyNode2. More...
 
Eigen::Vector3d mFirstFrictionalDirection
 First frictional direction. More...
 
double mFrictionCoeff
 Coefficient of Friction. More...
 
double mRestitutionCoeff
 Coefficient of restitution. More...
 
bool mIsSelfCollision
 Whether this contact is self-collision. More...
 
Eigen::Matrix< double, 6, Eigen::Dynamic > mSpatialNormalA
 Local body jacobians for mBodyNode1. More...
 
Eigen::Matrix< double, 6, Eigen::Dynamic > mSpatialNormalB
 Local body jacobians for mBodyNode2. More...
 
bool mIsFrictionOn
 
std::size_t mAppliedImpulseIndex
 Index of applied impulse. More...
 
bool mIsBounceOn
 
bool mActive
 

Static Private Attributes

static double mErrorAllowance = 0.0
 Global constraint error allowance. More...
 
static double mErrorReductionParameter = 0.01
 Global constraint error redection parameter in the range of [0, 1]. More...
 
static double mMaxErrorReductionVelocity = 1e-3
 Maximum error reduction velocity. More...
 
static double mConstraintForceMixing = 1e-5
 Global constraint force mixing parameter in the range of [1e-9, 1]. More...
 

Friends

class ConstraintSolver
 
class ConstrainedGroup
 

Detailed Description

ContactConstraint represents a contact constraint between two bodies.

Member Typedef Documentation

◆ TangentBasisMatrix

using dart::constraint::ContactConstraint::TangentBasisMatrix = Eigen::Matrix<double, 3, 2>
private

Constructor & Destructor Documentation

◆ ContactConstraint()

dart::constraint::ContactConstraint::ContactConstraint ( collision::Contact contact,
double  timeStep 
)

Constructor.

◆ ~ContactConstraint()

dart::constraint::ContactConstraint::~ContactConstraint ( )
overridedefault

Destructor.

Member Function Documentation

◆ applyImpulse()

void dart::constraint::ContactConstraint::applyImpulse ( double *  lambda)
overrideprotectedvirtual

Apply computed constraint impulse to constrained skeletons.

Implements dart::constraint::ConstraintBase.

◆ applyUnitImpulse()

void dart::constraint::ContactConstraint::applyUnitImpulse ( std::size_t  index)
overrideprotectedvirtual

Apply unit impulse to constraint space.

Implements dart::constraint::ConstraintBase.

◆ compressPath()

dynamics::SkeletonPtr dart::constraint::ConstraintBase::compressPath ( dynamics::SkeletonPtr  skeleton)
staticinherited

◆ excite()

void dart::constraint::ContactConstraint::excite ( )
overrideprotectedvirtual

Excite the constraint.

Implements dart::constraint::ConstraintBase.

◆ getConstraintForceMixing()

double dart::constraint::ContactConstraint::getConstraintForceMixing ( )
static

Get global constraint force mixing parameter.

◆ getDimension()

std::size_t dart::constraint::ConstraintBase::getDimension ( ) const
inherited

Return dimesion of this constranit.

◆ getErrorAllowance()

double dart::constraint::ContactConstraint::getErrorAllowance ( )
static

Get global error reduction parameter.

◆ getErrorReductionParameter()

double dart::constraint::ContactConstraint::getErrorReductionParameter ( )
static

Get global error reduction parameter.

◆ getFrictionDirection1()

const Eigen::Vector3d & dart::constraint::ContactConstraint::getFrictionDirection1 ( ) const

Get first frictional direction.

◆ getInformation()

void dart::constraint::ContactConstraint::getInformation ( ConstraintInfo info)
overrideprotectedvirtual

Fill LCP variables.

Implements dart::constraint::ConstraintBase.

◆ getMaxErrorReductionVelocity()

double dart::constraint::ContactConstraint::getMaxErrorReductionVelocity ( )
static

Get global error reduction parameter.

◆ getRelVelocity()

void dart::constraint::ContactConstraint::getRelVelocity ( double *  relVel)
private

Get change in relative velocity at contact point due to external impulse.

Parameters
[out]relVelChange in relative velocity at contact point of the two colliding bodies.

◆ getRootSkeleton() [1/2]

dynamics::SkeletonPtr dart::constraint::ContactConstraint::getRootSkeleton ( ) const
overrideprotectedvirtual

◆ getRootSkeleton() [2/2]

dynamics::SkeletonPtr dart::constraint::ConstraintBase::getRootSkeleton ( dynamics::SkeletonPtr  skeleton)
staticinherited

◆ getTangentBasisMatrixODE()

ContactConstraint::TangentBasisMatrix dart::constraint::ContactConstraint::getTangentBasisMatrixODE ( const Eigen::Vector3d &  n)
private

◆ getVelocityChange()

void dart::constraint::ContactConstraint::getVelocityChange ( double *  vel,
bool  withCfm 
)
overrideprotectedvirtual

Get velocity change due to the uint impulse.

Implements dart::constraint::ConstraintBase.

◆ isActive()

bool dart::constraint::ContactConstraint::isActive ( ) const
overrideprotectedvirtual

Return true if this constraint is active.

Implements dart::constraint::ConstraintBase.

◆ setConstraintForceMixing()

void dart::constraint::ContactConstraint::setConstraintForceMixing ( double  cfm)
static

Set global constraint force mixing parameter.

◆ setErrorAllowance()

void dart::constraint::ContactConstraint::setErrorAllowance ( double  allowance)
static

Set global error reduction parameter.

◆ setErrorReductionParameter()

void dart::constraint::ContactConstraint::setErrorReductionParameter ( double  erp)
static

Set global error reduction parameter.

◆ setFrictionDirection()

void dart::constraint::ContactConstraint::setFrictionDirection ( const Eigen::Vector3d &  dir)

Set first frictional direction.

◆ setMaxErrorReductionVelocity()

void dart::constraint::ContactConstraint::setMaxErrorReductionVelocity ( double  erv)
static

Set global error reduction parameter.

◆ unexcite()

void dart::constraint::ContactConstraint::unexcite ( )
overrideprotectedvirtual

Unexcite the constraint.

Implements dart::constraint::ConstraintBase.

◆ uniteSkeletons()

void dart::constraint::ContactConstraint::uniteSkeletons ( )
overrideprotectedvirtual

Reimplemented from dart::constraint::ConstraintBase.

◆ update()

void dart::constraint::ContactConstraint::update ( )
overrideprotectedvirtual

Update constraint using updated Skeleton's states.

Implements dart::constraint::ConstraintBase.

◆ updateFirstFrictionalDirection()

void dart::constraint::ContactConstraint::updateFirstFrictionalDirection ( )
private

Friends And Related Function Documentation

◆ ConstrainedGroup

friend class ConstrainedGroup
friend

◆ ConstraintSolver

friend class ConstraintSolver
friend

Member Data Documentation

◆ mActive

bool dart::constraint::ContactConstraint::mActive
private

◆ mAppliedImpulseIndex

std::size_t dart::constraint::ContactConstraint::mAppliedImpulseIndex
private

Index of applied impulse.

◆ mBodyNodeA

dynamics::BodyNode* dart::constraint::ContactConstraint::mBodyNodeA
private

Fircst body node.

◆ mBodyNodeB

dynamics::BodyNode* dart::constraint::ContactConstraint::mBodyNodeB
private

Second body node.

◆ mConstraintForceMixing

double dart::constraint::ContactConstraint::mConstraintForceMixing = 1e-5
staticprivate

Global constraint force mixing parameter in the range of [1e-9, 1].

The default is 1e-5

See also
http://www.ode.org/ode-latest-userguide.html#sec_3_8_0

◆ mContact

collision::Contact& dart::constraint::ContactConstraint::mContact
private

Contact between mBodyNode1 and mBodyNode2.

◆ mDim

std::size_t dart::constraint::ConstraintBase::mDim
protectedinherited

Dimension of constraint.

◆ mErrorAllowance

double dart::constraint::ContactConstraint::mErrorAllowance = 0.0
staticprivate

Global constraint error allowance.

◆ mErrorReductionParameter

double dart::constraint::ContactConstraint::mErrorReductionParameter = 0.01
staticprivate

Global constraint error redection parameter in the range of [0, 1].

The default is 0.01.

◆ mFirstFrictionalDirection

Eigen::Vector3d dart::constraint::ContactConstraint::mFirstFrictionalDirection
private

First frictional direction.

◆ mFrictionCoeff

double dart::constraint::ContactConstraint::mFrictionCoeff
private

Coefficient of Friction.

◆ mIsBounceOn

bool dart::constraint::ContactConstraint::mIsBounceOn
private

◆ mIsFrictionOn

bool dart::constraint::ContactConstraint::mIsFrictionOn
private

◆ mIsSelfCollision

bool dart::constraint::ContactConstraint::mIsSelfCollision
private

Whether this contact is self-collision.

◆ mMaxErrorReductionVelocity

double dart::constraint::ContactConstraint::mMaxErrorReductionVelocity = 1e-3
staticprivate

Maximum error reduction velocity.

◆ mRestitutionCoeff

double dart::constraint::ContactConstraint::mRestitutionCoeff
private

Coefficient of restitution.

◆ mSpatialNormalA

Eigen::Matrix<double, 6, Eigen::Dynamic> dart::constraint::ContactConstraint::mSpatialNormalA
private

Local body jacobians for mBodyNode1.

◆ mSpatialNormalB

Eigen::Matrix<double, 6, Eigen::Dynamic> dart::constraint::ContactConstraint::mSpatialNormalB
private

Local body jacobians for mBodyNode2.

◆ mTimeStep

double dart::constraint::ContactConstraint::mTimeStep
private

Time step.