Rigid Body Dynamics Library
ConstraintSet Struct Reference

Structure that contains both constraint information and workspace memory. More...

#include <Constraints.h>

Public Member Functions

 ConstraintSet ()
 
unsigned int getGroupIndexByName (const char *userDefinedName)
 getGroupIndex returns the index to a constraints that have been grouped because they are of the same type, apply to the same bodies, and apply to the same local frames on each body. More...
 
unsigned int getGroupIndexById (unsigned int userDefinedId)
 getGroupIndex returns the index to a constraints that have been grouped because they are of the same type, apply to the same bodies, and apply to the same local frames on each body. More...
 
unsigned int getGroupIndexByAssignedId (unsigned int assignedId)
 getGroupIndex returns the index to a constraints that have been grouped because they are of the same type, apply to the same bodies, and apply to the same local frames on each body. More...
 
unsigned int getGroupIndexMax ()
 getGroupIndexMax returns the maximum valid constraint group index (the min. is zero) so that constraint groups can be iterated over if desired. More...
 
const char * getGroupName (unsigned int groupIndex)
 Returns the name of the constraint group, which may differ from the names entered by the user if the constraint is one in which grouping is done automatically (e.g. contact and loop constraints) More...
 
unsigned int getGroupSize (unsigned int groupIndex)
 Returns the number of constraint equations in this group. More...
 
unsigned int getGroupType (unsigned int groupIndex)
 Returns integer corresponding to the ConstraintType. More...
 
unsigned int getGroupId (unsigned int groupIndex)
 Returns the user-defined-id of the constraint group, which may differ from the names entered by the user if the constraint is one in which grouping is done automatically (e.g. contact and loop constraints). More...
 
unsigned int getGroupAssignedId (unsigned int groupIndex)
 Returns assigned id of the constraint group which will be the first id assigned to an entry in a group (if the grouping was done automatically - as is done for contact and loop constraints). More...
 
void calcForces (unsigned int groupIndex, Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, std::vector< unsigned int > &updConstraintBodyIdsOutput, std::vector< Math::SpatialTransform > &updConstraintBodyFramesOutput, std::vector< Math::SpatialVector > &updConstraintForcesOutput, bool resolveAllInRootFrame=false, bool updateKinematics=false)
 calcForces resolves the generalized forces generated by this constraint into equivalent spatial forces (resolved in the local or the base frame) that are applied between the bodies and frames that this constraint applies to. More...
 
void calcImpulses (unsigned int groupIndex, Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, std::vector< unsigned int > &constraintBodyIdsOutput, std::vector< Math::SpatialTransform > &constraintBodyFramesOutput, std::vector< Math::SpatialVector > &constraintImpulsesOutput, bool resolveAllInRootFrame=false, bool updateKinematics=false)
 calcImpulses resolves the generalized impluses generated by this constraint into equivalent spatial impulses (resolved in the local or the base frame) that are applied between the bodies and frames that this constraint applies to. More...
 
void calcPositionError (unsigned int groupIndex, Model &model, const Math::VectorNd &Q, Math::VectorNd &positionErrorOutput, bool updateKinematics=false)
 calcPositionError calculates the vector of position errors associated with this constraint. Note that if the constraint group, or parts of it, are not defined at the position level then 0's will be returned. More...
 
void calcVelocityError (unsigned int groupIndex, Model &model, const Math::VectorNd &Q, const Math::VectorNd &QDot, Math::VectorNd &velocityErrorOutput, bool updateKinematics=false)
 calcVelocityError calculates the vector of position errors associated with this constraint. Note that if the constraint group, or parts of it, are not defined at the position level then 0's will be returned. More...
 
void calcBaumgarteStabilizationForces (unsigned int groupIndex, Model &model, const Math::VectorNd &positionError, const Math::VectorNd &velocityError, Math::VectorNd &baumgarteForcesOutput)
 
bool isBaumgarteStabilizationEnabled (unsigned int groupIndex)
 
void enableBaumgarteStabilization (unsigned int groupIndex)
 
void disableBaumgarteStabilization (unsigned int groupIndex)
 
void getBaumgarteStabilizationCoefficients (unsigned int groupIndex, Math::Vector2d &baumgartePositionVelocityCoefficientsOutput)
 
unsigned int AddContactConstraint (unsigned int bodyId, const Math::Vector3d &bodyPoint, const Math::Vector3d &worldNormal, const char *constraintName=NULL, unsigned int userDefinedId=std::numeric_limits< unsigned int >::max())
 Adds a single contact constraint (point-ground) to the constraint set. More...
 
unsigned int AddLoopConstraint (unsigned int bodyIdPredecessor, unsigned int bodyIdSuccessor, const Math::SpatialTransform &XPredecessor, const Math::SpatialTransform &XSuccessor, const Math::SpatialVector &constraintAxisInPredecessor, bool enableBaumgarteStabilization=false, double stabilizationTimeConstant=0.1, const char *constraintName=NULL, unsigned int userDefinedId=std::numeric_limits< unsigned int >::max())
 Adds a loop constraint to the constraint set. More...
 
