Simbody
|
This is the base class for all Constraint classes, which is just a handle for the underlying hidden implementation. More...
#include <Constraint.h>
Classes | |
class | Ball |
Three constraint equations. More... | |
class | ConstantAcceleration |
One acceleration-only constraint equation. More... | |
class | ConstantAngle |
This constraint consists of a single constraint equation that enforces that a unit vector v1 fixed to one body (the "base body") must maintain a fixed angle theta with respect to a unit vector v2 fixed on the other body (the "follower body"). More... | |
class | ConstantOrientation |
Three constraint equations. More... | |
class | ConstantSpeed |
One non-holonomic constraint equation. More... | |
class | CoordinateCoupler |
This is a subclass of Constraint::Custom which uses a Function object to define a holonomic (position) constraint. More... | |
class | Custom |
The handle class Constraint::Custom (dataless) and its companion class Constraint::Custom::Implementation can be used together to define new Constraint types with arbitrary properties. More... | |
class | NoSlip1D |
One non-holonomic constraint equation. More... | |
class | PointInPlane |
One constraint equation. More... | |
class | PointOnLine |
Two constraint equations. More... | |
class | PrescribedMotion |
This is a subclass of Constraint::Custom which uses a Function to prescribe the behavior of a single generalized coordinate as a function of time. More... | |
class | Rod |
This constraint consists of one constraint equation that enforces a constant distance between a point on one body and a point on another body. More... | |
class | SpeedCoupler |
This is a subclass of Constraint::Custom which uses a Function object to define a nonholonomic (velocity) constraint. More... | |
class | Weld |
Six constraint equations. More... | |
Public Types | |
typedef Rod | ConstantDistance |
typedef Ball | CoincidentPoints |
typedef Weld | CoincidentFrames |
Public Member Functions | |
Constraint () | |
Constraint (ConstraintImpl *r) | |
void | disable (State &) const |
Disable this constraint, effectively removing it from the system. | |
void | enable (State &) const |
Enable this constraint, without necessarily satisfying it. | |
bool | isDisabled (const State &) const |
Test whether this constraint is currently disabled in the supplied State. | |
bool | isDisabledByDefault () const |
Test whether this constraint is disabled by default in which case it must be explicitly enabled before it will take effect. | |
void | setDisabledByDefault (bool shouldBeDisabled) |
Normally Constraints are enabled when defined and can be disabled later. | |
operator ConstraintIndex () const | |
ConstraintIndex | getConstraintIndex () const |
const SimbodyMatterSubsystem & | getMatterSubsystem () const |
SimbodyMatterSubsystem & | updMatterSubsystem () |
bool | isInSubsystem () const |
bool | isInSameSubsystem (const MobilizedBody &) const |
int | getNumConstrainedBodies () const |
Return the number of bodies *directly* restricted by this constraint. | |
const MobilizedBody & | getMobilizedBodyFromConstrainedBody (ConstrainedBodyIndex) const |
Return a reference to the actual MobilizedBodies included in the count above. | |
const MobilizedBody & | getAncestorMobilizedBody () const |
Return a reference to the actual MobilizedBody which is serving as the Ancestor body for the constrained bodies in this Constraint. | |
int | getNumConstrainedMobilizers () const |
Return the number of mobilizers *directly* restricted by this constraint. | |
const MobilizedBody & | getMobilizedBodyFromConstrainedMobilizer (ConstrainedMobilizerIndex) const |
Return a reference to the actual MobilizedBodies included in the count of constrained mobilizers above. | |
const SimbodyMatterSubtree & | getSubtree () const |
int | getNumConstrainedQ (const State &, ConstrainedMobilizerIndex) const |
Return the number of constrainable generalized coordinates q associated with a particular constrained mobilizer. | |
int | getNumConstrainedU (const State &, ConstrainedMobilizerIndex) const |
Return the number of constrainable mobilities u associated with a particular constrained mobilizer. | |
ConstrainedUIndex | getConstrainedUIndex (const State &, ConstrainedMobilizerIndex, MobilizerUIndex which) const |
Return the index into the constrained mobilities u array corresponding to a particular mobility of the indicated ConstrainedMobilizer. | |
ConstrainedQIndex | getConstrainedQIndex (const State &, ConstrainedMobilizerIndex, MobilizerQIndex which) const |
Return the index into the constrained coordinates q array corresponding to a particular coordinate of the indicated ConstrainedMobilizer. | |
int | getNumConstrainedQ (const State &) const |
Return the sum of the number of coordinates q associated with each of the constrained mobilizers. | |
int | getNumConstrainedU (const State &) const |
Return the sum of the number of mobilities u associated with each of the constrained mobilizers. | |
void | getNumConstraintEquationsInUse (const State &, int &mp, int &mv, int &ma) const |
Find out how many holonomic (position), nonholonomic (velocity), and acceleration-only constraint equations are currently being generated by this Constraint. | |
Vector | getPositionErrorsAsVector (const State &) const |
Get a Vector containing the position errors. | |
Vector | calcPositionErrorFromQ (const State &, const Vector &q) const |
Matrix | calcPositionConstraintMatrixP (const State &) const |
Matrix | calcPositionConstraintMatrixPt (const State &) const |
Matrix | calcPositionConstraintMatrixPNInv (const State &) const |
void | calcConstraintForcesFromMultipliers (const State &, const Vector &lambda, Vector_< SpatialVec > &bodyForcesInA, Vector &mobilityForces) const |
This operator calculates this constraint's body and mobility forces given the complete set of multipliers lambda for this Constraint. | |
Vector | getVelocityErrorsAsVector (const State &) const |
Get a Vector containing the velocity errors. | |
Vector | calcVelocityErrorFromU (const State &, const Vector &u) const |
Matrix | calcVelocityConstraintMatrixV (const State &) const |
Matrix | calcVelocityConstraintMatrixVt (const State &) const |
Vector | getAccelerationErrorsAsVector (const State &) const |
Get a Vector containing the acceleration errors. | |
Vector | calcAccelerationErrorFromUDot (const State &, const Vector &udot) const |
Vector | getMultipliersAsVector (const State &) const |
Get a Vector containing the Lagrange multipliers. | |
Matrix | calcAccelerationConstraintMatrixA (const State &) const |
Matrix | calcAccelerationConstraintMatrixAt (const State &) const |
This is the base class for all Constraint classes, which is just a handle for the underlying hidden implementation.
Each built-in Constraint type is a local subclass within Constraint, and is also derived from Constraint.
SimTK::Constraint::Constraint | ( | ) | [inline] |
SimTK::Constraint::Constraint | ( | ConstraintImpl * | r | ) | [inline, explicit] |
void SimTK::Constraint::disable | ( | State & | ) | const |
Disable this constraint, effectively removing it from the system.
This is an Instance-stage change and affects the allocation of constraint- related cache variables in the supplied State.
void SimTK::Constraint::enable | ( | State & | ) | const |
Enable this constraint, without necessarily satisfying it.
This is an Instance-stage change and affects the allocation of constraint- related cache variables in the supplied State. Note that merely enabling a constraint does not ensure that the State's positions and velocities satisfy that constraint; initial satisfaction requires use of an appropriate solver.
bool SimTK::Constraint::isDisabled | ( | const State & | ) | const |
bool SimTK::Constraint::isDisabledByDefault | ( | ) | const |
void SimTK::Constraint::setDisabledByDefault | ( | bool | shouldBeDisabled | ) |
Normally Constraints are enabled when defined and can be disabled later.
If you want to define this constraint but have it be off by default, use this method.
SimTK::Constraint::operator ConstraintIndex | ( | ) | const [inline] |
ConstraintIndex SimTK::Constraint::getConstraintIndex | ( | ) | const |
const SimbodyMatterSubsystem& SimTK::Constraint::getMatterSubsystem | ( | ) | const |
SimbodyMatterSubsystem& SimTK::Constraint::updMatterSubsystem | ( | ) |
bool SimTK::Constraint::isInSubsystem | ( | ) | const |
bool SimTK::Constraint::isInSameSubsystem | ( | const MobilizedBody & | ) | const |
int SimTK::Constraint::getNumConstrainedBodies | ( | ) | const |
Return the number of bodies *directly* restricted by this constraint.
Included are any bodies to which the Constraint may apply a body force (i.e., torque or point force). The Ancestor body is not included unless it was specified as a ConstrainedBody. This is the length of the bodyForces array for this Constraint.
const MobilizedBody& SimTK::Constraint::getMobilizedBodyFromConstrainedBody | ( | ConstrainedBodyIndex | ) | const |
Return a reference to the actual MobilizedBodies included in the count above.
0 <= index < getNumConstrainedBodies().
const MobilizedBody& SimTK::Constraint::getAncestorMobilizedBody | ( | ) | const |
Return a reference to the actual MobilizedBody which is serving as the Ancestor body for the constrained bodies in this Constraint.
This will fail if there are no constrained bodies (i.e., if getNumConstrainedBodies()==0).
int SimTK::Constraint::getNumConstrainedMobilizers | ( | ) | const |
Return the number of mobilizers *directly* restricted by this constraint.
Included are any mobilizers to which the Constraint may apply any mobility force. Like bodies, mobilizers are referenced using the MobilizedBody containing them.
const MobilizedBody& SimTK::Constraint::getMobilizedBodyFromConstrainedMobilizer | ( | ConstrainedMobilizerIndex | ) | const |
Return a reference to the actual MobilizedBodies included in the count of constrained mobilizers above.
0 <= index < getNumConstrainedMobilizers().
const SimbodyMatterSubtree& SimTK::Constraint::getSubtree | ( | ) | const |
int SimTK::Constraint::getNumConstrainedQ | ( | const State & | , |
ConstrainedMobilizerIndex | |||
) | const |
Return the number of constrainable generalized coordinates q associated with a particular constrained mobilizer.
This is just the number of generalized coordinates for that mobilizer; any or all of them may actually be unconstrained.
int SimTK::Constraint::getNumConstrainedU | ( | const State & | , |
ConstrainedMobilizerIndex | |||
) | const |
Return the number of constrainable mobilities u associated with a particular constrained mobilizer.
This is just the number of generalized speeds for that mobilizer; any or all of them may actually be unconstrained. The number of constrainable udots is the same.
ConstrainedUIndex SimTK::Constraint::getConstrainedUIndex | ( | const State & | , |
ConstrainedMobilizerIndex | , | ||
MobilizerUIndex | which | ||
) | const |
Return the index into the constrained mobilities u array corresponding to a particular mobility of the indicated ConstrainedMobilizer.
Don't confuse this with the set of participating mobilities which also includes all mobilities on each branch between the ancestor and a constrained body. The constrained mobilities are just those belonging to the mobilizers which are directly constrained.
ConstrainedQIndex SimTK::Constraint::getConstrainedQIndex | ( | const State & | , |
ConstrainedMobilizerIndex | , | ||
MobilizerQIndex | which | ||
) | const |
Return the index into the constrained coordinates q array corresponding to a particular coordinate of the indicated ConstrainedMobilizer.
Don't confuse this with the set of participating coordinates which also includes all coordinates on each branch between the ancestor and a constrained body. The constrained coordinates are just those belonging to the mobilizers which are directly constrained.
int SimTK::Constraint::getNumConstrainedQ | ( | const State & | ) | const |
Return the sum of the number of coordinates q associated with each of the constrained mobilizers.
int SimTK::Constraint::getNumConstrainedU | ( | const State & | ) | const |
Return the sum of the number of mobilities u associated with each of the constrained mobilizers.
These are the only mobilities to which the constraint may directly apply a force, so this is the dimension of the mobilityForces array.
void SimTK::Constraint::getNumConstraintEquationsInUse | ( | const State & | , |
int & | mp, | ||
int & | mv, | ||
int & | ma | ||
) | const |
Find out how many holonomic (position), nonholonomic (velocity), and acceleration-only constraint equations are currently being generated by this Constraint.
Get a Vector containing the position errors.
Many subclasses provide their own methods for getting this information in a more specific form.
void SimTK::Constraint::calcConstraintForcesFromMultipliers | ( | const State & | , |
const Vector & | lambda, | ||
Vector_< SpatialVec > & | bodyForcesInA, | ||
Vector & | mobilityForces | ||
) | const |
This operator calculates this constraint's body and mobility forces given the complete set of multipliers lambda for this Constraint.
We expect that lambda has been packed to include multipliers associated with the second derivatives of the position (holonomic) constraints, the first derivatives of the velocity (nonholonomic) constraints, and the acceleration only constraints, in that order.
The state must be realized already to Stage::Position. Returned body forces correspond only to the constrained bodies and the mobility forces correspond only to the constrained mobilities; they must be unpacked by the caller into the actual system mobilized bodies and actual system mobilities. Note that the body forces are in the ancestor body frame A, not necessarily the Ground frame G.
Get a Vector containing the velocity errors.
Many subclasses provide their own methods for getting this information in a more specific form.
Get a Vector containing the acceleration errors.
Many subclasses provide their own methods for getting this information in a more specific form.
Vector SimTK::Constraint::calcAccelerationErrorFromUDot | ( | const State & | , |
const Vector & | udot | ||
) | const |
Get a Vector containing the Lagrange multipliers.
Many subclasses provide their own methods for getting this information in a more specific form.