Simbody
3.5
|
Enforce that a fixed station on one body remains coincident with a fixed station on a second body, as though there were a ball joint connecting them at those points. More...
Public Member Functions | |
Ball (MobilizedBody &body1, MobilizedBody &body2) | |
Connect the origin of body1 to the origin of body2. More... | |
Ball (MobilizedBody &body1, const Vec3 &defaultPoint1, MobilizedBody &body2, const Vec3 &defaultPoint2) | |
Connect body1 and body2 at given station points, given in the body frame of the corresponding body. More... | |
Ball () | |
Default constructor creates an empty handle. More... | |
void | setPointOnBody1 (State &state, const Vec3 &point_B1) const |
Change the station point on body 1 at which this Constraint acts. More... | |
void | setPointOnBody2 (State &state, const Vec3 &point_B2) const |
Change the station point on body 2 at which this Constraint acts. More... | |
const Vec3 & | getPointOnBody1 (const State &state) const |
Return from the given state the constrained station on body 1, in the body 1 frame. More... | |
const Vec3 & | getPointOnBody2 (const State &state) const |
Return from the given state the constrained station on body 2, in the body 2 frame. More... | |
Ball & | setDefaultPointOnBody1 (const Vec3 &defaultPoint_B1) |
Change the default station location on body 1. More... | |
Ball & | setDefaultPointOnBody2 (const Vec3 &defaultPoint_B2) |
Change the default station location on body 2. More... | |
const Vec3 & | getDefaultPointOnBody1 () const |
Return the default location for the station point on body 1, as a vector in the body 1 frame. More... | |
const Vec3 & | getDefaultPointOnBody2 () const |
Return the default location for the station point on body 2, as a vector in the body 2 frame. More... | |
Ball & | setDefaultRadius (Real r) |
For visualization only, you can override the default radius used by this Constraint to draw itself. More... | |
Real | getDefaultRadius () const |
Retreive the radius being used for visualization of this Constraint. More... | |
MobilizedBodyIndex | getBody1MobilizedBodyIndex () const |
Return the MobilizedBodyIndex corresponding to body 1. More... | |
MobilizedBodyIndex | getBody2MobilizedBodyIndex () const |
Return the MobilizedBodyIndex corresponding to body 2. More... | |
Vec3 | getPositionErrors (const State &state) const |
Return the current position-level constraint error for this Constraint. More... | |
Vec3 | getVelocityErrors (const State &state) const |
Return the current velocity-level constraint error for this Constraint. More... | |
Vec3 | getAccelerationErrors (const State &) const |
Return the current acceleration-level constraint error for this Constraint. More... | |
Vec3 | getBallReactionForceOnBody1 (const State &) const |
Return the force currently being applied by this Constraint to the point of body 1 that is coincident in space with the constrained point on body 2. More... | |
Vec3 | getBallReactionForceOnBody2 (const State &) const |
Return the force currently being applied by this Constraint to body 2, at its constrained station point. More... | |
Vec3 | getMultipliers (const State &state) const |
Return the three Lagrange multipliers associated with the three accleration-level constraint equations generated by this Constraint. More... | |
Public Member Functions inherited from SimTK::Constraint | |
Constraint () | |
Default constructor creates an empty Constraint handle that can be used to reference any Constraint. More... | |
Constraint (ConstraintImpl *r) | |
For internal use: construct a new Constraint handle referencing a particular implementation object. More... | |
void | disable (State &) const |
Disable this Constraint, effectively removing it from the system. More... | |
void | enable (State &) const |
Enable this Constraint, without necessarily satisfying it. More... | |
bool | isDisabled (const State &) const |
Test whether this constraint is currently disabled in the supplied State. More... | |
bool | isDisabledByDefault () const |
Test whether this Constraint is disabled by default in which case it must be explicitly enabled before it will take effect. More... | |
void | setDisabledByDefault (bool shouldBeDisabled) |
Normally Constraints are enabled when defined and can be disabled later. More... | |
operator ConstraintIndex () const | |
This is an implicit conversion from Constraint to ConstraintIndex when needed. More... | |
const SimbodyMatterSubsystem & | getMatterSubsystem () const |
Get a const reference to the matter subsystem that contains this Constraint. More... | |
SimbodyMatterSubsystem & | updMatterSubsystem () |
Assuming you have writable access to this Constraint, get a writable reference to the containing matter subsystem. More... | |
ConstraintIndex | getConstraintIndex () const |
Get the ConstraintIndex that was assigned to this Constraint when it was added to the matter subsystem. More... | |
bool | isInSubsystem () const |
Test whether this Constraint is contained within a matter subsystem. More... | |
bool | isInSameSubsystem (const MobilizedBody &mobod) const |
Test whether the supplied MobilizedBody is in the same matter subsystem as this Constraint. More... | |
int | getNumConstrainedBodies () const |
Return the number of unique bodies directly restricted by this constraint. More... | |
const MobilizedBody & | getMobilizedBodyFromConstrainedBody (ConstrainedBodyIndex consBodyIx) const |
Return a const reference to the actual MobilizedBody corresponding to one of the Constrained Bodies included in the count returned by getNumConstrainedBodies(). More... | |
const MobilizedBody & | getAncestorMobilizedBody () const |
Return a const reference to the actual MobilizedBody which is serving as the Ancestor body for the constrained bodies in this Constraint. More... | |
int | getNumConstrainedMobilizers () const |
Return the number of unique mobilizers directly restricted by this Constraint. More... | |
const MobilizedBody & | getMobilizedBodyFromConstrainedMobilizer (ConstrainedMobilizerIndex consMobilizerIx) const |
Return a const reference to the actual MobilizedBody corresponding to one of the Constrained Mobilizers included in the count returned by getNumConstrainedMobilizers(). More... | |
const SimbodyMatterSubtree & | getSubtree () const |
Return a subtree object indicating which parts of the multibody tree are potentially affected by this Constraint. More... | |
int | getNumConstrainedQ (const State &, ConstrainedMobilizerIndex) const |
Return the number of constrainable generalized coordinates q associated with a particular constrained mobilizer. More... | |
int | getNumConstrainedU (const State &, ConstrainedMobilizerIndex) const |
Return the number of constrainable mobilities u associated with a particular constrained mobilizer. More... | |
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. More... | |
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. More... | |
int | getNumConstrainedQ (const State &) const |
Return the sum of the number of coordinates q associated with each of the constrained mobilizers. More... | |
int | getNumConstrainedU (const State &) const |
Return the sum of the number of mobilities u associated with each of the constrained mobilizers. More... | |
QIndex | getQIndexOfConstrainedQ (const State &state, ConstrainedQIndex consQIndex) const |
Map one of this Constraint's constrained q's to the corresponding index within the matter subsystem's whole q vector. More... | |
UIndex | getUIndexOfConstrainedU (const State &state, ConstrainedUIndex consUIndex) const |
Map one of this Constraint's constrained U's (or mobilities) to the corresponding index within the matter subsystem's whole u vector. More... | |
void | getNumConstraintEquationsInUse (const State &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. More... | |
void | getIndexOfMultipliersInUse (const State &state, MultiplierIndex &px0, MultiplierIndex &vx0, MultiplierIndex &ax0) const |
Return the start of the blocks of multipliers (or acceleration errors) assigned to this Constraint. More... | |
void | setMyPartInConstraintSpaceVector (const State &state, const Vector &myPart, Vector &constraintSpace) const |
Set the part of a complete constraint-space vector that belongs to this constraint. More... | |
void | getMyPartFromConstraintSpaceVector (const State &state, const Vector &constraintSpace, Vector &myPart) const |
Get the part of a complete constraint-space vector that belongs to this constraint. More... | |
Vector | getPositionErrorsAsVector (const State &) const |
Get a Vector containing the position errors. More... | |
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. More... | |
Vector | getVelocityErrorsAsVector (const State &) const |
Get a Vector containing the velocity errors. More... | |
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. More... | |
Vector | calcAccelerationErrorFromUDot (const State &, const Vector &udot) const |
Vector | getMultipliersAsVector (const State &) const |
Get a Vector containing the Lagrange multipliers. More... | |
void | getConstraintForcesAsVectors (const State &state, Vector_< SpatialVec > &bodyForcesInG, Vector &mobilityForces) const |
Given a State realized through Acceleration stage, return the forces that were applied to the system by this Constraint, with body forces expressed in Ground. More... | |
Vector_< SpatialVec > | getConstrainedBodyForcesAsVector (const State &state) const |
For convenience, returns constrained body forces as the function return. More... | |
Vector | getConstrainedMobilityForcesAsVector (const State &state) const |
For convenience, returns constrained mobility forces as the function return. More... | |
Real | calcPower (const State &state) const |
Calculate the power being applied by this Constraint to the system. More... | |
Matrix | calcAccelerationConstraintMatrixA (const State &) const |
Matrix | calcAccelerationConstraintMatrixAt (const State &) const |
void | setIsConditional (bool isConditional) |
(Advanced) Mark this constraint as one that is only conditionally active. More... | |
bool | isConditional () const |
(Advanced) Get the value of the isConditional flag. More... | |
Public Member Functions inherited from SimTK::PIMPLHandle< Constraint, ConstraintImpl, true > | |
bool | isEmptyHandle () const |
Returns true if this handle is empty, that is, does not refer to any implementation object. More... | |
bool | isOwnerHandle () const |
Returns true if this handle is the owner of the implementation object to which it refers. More... | |
bool | isSameHandle (const Constraint &other) const |
Determine whether the supplied handle is the same object as "this" PIMPLHandle. More... | |
void | disown (Constraint &newOwner) |
Give up ownership of the implementation to an empty handle. More... | |
PIMPLHandle & | referenceAssign (const Constraint &source) |
"Copy" assignment but with shallow (pointer) semantics. More... | |
PIMPLHandle & | copyAssign (const Constraint &source) |
This is real copy assignment, with ordinary C++ object ("value") semantics. More... | |
void | clearHandle () |
Make this an empty handle, deleting the implementation object if this handle is the owner of it. More... | |
const ConstraintImpl & | getImpl () const |
Get a const reference to the implementation associated with this Handle. More... | |
ConstraintImpl & | updImpl () |
Get a writable reference to the implementation associated with this Handle. More... | |
int | getImplHandleCount () const |
Return the number of handles the implementation believes are referencing it. More... | |
Additional Inherited Members | |
Public Types inherited from SimTK::Constraint | |
typedef Rod | ConstantDistance |
Synonym for Rod constraint. More... | |
typedef Ball | CoincidentPoints |
Synonym for Ball constraint. More... | |
typedef Ball | Spherical |
Synonym for Ball constraint. More... | |
typedef Weld | CoincidentFrames |
Public Types inherited from SimTK::PIMPLHandle< Constraint, ConstraintImpl, true > | |
typedef PIMPLHandle< Constraint, ConstraintImpl, PTR > | HandleBase |
typedef HandleBase | ParentHandle |
Protected Member Functions inherited from SimTK::PIMPLHandle< Constraint, ConstraintImpl, true > | |
PIMPLHandle () | |
The default constructor makes this an empty handle. More... | |
PIMPLHandle (ConstraintImpl *p) | |
This provides consruction of a handle referencing an existing implementation object. More... | |
PIMPLHandle (const PIMPLHandle &source) | |
The copy constructor makes either a deep (value) or shallow (reference) copy of the supplied source PIMPL object, based on whether this is a "pointer
semantics" (PTR=true) or "object (value) semantics" (PTR=false, default) class. More... | |
~PIMPLHandle () | |
Note that the destructor is non-virtual. More... | |
PIMPLHandle & | operator= (const PIMPLHandle &source) |
Copy assignment makes the current handle either a deep (value) or shallow (reference) copy of the supplied source PIMPL object, based on whether this is a "pointer sematics" (PTR=true) or "object (value) semantics" (PTR=false, default) class. More... | |
void | setImpl (ConstraintImpl *p) |
Set the implementation for this empty handle. More... | |
bool | hasSameImplementation (const Constraint &other) const |
Determine whether the supplied handle is a reference to the same implementation object as is referenced by "this" PIMPLHandle. More... | |
Enforce that a fixed station on one body remains coincident with a fixed station on a second body, as though there were a ball joint connecting them at those points.
Uses three position-level (holonomic) constraint equations to prevent relative translation in three orthogonal directions.
At construction you specify the two bodies to be connected by the Constraint, and give default values for a station on each body. The State is initialized with those default stations, but you can change them later.
The constraint is enforced by an internal (non-working) force applied at the spatial location of the point on body 2, on material points of each body that are coincident with that spatial location. Note that this is somewhat asymmetric when the ball is not properly assembled – it acts as though the contact occurs at the point on body 2, not at the point on body 1. That is critical to ensure that Newton's 3rd law is satisified – the action and reaction must occur at the same point.
The assembly condition is the same as the runtime constraint – the two points can be brought together by driving the perr to zero.
SimTK::Constraint::Ball::Ball | ( | MobilizedBody & | body1, |
MobilizedBody & | body2 | ||
) |
Connect the origin of body1 to the origin of body2.
That is, the default stations will both be (0,0,0). You can change those later in the State using setPointOnBody1() and setPointOnBody2().
SimTK::Constraint::Ball::Ball | ( | MobilizedBody & | body1, |
const Vec3 & | defaultPoint1, | ||
MobilizedBody & | body2, | ||
const Vec3 & | defaultPoint2 | ||
) |
Connect body1 and body2 at given station points, given in the body frame of the corresponding body.
You can change those later in the State using setPointOnBody1() and setPointOnBody2().
|
inline |
Default constructor creates an empty handle.
Change the station point on body 1 at which this Constraint acts.
Provide the station location in the body 1 local frame. This overrides the default point that was supplied on construction. This is an Instance-stage change.
Change the station point on body 2 at which this Constraint acts.
Provide the station location in the body 2 local frame. This overrides the default point that was supplied on construction. This is an Instance-stage change.
Return from the given state the constrained station on body 1, in the body 1 frame.
Return from the given state the constrained station on body 2, in the body 2 frame.
Change the default station location on body 1.
This is a topological change meaning you'll have to call realizeTopology() again after changing the default point. If you want to change the constrained station during a simulation, use setPointOnBody1() instead to override it in a State.
Change the default station location on body 2.
This is a topological change meaning you'll have to call realizeTopology() again after changing the default point. If you want to change the constrained station during a simulation, use setPointOnBody2() instead to override it in a State.
const Vec3& SimTK::Constraint::Ball::getDefaultPointOnBody1 | ( | ) | const |
Return the default location for the station point on body 1, as a vector in the body 1 frame.
Note that this is not necessarily the station point being used for any given State; use getPointOnBody1() for that.
const Vec3& SimTK::Constraint::Ball::getDefaultPointOnBody2 | ( | ) | const |
Return the default location for the station point on body 2, as a vector in the body 2 frame.
Note that this is not necessarily the station point being used for any given State; use getPointOnBody2() for that.
For visualization only, you can override the default radius used by this Constraint to draw itself.
Real SimTK::Constraint::Ball::getDefaultRadius | ( | ) | const |
Retreive the radius being used for visualization of this Constraint.
MobilizedBodyIndex SimTK::Constraint::Ball::getBody1MobilizedBodyIndex | ( | ) | const |
Return the MobilizedBodyIndex corresponding to body 1.
MobilizedBodyIndex SimTK::Constraint::Ball::getBody2MobilizedBodyIndex | ( | ) | const |
Return the MobilizedBodyIndex corresponding to body 2.
Return the current position-level constraint error for this Constraint.
This is the vector between the constrained stations on body 1 and body 2, which would be zero if this constraint were perfectly satisfied. The returned vector is measured in the Ancestor body frame. The given state must be realized through Position stage.
Return the current velocity-level constraint error for this Constraint.
This is the relative velocity between the material points of body 1 and body 2 that are coincident with the constrained station point on body 2; note that this is subtly different from the time derivative of the position error vector. The returned vector is measured in the Ancestor body frame. The given state must be realized through Velocity stage.
Return the current acceleration-level constraint error for this Constraint.
This is the relative acceleration between the material points of body 1 and body 2 that are coincident with the constrained station point on body 2; this is precisely the time derivative of the velocity error vector (but not exactly the second time derivative of the position error). The returned vector is measured in the Ancestor body frame. The given state must be realized through Acceleration stage.
Return the force currently being applied by this Constraint to the point of body 1 that is coincident in space with the constrained point on body 2.
The force vector is expressed in body 1's local frame.
Return the force currently being applied by this Constraint to body 2, at its constrained station point.
The force vector is expressed in body 2's local frame.
Return the three Lagrange multipliers associated with the three accleration-level constraint equations generated by this Constraint.
Although these are related to reaction forces, if that's what you're interested in you should use getBallReactionForcesOnBody1() or getBallReactionForceOnBody2() instead; the definition of the multipliers is somewhat arbitrary and will not always be easy to interpret as forces. The given state must be realized through Acceleration stage.