unsigned int AddCustomConstraint (std::shared_ptr< Constraint > customConstraint)
 Adds a custom constraint to the constraint set. More...
 
ConstraintSet Copy ()
 Copies the constraints and resets its ConstraintSet::bound flag. More...
 
void SetSolver (Math::LinearSolver solver)
 Specifies which method should be used for solving undelying linear systems. More...
 
bool Bind (const Model &model)
 Initializes and allocates memory for the constraint set. More...
 
void SetActuationMap (const Model &model, const std::vector< bool > &actuatedDof)
 Initializes and allocates memory needed for InverseDynamicsConstraints and InverseDynamicsConstraintsRelaxed. More...
 
size_t size () const
 Returns the number of constraints. More...
 
void clear ()
 Clears all variables in the constraint set. More...
 

Data Fields

Math::LinearSolver linear_solver
 Method that should be used to solve internal linear systems. More...
 
bool bound
 Whether the constraint set was bound to a model (mandatory!). More...
 
std::vector< ConstraintTypeconstraintType
 
std::vector< std::string > name
 
std::map< std::string, unsigned int > nameGroupMap
 
std::map< unsigned int, unsigned int > userDefinedIdGroupMap
 
std::map< unsigned int, unsigned int > idGroupMap
 
std::vector< std::shared_ptr< Constraint > > constraints
 
std::vector< std::shared_ptr< ContactConstraint > > contactConstraints
 
std::vector< std::shared_ptr< LoopConstraint > > loopConstraints
 
Math::VectorNd err
 
Math::VectorNd errd
 
Math::VectorNd force
 
Math::VectorNd impulse
 Constraint impulses along the constraint directions. More...
 
Math::VectorNd v_plus
 The velocities we want to have along the constraint directions. More...
 
Math::MatrixNd H
 Workspace for the joint space inertia matrix. More...
 
Math::VectorNd C
 Workspace for the coriolis forces. More...
 
Math::VectorNd gamma
 Workspace of the right hand side of the acceleration equation. More...
 
Math::MatrixNd G
 Workspace for the constraint Jacobian. More...
 
Math::MatrixNd A
 Workspace for the Lagrangian left-hand-side matrix. More...
 
Math::VectorNd b
 Workspace for the Lagrangian right-hand-side. More...
 
Math::VectorNd x
 Workspace for the Lagrangian solution. More...
 
Math::MatrixNd S
 
Math::MatrixNd P
 Selection matrix for the non-actuated parts of the model. More...
 
Math::MatrixNd W
 
Math::MatrixNd Winv
 
Math::VectorNd WinvSC
 
Math::VectorNd u
 
Math::VectorNd v
 
Math::MatrixNd F
 
Math::MatrixNd Ful
 
Math::MatrixNd Fur
 
Math::MatrixNd Fll
 
Math::MatrixNd Flr
 
Math::MatrixNd GT
 
Math::MatrixNd GTu
 
Math::MatrixNd GTl
 
Math::VectorNd g
 
Math::MatrixNd Ru
 
Math::VectorNd py
 
Math::VectorNd pz
 
Eigen::HouseholderQR< Math::MatrixNdGT_qr
 Workspace for the QR decomposition of the null-space method. More...
 
Eigen::FullPivHouseholderQR< Math::MatrixNdGPT_full_qr
 
Math::MatrixNd GT_qr_Q
 
Math::MatrixNd GPT
 
Math::MatrixNd Y
 
Math::MatrixNd Z
 
Math::MatrixNd R
 
Math::VectorNd qddot_y
 
Math::VectorNd qddot_z
 
Math::MatrixNd K
 Workspace for the Inverse Articulated-Body Inertia. More...
 
Math::VectorNd a
 Workspace for the accelerations of due to the test forces. More...
 
Math::VectorNd QDDot_t
 Workspace for the test accelerations. More...
 
Math::VectorNd QDDot_0
 Workspace for the default accelerations. More...
 
std::vector< Math::SpatialVectorf_t
 Workspace for the test forces. More...
 
std::vector< Math::SpatialVectorf_ext_constraints
 Workspace for the actual spatial forces. More...
 
std::vector< Math::Vector3dpoint_accel_0
 Workspace for the default point accelerations. More...
 
std::vector< Math::SpatialVectord_pA
 Workspace for the bias force due to the test force. More...
 
std::vector< Math::SpatialVectord_a
 Workspace for the acceleration due to the test force. More...
 
Math::VectorNd d_u
 
std::vector< Math::SpatialMatrixd_IA
 Workspace for the inertia when applying constraint forces. More...
 
std::vector< Math::SpatialVectord_U
 Workspace when applying constraint forces. More...
 
Math::VectorNd d_d
 Workspace when applying constraint forces. More...
 
std::vector< Math::Vector3dd_multdof3_u
 
ConstraintCache cache
 

Detailed Description

Structure that contains both constraint information and workspace memory.

This structure is used to reduce the amount of memory allocations that are needed when computing constraint forces.

The ConstraintSet has to be bound to a model using ConstraintSet::Bind() before it can be used in ForwardDynamicsContacts .

Definition at line 281 of file Constraints.h.


The documentation for this struct was generated from the following file: