|
| CustomConstraint (unsigned int constraintCount) |
|
virtual | ~CustomConstraint () |
|
virtual void | CalcConstraintsJacobianAndConstraintAxis (Model &model, unsigned int custom_constraint_id, const Math::VectorNd &Q, ConstraintSet &CS, Math::MatrixNd &G, unsigned int GrowStart, unsigned int GcolStart)=0 |
|
virtual void | CalcGamma (Model &model, unsigned int custom_constraint_id, const Math::VectorNd &Q, const Math::VectorNd &QDot, ConstraintSet &CS, const Math::MatrixNd &Gblock, Math::VectorNd &gamma, unsigned int gammaStartIndex)=0 |
|
virtual void | CalcPositionError (Model &model, unsigned int custom_constraint_id, const Math::VectorNd &Q, ConstraintSet &CS, Math::VectorNd &err, unsigned int errStartIdx)=0 |
|
virtual void | CalcVelocityError (Model &model, unsigned int custom_constraint_id, const Math::VectorNd &Q, const Math::VectorNd &QDot, ConstraintSet &CS, const Math::MatrixNd &Gblock, Math::VectorNd &err, unsigned int errStartIndex)=0 |
|
Interface to define general-purpose constraints.
The CustomConstraint interface is a general-purpose interface that is rich enough to define time-varying constraints at the position-level , the velocity-level , or the acceleration-level . These constraints all end up being applied at the acceleration-level by taking successive derivatives until we are left with The interface requires that the user populate
- G:
- constraintAxis: the axis that the constraints are applied along
- gamma:
- errPos: The vector of . If the constraint is a velocity-level constraint or higher this should be set to zero.
- errVel: The vector of . If the constraint is an acceleration-level constraint this should be set to zero
The matrix G and the vector gamma are required to compute accelerations that satisfy the desired constraints. The vectors errPos and errVel are required to apply Baumgarte stabilization (a constraint stabilization method) to stabilize the constraint. The interface provides (optional) interfaces for the functions
- CalcAssemblyPositionError
- CalcAssemblyPositionErrorJacobian
- CalcAssemblyVelocityError
- CalcAssemblyVelocityErrorJacobian
These optional functions are used only during system assembly. This permits a velocity-level constraint (e.g. such as a rolling-without-slipping constraint) to define a position-level constraint to assemble the system (e.g. bring the rolling surfaces into contact with eachother). If you are defining a position-level constraint these optional functions should simply return errPos, G, errVel, and G respectively.
It must be stated that this is an advanced feature of RBDL: you must have an in-depth knowledge of multibody-dynamics in order to write a custom constraint, and to write the corresponding test code to validate that the constraint is working. As a hint the test code in tests/CustomConstraintsTest.cc should contain a forward simulation of a simple system using the constraint and then check to see that system energy is conserved with only a small error and the constraint is also satisfied with only a small error. The observed error should drop as the integrator tolerances are lowered.
Definition at line 1048 of file Constraints.h.