DART  6.10.1
dart::constraint::SoftContactConstraint Class Reference

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

#include <SoftContactConstraint.hpp>

Inheritance diagram for dart::constraint::SoftContactConstraint:
dart::constraint::ConstraintBase

Public Member Functions

 SoftContactConstraint (collision::Contact &_contact, double _timeStep)
 Constructor. More...
 
virtual ~SoftContactConstraint ()
 Destructor. More...
 
const std::string & getType () const override
 Returns a string representing the constraint type. 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 const std::string & getStaticType ()
 Returns constraint type for this class. More...
 
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 _idx) 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...
 

Static Protected Member Functions

static double computeFrictionCoefficient (const dynamics::ShapeNode *shapeNode)
 
static double computeRestitutionCoefficient (const dynamics::ShapeNode *shapeNode)
 

Protected Attributes

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

Private Member Functions

void getRelVelocity (double *_vel)
 Get change in relative velocity at contact point due to external impulse. More...
 
void updateFirstFrictionalDirection ()
 
Eigen::MatrixXd getTangentBasisMatrixODE (const Eigen::Vector3d &_n)
 
dynamics::PointMassselectCollidingPointMass (dynamics::SoftBodyNode *_softBodyNode, const Eigen::Vector3d &_point, int _faceId) const
 Find the nearest point mass from _point in a face, of which id is _faceId in _softBodyNode. More...
 
const dynamics::PointMassselectCollidingPointMass (const dynamics::SoftBodyNode *_softBodyNode, const Eigen::Vector3d &_point, int _faceId) const
 Find the nearest point mass from _point in a face, of which id is _faceId in _softBodyNode. More...
 

Private Attributes

double mTimeStep
 Time step. More...
 
dynamics::BodyNodemBodyNode1
 Fircst body node. More...
 
dynamics::BodyNodemBodyNode2
 Second body node. More...
 
dynamics::SoftBodyNodemSoftBodyNode1
 First soft body node. More...
 
dynamics::SoftBodyNodemSoftBodyNode2
 Second soft body node. More...
 
dynamics::PointMassmPointMass1
 First point mass. More...
 
dynamics::PointMassmPointMass2
 Second point mass. More...
 
std::vector< collision::Contact * > mContacts
 Contacts between mBodyNode1 and mBodyNode2. More...
 
collision::SoftCollisionInfo * mSoftCollInfo
 Soft collision information. More...
 
Eigen::Vector3d mFirstFrictionalDirection
 First frictional direction. More...
 
double mFrictionCoeff
 Coefficient of Friction. More...
 
double mRestitutionCoeff
 Coefficient of restitution. More...
 
common::aligned_vector< Eigen::Vector6dmJacobians1
 Local body jacobians for mBodyNode1. More...
 
common::aligned_vector< Eigen::Vector6dmJacobians2
 Local body jacobians for mBodyNode2. More...
 
Eigen::Vector3d mBodyDirection1
 Contact normal expressed in body frame of the first body node. More...
 
Eigen::Vector3d mBodyDirection2
 Contact normal expressed in body frame of the second body node. 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+1
 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

SoftContactConstraint represents a contact constraint between two bodies.

Constructor & Destructor Documentation

◆ SoftContactConstraint()

dart::constraint::SoftContactConstraint::SoftContactConstraint ( collision::Contact _contact,
double  _timeStep 
)

Constructor.

◆ ~SoftContactConstraint()

dart::constraint::SoftContactConstraint::~SoftContactConstraint ( )
virtual

Destructor.

Member Function Documentation

◆ applyImpulse()

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

Apply computed constraint impulse to constrained skeletons.

Implements dart::constraint::ConstraintBase.

◆ applyUnitImpulse()

void dart::constraint::SoftContactConstraint::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

◆ computeFrictionCoefficient()

double dart::constraint::SoftContactConstraint::computeFrictionCoefficient ( const dynamics::ShapeNode shapeNode)
staticprotected

◆ computeRestitutionCoefficient()

double dart::constraint::SoftContactConstraint::computeRestitutionCoefficient ( const dynamics::ShapeNode shapeNode)
staticprotected

◆ excite()

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

Excite the constraint.

Implements dart::constraint::ConstraintBase.

◆ getConstraintForceMixing()

double dart::constraint::SoftContactConstraint::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::SoftContactConstraint::getErrorAllowance ( )
static

Get global error reduction parameter.

◆ getErrorReductionParameter()

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

Get global error reduction parameter.

◆ getFrictionDirection1()

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

Get first frictional direction.

◆ getInformation()

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

Fill LCP variables.

Implements dart::constraint::ConstraintBase.

◆ getMaxErrorReductionVelocity()

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

Get global error reduction parameter.

◆ getRelVelocity()

void dart::constraint::SoftContactConstraint::getRelVelocity ( double *  _vel)
private

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

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

◆ getRootSkeleton() [1/2]

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

◆ getRootSkeleton() [2/2]

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

◆ getStaticType()

const std::string & dart::constraint::SoftContactConstraint::getStaticType ( )
static

Returns constraint type for this class.

◆ getTangentBasisMatrixODE()

Eigen::MatrixXd dart::constraint::SoftContactConstraint::getTangentBasisMatrixODE ( const Eigen::Vector3d &  _n)
private

◆ getType()

const std::string & dart::constraint::SoftContactConstraint::getType ( ) const
overridevirtual

Returns a string representing the constraint type.

Reimplemented from dart::constraint::ConstraintBase.

◆ getVelocityChange()

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

Get velocity change due to the uint impulse.

Implements dart::constraint::ConstraintBase.

◆ isActive()

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

Return true if this constraint is active.

Implements dart::constraint::ConstraintBase.

◆ selectCollidingPointMass() [1/2]

const dynamics::PointMass * dart::constraint::SoftContactConstraint::selectCollidingPointMass ( const dynamics::SoftBodyNode _softBodyNode,
const Eigen::Vector3d &  _point,
int  _faceId 
) const
private

Find the nearest point mass from _point in a face, of which id is _faceId in _softBodyNode.

Returns a pointer to a const, and is usable with a const SoftBodyNode.

◆ selectCollidingPointMass() [2/2]

dynamics::PointMass * dart::constraint::SoftContactConstraint::selectCollidingPointMass ( dynamics::SoftBodyNode _softBodyNode,
const Eigen::Vector3d &  _point,
int  _faceId 
) const
private

Find the nearest point mass from _point in a face, of which id is _faceId in _softBodyNode.

◆ setConstraintForceMixing()

void dart::constraint::SoftContactConstraint::setConstraintForceMixing ( double  _cfm)
static

Set global constraint force mixing parameter.

◆ setErrorAllowance()

void dart::constraint::SoftContactConstraint::setErrorAllowance ( double  _allowance)
static

Set global error reduction parameter.

◆ setErrorReductionParameter()

void dart::constraint::SoftContactConstraint::setErrorReductionParameter ( double  _erp)
static

Set global error reduction parameter.

◆ setFrictionDirection()

void dart::constraint::SoftContactConstraint::setFrictionDirection ( const Eigen::Vector3d &  _dir)

Set first frictional direction.

◆ setMaxErrorReductionVelocity()

void dart::constraint::SoftContactConstraint::setMaxErrorReductionVelocity ( double  _erv)
static

Set global error reduction parameter.

◆ unexcite()

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

Unexcite the constraint.

Implements dart::constraint::ConstraintBase.

◆ uniteSkeletons()

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

Reimplemented from dart::constraint::ConstraintBase.

◆ update()

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

Update constraint using updated Skeleton's states.

Implements dart::constraint::ConstraintBase.

◆ updateFirstFrictionalDirection()

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

Friends And Related Function Documentation

◆ ConstrainedGroup

friend class ConstrainedGroup
friend

◆ ConstraintSolver

friend class ConstraintSolver
friend

Member Data Documentation

◆ mActive

bool dart::constraint::SoftContactConstraint::mActive
private

◆ mAppliedImpulseIndex

std::size_t dart::constraint::SoftContactConstraint::mAppliedImpulseIndex
private

Index of applied impulse.

◆ mBodyDirection1

Eigen::Vector3d dart::constraint::SoftContactConstraint::mBodyDirection1
private

Contact normal expressed in body frame of the first body node.

◆ mBodyDirection2

Eigen::Vector3d dart::constraint::SoftContactConstraint::mBodyDirection2
private

Contact normal expressed in body frame of the second body node.

◆ mBodyNode1

dynamics::BodyNode* dart::constraint::SoftContactConstraint::mBodyNode1
private

Fircst body node.

◆ mBodyNode2

dynamics::BodyNode* dart::constraint::SoftContactConstraint::mBodyNode2
private

Second body node.

◆ mConstraintForceMixing

double dart::constraint::SoftContactConstraint::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

◆ mContacts

std::vector<collision::Contact*> dart::constraint::SoftContactConstraint::mContacts
private

Contacts between mBodyNode1 and mBodyNode2.

◆ mDim

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

Dimension of constraint.

◆ mErrorAllowance

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

Global constraint error allowance.

◆ mErrorReductionParameter

double dart::constraint::SoftContactConstraint::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::SoftContactConstraint::mFirstFrictionalDirection
private

First frictional direction.

◆ mFrictionCoeff

double dart::constraint::SoftContactConstraint::mFrictionCoeff
private

Coefficient of Friction.

◆ mIsBounceOn

bool dart::constraint::SoftContactConstraint::mIsBounceOn
private

◆ mIsFrictionOn

bool dart::constraint::SoftContactConstraint::mIsFrictionOn
private

◆ mJacobians1

common::aligned_vector<Eigen::Vector6d> dart::constraint::SoftContactConstraint::mJacobians1
private

Local body jacobians for mBodyNode1.

◆ mJacobians2

common::aligned_vector<Eigen::Vector6d> dart::constraint::SoftContactConstraint::mJacobians2
private

Local body jacobians for mBodyNode2.

◆ mMaxErrorReductionVelocity

double dart::constraint::SoftContactConstraint::mMaxErrorReductionVelocity = 1e+1
staticprivate

Maximum error reduction velocity.

◆ mPointMass1

dynamics::PointMass* dart::constraint::SoftContactConstraint::mPointMass1
private

First point mass.

◆ mPointMass2

dynamics::PointMass* dart::constraint::SoftContactConstraint::mPointMass2
private

Second point mass.

◆ mRestitutionCoeff

double dart::constraint::SoftContactConstraint::mRestitutionCoeff
private

Coefficient of restitution.

◆ mSoftBodyNode1

dynamics::SoftBodyNode* dart::constraint::SoftContactConstraint::mSoftBodyNode1
private

First soft body node.

◆ mSoftBodyNode2

dynamics::SoftBodyNode* dart::constraint::SoftContactConstraint::mSoftBodyNode2
private

Second soft body node.

◆ mSoftCollInfo

collision::SoftCollisionInfo* dart::constraint::SoftContactConstraint::mSoftCollInfo
private

Soft collision information.

◆ mTimeStep

double dart::constraint::SoftContactConstraint::mTimeStep
private

Time step.