Simbody  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SimTK::Constraint::LineOnLineContact Class Reference

This constraint represents a bilateral connection between an edge on one body and a non-parallel edge on another. More...

+ Inheritance diagram for SimTK::Constraint::LineOnLineContact:

Public Member Functions

Construction

Methods in this section refer both to constructors, and to methods that can be used to set or change contruction (Topology-stage) parameters; these specify the values assigned by default to the corresponding state variables.

Note:

  • Changing one of these default parameters invalidates the containing System's topology, meaning that realizeTopology() will have to be called and a new State obtained before subsequent use.
  • The set...() methods return a reference to "this" LineOnLineContact element (in the manner of an assignment operator) so they can be chained in a single expression.

The default parameters can be overridden in any given State, and modified without affecting Topology; see the "Runtime Changes" section below.

 LineOnLineContact (MobilizedBody &mobod_F, const Transform &defaultEdgeFrameF, Real defaultHalfLengthF, MobilizedBody &mobod_B, const Transform &defaultEdgeFrameB, Real defaultHalfLengthB, bool enforceRolling)
 Construct a line-on-line constraint as described in the Constraint::LineOnLineContact class documentation. More...
 
 LineOnLineContact ()
 Default constructor creates an empty handle that can be used to reference any LineOnLineContact Constraint. More...
 
const MobilizedBodygetMobilizedBodyF () const
 Return a reference to the first MobilizedBody to which a line is attached. More...
 
const MobilizedBodygetMobilizedBodyB () const
 Return a reference to the second MobilizedBody to which a line is attached. More...
 
bool isEnforcingRolling () const
 Report whether this Constraint was constructed to generate rolling constraints (otherwise it is frictionless). More...
 
LineOnLineContactsetDefaultEdgeFrameF (const Transform &defaultEdgeFrameF)
 Replace the default frame of the edge attached to the first body, mobod_F, that was supplied on construction. More...
 
LineOnLineContactsetDefaultHalfLengthF (Real defaultHalfLengthF)
 Replace the default half-length for the edge attached to the first body, mobod_F, that was supplied on construction. More...
 
LineOnLineContactsetDefaultEdgeFrameB (const Transform &defaultEdgeFrameB)
 Replace the default frame of the edge attached to the second body, mobod_B, that was supplied on construction. More...
 
LineOnLineContactsetDefaultHalfLengthB (Real defaultHalfLengthF)
 Replace the default half-length for the edge attached to the second body, mobod_B, that was supplied on construction. More...
 
const TransformgetDefaultEdgeFrameF () const
 Return the default frame of the edge attached to the first body, mobod_F, as set during construction or by the most recent call to setDefaultEdgeFrameF(). More...
 
Real getDefaultHalfLengthF () const
 Return the default half-length for the edge attached to the first body, mobod_F, as set during construction or by the most recent call to setDefaultHalfLengthF(). More...
 
const TransformgetDefaultEdgeFrameB () const
 Return the default frame of the edge attached to the second body, mobod_B, as set during construction or by the most recent call to setDefaultEdgeFrameB(). More...
 
Real getDefaultHalfLengthB () const
 Return the default half-length for the edge attached to the second body, mobod_B, as set during construction or by the most recent call to setDefaultHalfLengthB(). More...
 
Runtime Changes

These refer to Position-stage discrete state variables that determine the line parameters to be used to calculate constraint forces from a given State object.

If these are not set explicitly, the parameters are set to those provided in the constructor or via the correponding setDefault...() methods. Note:

  • Changing one of these parameters invalidates the given State's Stage::Position, meaning that the State's stage will be no higher than Stage::Time after the parameter change. That ensures that position constraint errors will be recalculated before they are used.
  • The set...() methods here return a const reference to "this" LineOnLineContact element (in the manner of an assignment operator, except read-only) so they can be chained in a single expression.

You can also modify and examine the default parameters; see the "Construction" section above.

const LineOnLineContactsetEdgeFrameF (State &state, const Transform &edgeFrameF) const
 Modify the frame of the edge on the first body, mobod_F, in this state by providing a new Transform X_FEf measured from and expressed in the F frame. More...
 
const LineOnLineContactsetHalfLengthF (State &state, Real halfLengthF) const
 Modify the half-length hf of the edge on the first body, mobod_F, in this state. More...
 
const LineOnLineContactsetEdgeFrameB (State &state, const Transform &edgeFrameB) const
 Modify the frame of the edge on the second body, mobod_B, in this state by providing a new Transform X_BEb measured from and expressed in the B frame. More...
 
const LineOnLineContactsetHalfLengthB (State &state, Real halfLengthB) const
 Modify the half-length hb of the edge on the second body, mobod_B, in this state. More...
 
const TransformgetEdgeFrameF (const State &state) const
 Return the frame of the edge Ef on the first body, mobod_F, as currently set in the given state. More...
 
Real getHalfLengthF (const State &state) const
 Return the half-length of the edge Ef on the first body, mobod_F, as currently set in the given state. More...
 
const TransformgetEdgeFrameB (const State &state) const
 Return the frame of the edge Eb on the second body, mobod_B, as currently set in the given state. More...
 
Real getHalfLengthB (const State &state) const
 Return the half-length of the edge Eb on the second body, mobod_B, as currently set in the given state. More...
 
Computations

Methods here provide access to values already calculated by this constraint element, and provide operators you can call to calculate related values.

Real getPositionError (const State &state) const
 The returned position error can be viewed as the signed distance between the lines. More...
 
Vec3 getVelocityErrors (const State &state) const
 The returned velocity error vector has the time derivative of the quantity returned by getPositionError() in its z coordinate, and violation of the rolling constraints in its x and y coordinates. More...
 
Vec3 getAccelerationErrors (const State &state) const
 This vector is the time derivative of the value returned by getVelocityError(). More...
 
Vec3 getMultipliers (const State &state) const
 These are the Lagrange multipliers required to enforce the constraint equations generated here. More...
 
Vec3 findForceOnBodyBInG (const State &state) const
 Return the force vector currently being applied by this constraint to the point of body B that is coincident in space with the contact point Co. More...
 
Transform findContactFrameInG (const State &state) const
 Return the instantaneous contact frame C in the Ground frame. More...
 
void findClosestPointsInG (const State &state, Vec3 &Qf, Vec3 &Qb, bool &linesAreParallel) const
 Calculate the closest points on each of the two lines, measured and expressed in Ground. More...
 
Real findSeparation (const State &state) const
 Calculate the separation distance or penetration depth of the two edges. 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 SimbodyMatterSubsystemgetMatterSubsystem () const
 Get a const reference to the matter subsystem that contains this Constraint. More...
 
SimbodyMatterSubsystemupdMatterSubsystem ()
 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 MobilizedBodygetMobilizedBodyFromConstrainedBody (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 MobilizedBodygetAncestorMobilizedBody () 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 MobilizedBodygetMobilizedBodyFromConstrainedMobilizer (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 SimbodyMatterSubtreegetSubtree () 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_< SpatialVecgetConstrainedBodyForcesAsVector (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...
 
PIMPLHandlereferenceAssign (const Constraint &source)
 "Copy" assignment but with shallow (pointer) semantics. More...
 
PIMPLHandlecopyAssign (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...
 
PIMPLHandleoperator= (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...
 

Detailed Description

This constraint represents a bilateral connection between an edge on one body and a non-parallel edge on another.

On construction you may choose whether the connection enforces non-slipping (which we'll call "rolling" here for consistency with other constraints); otherwise the lines will slip against each other. There is always one position (holonomic) constraint equation: the lines containing the edges must touch at some point. That leaves the edges with five unconstrained degrees of freedom (dofs) to take on any relative orientation and to be touching at any point on their lengths. Optionally, there are also two velocity (nonholonomic) constraint equations that prevent relative slip between the edges. In that case there can be five position dofs but only three unconstrained velocity dofs.

Note that this is a bilateral, unconditional connection and will push or pull as necessary to keep the lines in contact. If rolling is being enforced then whatever tangential forces are necessary to keep the lines from slipping will be generated, regardless of the normal force. These constraints can form the basis for unilateral edge-edge contact with Coulomb friction, but additional conditions must be added to determine when they are active.

There are two mobilized bodies involved, we'll call them F and B. Either or both bodies can move or either can be Ground; however, we will orient the signs in our calculations so that we can think of F as "fixed"; the contact normal points towards the "outside" of F and towards the "inside" of B. That means that if we translate B relative to F in the direction of the normal, the signed distance between them increases (separation increases or penetration decreases). That allows us to say, for example, that a positive position error means separation, that a negative normal velocity error means impact, and that a positive force (negative multiplier) means compression.

Each edge E is defined by a center point P, edge direction d, and exterior "space" direction s used to define the sign convention. The s direction points outward from the solid whose two faces meet to form E, along the midplane between those two faces. We also ask for the edge half-lengths which can be used for visualization and for detecting separation caused by slipping of the end of an edge, but don't actually affect the constraint here which works on the lines containing the edges.

F has an edge Ef attached to it with center point Pf, direction df, half length hf, and outward normal sf. B has edge Eb=(Pb,db,hb,sb). The vector between the defining center points is p_PfPb=Pb-Pf, oriented from Ef's center point to Bf's center point. The contact normal n will be a unit vector aligned with w=df X db, with n=sign*w/||w||. Sign is chosen by examining the dot product of w with sf and sb so that translating Eb along +n would increase the signed distance between the edges.

To locate the contact point Co, we want to find the closest points Qf and Qb on each line, with Qf=Pf + tf*df and Qb=Pb + tb*db for some parameters tf and tb. So we are looking for the solution of this equation:

    (1) Pf + tf*df + r*n = Pb + tb*db

where r is the separation distance and n is the contact normal defined above. These are three linear equations in three unknowns, saying that we can get from the closest point Qf on Ef to the closest point Qb on Eb by moving up the contact normal direction from Qf to Qb by a signed distance r (that is, if r<0 then we are moving down the contact normal). Since n is perpendicular to both df and db, we can dot both sides of Eqn. (1) with n to get

    (2) (Pf + r*n) . n = Pb . n
==>     r*(n.n) = (Pb - Pf) . n
==> (3) r = (Pb - Pf) . n           [since n is a unit vector]

Similarly, we can dot with n X db and n X df to solve for tf and tb, resp.

    (4) (Pf + tf*df) . (n X db) = Pb . (n X db)
==>     tf * (df . (n X db)) = (Pb - Pf) . (n X db)
             (Pb-Pf).(n X db)
==> (5) tf = ----------------       [can use wXdb here instead of nXdb]
              df . (n X db)

and

    (6) Pf . (n X df) = (Pb + tb*db) . (n X df)
==>     tb * (db . (n X df)) = (Pf - Pb) . (n X df)
               (Pb-Pf).(n X df)
==> (7) tb = - ----------------     [can use wXdf here instead of nXdf]
                db . (n X df)

Then the position constraint we want to enforce is r==0, requiring the lines to touch at their closest points. If the constraint were perfectly enforced, then the contact point Co would be at the same location as the two closest points. Since it won't be enforced perfectly, we'll put the contact point at the midpoint between Qf and Qb, so Co=(Qf+Qb)/2. The exact position of Co does not matter for the position constraint, because the normal force is applied along the line including Qf and Qb. However, it will matter (a little) for the friction constraints.

For any given pose, we will define a contact frame C with origin Co whose z axis Cz=n, Cx=df, Cy=n X df. The instantaneous contact frame in Ground is available as the transform X_GC.

The contact constraints here are enforced by a normal multiplier acting along Cz, and optionally two tangential multipliers acting along Cx and Cy respectively. Together these three multipliers can be interpreted as a force expressed in frame C, and applied equal and opposite to bodies F and B at their material points coincident with contact point Co.

The assembly condition is the same as the position constraint: the two lines must meet at some point. No attempt is made to force the contact point to be within the two edges; we only make the lines containing the edges touch somewhere. There is no assembly condition for the tangential constraints since they do not restrict the allowable pose during assembly.

Constructor & Destructor Documentation

SimTK::Constraint::LineOnLineContact::LineOnLineContact ( MobilizedBody mobod_F,
const Transform defaultEdgeFrameF,
Real  defaultHalfLengthF,
MobilizedBody mobod_B,
const Transform defaultEdgeFrameB,
Real  defaultHalfLengthB,
bool  enforceRolling 
)

Construct a line-on-line constraint as described in the Constraint::LineOnLineContact class documentation.

Parameters
mobod_FThe first MobilizedBody object to which a contacting edge is attached. We'll call it F, the "fixed" body just to orient the contact; actually either or both bodies can be moving.
defaultEdgeFrameFThis Transform X_FEf defines the location and direction of the edge Ef on mobod_F, measured from and expressed in F. The frame origin is the center point Pf of the edge. Its x axis is direction df aligned with the edge; y is unused; z is Ef's outward ("space") direction sf pointing away from the polygonal solid for which Ef is an edge, midway between the two faces whose intersection defines the edge. This parameter provides the edge frame that will be present in a default State; you can modify it later in any particular State.
defaultHalfLengthFThis is the half-length hf of edge Ef. The line segment representing the edge thus runs from Pf-hf*df to Pf+hf*df. This parameter provides the half-length that will be present in a default State; you can modify it later in any particular State.
mobod_BThe second MobilizedBody object to which a contacting edge is attached.
defaultEdgeFrameBThis Transform X_BEb defines the location and direction of the edge Eb on mobod_B, measured from and expressed in B. The frame origin is the center point Pb of the edge. Its x axis is direction db aligned with the edge; y is unused; z is Eb's outward ("space") direction sb pointing away from the polygonal solid for which Eb is an edge, midway between the two faces whose intersection defines the edge. This parameter provides the edge frame that will be present in a default State; you can modify it later in any particular State.
defaultHalfLengthBThis is the half-length hb of edge Eb. The line segment representing the edge thus runs from Pb-hb*db to Pb+hb*db. This parameter provides the half-length that will be present in a default State; you can modify it later in any particular State.
enforceRollingWhether to generate tangential forces to prevent the lines from slipping against one another. Otherwise only a normal force is generated and the lines are free to slip.

Default constructor creates an empty handle that can be used to reference any LineOnLineContact Constraint.

Member Function Documentation

const MobilizedBody& SimTK::Constraint::LineOnLineContact::getMobilizedBodyF ( ) const

Return a reference to the first MobilizedBody to which a line is attached.

This refers to the mobod_F that was given in the constructor and cannot be changed after construction.

const MobilizedBody& SimTK::Constraint::LineOnLineContact::getMobilizedBodyB ( ) const

Return a reference to the second MobilizedBody to which a line is attached.

This refers to the mobod_B that was given in the constructor and cannot be changed after construction.

bool SimTK::Constraint::LineOnLineContact::isEnforcingRolling ( ) const

Report whether this Constraint was constructed to generate rolling constraints (otherwise it is frictionless).

This cannot be changed after construction.

LineOnLineContact& SimTK::Constraint::LineOnLineContact::setDefaultEdgeFrameF ( const Transform defaultEdgeFrameF)

Replace the default frame of the edge attached to the first body, mobod_F, that was supplied on construction.

This is a topological change; you'll have to call realizeTopology() again if you call this method.

See also
setEdgeFrameF()
LineOnLineContact& SimTK::Constraint::LineOnLineContact::setDefaultHalfLengthF ( Real  defaultHalfLengthF)

Replace the default half-length for the edge attached to the first body, mobod_F, that was supplied on construction.

This is a topological change; you'll have to call realizeTopology() again if you call this method.

See also
setHalfLengthF()
LineOnLineContact& SimTK::Constraint::LineOnLineContact::setDefaultEdgeFrameB ( const Transform defaultEdgeFrameB)

Replace the default frame of the edge attached to the second body, mobod_B, that was supplied on construction.

This is a topological change; you'll have to call realizeTopology() again if you call this method.

See also
setEdgeFrameB()
LineOnLineContact& SimTK::Constraint::LineOnLineContact::setDefaultHalfLengthB ( Real  defaultHalfLengthF)

Replace the default half-length for the edge attached to the second body, mobod_B, that was supplied on construction.

This is a topological change; you'll have to call realizeTopology() again if you call this method.

See also
setHalfLengthB()
const Transform& SimTK::Constraint::LineOnLineContact::getDefaultEdgeFrameF ( ) const

Return the default frame of the edge attached to the first body, mobod_F, as set during construction or by the most recent call to setDefaultEdgeFrameF().

See also
getEdgeFrameF()
Real SimTK::Constraint::LineOnLineContact::getDefaultHalfLengthF ( ) const

Return the default half-length for the edge attached to the first body, mobod_F, as set during construction or by the most recent call to setDefaultHalfLengthF().

See also
getHalfLengthF()
const Transform& SimTK::Constraint::LineOnLineContact::getDefaultEdgeFrameB ( ) const

Return the default frame of the edge attached to the second body, mobod_B, as set during construction or by the most recent call to setDefaultEdgeFrameB().

See also
getEdgeFrameB()
Real SimTK::Constraint::LineOnLineContact::getDefaultHalfLengthB ( ) const

Return the default half-length for the edge attached to the second body, mobod_B, as set during construction or by the most recent call to setDefaultHalfLengthB().

See also
getHalfLengthB()
const LineOnLineContact& SimTK::Constraint::LineOnLineContact::setEdgeFrameF ( State state,
const Transform edgeFrameF 
) const

Modify the frame of the edge on the first body, mobod_F, in this state by providing a new Transform X_FEf measured from and expressed in the F frame.

The origin is the location of the edge center point Pf; the x axis is the edge direction df; z is the outward direction sf; y is unused. This overrides the defaultEdgeFrameF in the given state, whose Stage::Position is invalidated.

const LineOnLineContact& SimTK::Constraint::LineOnLineContact::setHalfLengthF ( State state,
Real  halfLengthF 
) const

Modify the half-length hf of the edge on the first body, mobod_F, in this state.

This overrides the defaultHalfLengthF in the given state, whose Stage::Position is invalidated.

const LineOnLineContact& SimTK::Constraint::LineOnLineContact::setEdgeFrameB ( State state,
const Transform edgeFrameB 
) const

Modify the frame of the edge on the second body, mobod_B, in this state by providing a new Transform X_BEb measured from and expressed in the B frame.

The origin is the location of the edge center point Pb; the x axis is the edge direction db; z is the outward direction sb; y is unused. This overrides the defaultEdgeFrameB in the given state, whose Stage::Position is invalidated.

const LineOnLineContact& SimTK::Constraint::LineOnLineContact::setHalfLengthB ( State state,
Real  halfLengthB 
) const

Modify the half-length hb of the edge on the second body, mobod_B, in this state.

This overrides the defaultHalfLengthB in the given state, whose Stage::Position is invalidated.

const Transform& SimTK::Constraint::LineOnLineContact::getEdgeFrameF ( const State state) const

Return the frame of the edge Ef on the first body, mobod_F, as currently set in the given state.

The value is returned as a Transform X_FEf measured from and expressed in the F frame.

Real SimTK::Constraint::LineOnLineContact::getHalfLengthF ( const State state) const

Return the half-length of the edge Ef on the first body, mobod_F, as currently set in the given state.

The returned value is the scalar hf.

const Transform& SimTK::Constraint::LineOnLineContact::getEdgeFrameB ( const State state) const

Return the frame of the edge Eb on the second body, mobod_B, as currently set in the given state.

The value is returned as a Transform X_BEb measured from and expressed in the B frame.

Real SimTK::Constraint::LineOnLineContact::getHalfLengthB ( const State state) const

Return the half-length of the edge Eb on the second body, mobod_B, as currently set in the given state.

The returned value is the scalar hb.

Real SimTK::Constraint::LineOnLineContact::getPositionError ( const State state) const

The returned position error can be viewed as the signed distance between the lines.

It is positive when the lines are separated and measures their closest approach distance. It is negative when the spheres are interpenetrating and measures the penetration depth. The given state must have already been realized through Stage::Position.

Vec3 SimTK::Constraint::LineOnLineContact::getVelocityErrors ( const State state) const

The returned velocity error vector has the time derivative of the quantity returned by getPositionError() in its z coordinate, and violation of the rolling constraints in its x and y coordinates.

If rolling is not being enforced then the x and y components are returned zero; they will not contain the slip velocity in that case since any slip velocity is acceptable. Note that the returned vector is expressed in the instantaneous contact frame C, considered as fixed on body F. That is, this is the velocity of the contact point on body B's sphere in the F frame, expressed in C. The given state must have already been realized through Stage::Velocity.

Vec3 SimTK::Constraint::LineOnLineContact::getAccelerationErrors ( const State state) const

This vector is the time derivative of the value returned by getVelocityError().

Note that this is different than the acceleration of the point of sphere B at the contact point because the contact point moves with respect to that sphere. The given state must have already been realized through Stage::Acceleration.

Vec3 SimTK::Constraint::LineOnLineContact::getMultipliers ( const State state) const

These are the Lagrange multipliers required to enforce the constraint equations generated here.

For this Constraint it has units of force, but recall that the sign convention for multipliers is the opposite of that for applied forces. Thus the returned value is the negative of the force being applied to sphere B at the contact point, expressed in the contact frame C. The x,y coordinates are the tangential force used to enforce rolling (or zero if rolling is not being enforced), and the z coordinate is the force needed to enforce contact. Since this is an unconditional, bilateral constraint the multipliers may have any sign and magnitude. The given state must already be realized to Stage::Acceleration.

Vec3 SimTK::Constraint::LineOnLineContact::findForceOnBodyBInG ( const State state) const

Return the force vector currently being applied by this constraint to the point of body B that is coincident in space with the contact point Co.

An equal and opposite force is applied to body F at the same location. This is zero if the constraint is not currently enabled. Tangential forces are generated only when rolling is being enforced, but since this result is in the Ground frame all three vector measure numbers may be non-zero regardless. The given state must already be realized to Stage::Acceleration.

Transform SimTK::Constraint::LineOnLineContact::findContactFrameInG ( const State state) const

Return the instantaneous contact frame C in the Ground frame.

The actual contact point is the origin Co of the returned frame, which is placed at a point midway along the line segment connecting the closest points of the two lines. This does not imply that the normal constraint is satisifed; point Co could be far from the edges. The z direction of this frame is the contact normal; it is perpendicular to the plane formed by directions df and db, aligned so that it points towards the outside of surface F if the objects are separated. The Cx direction is df, and Cy=Cz X Cx to make a right-handed frame. This method calculates a valid value even if this constraint is currently disabled. The given state must already be realized to Stage::Position.

void SimTK::Constraint::LineOnLineContact::findClosestPointsInG ( const State state,
Vec3 Qf,
Vec3 Qb,
bool &  linesAreParallel 
) const

Calculate the closest points on each of the two lines, measured and expressed in Ground.

When the constraint is perfectly satisfied, these two points will be in the same location. When the lines are parallel these points are not unique; the returned point on each line will be midway between the line origin point and the projection of the other line's origin point on this line, and linesAreParallel will be returned true. This calculates a valid value even if this constraint is currently disabled. The given state must be realized to Stage::Position.

Real SimTK::Constraint::LineOnLineContact::findSeparation ( const State state) const

Calculate the separation distance or penetration depth of the two edges.

It is positive when the closest point Qb on line Lb lies outside the surface containing line Lf, as indicated by the adjacent-face normals provided for Lf. It is negative when point Qb lies below both of line Lf's adjacent faces in which case it measures the penetration depth. This calculates a valid value even if this constraint is currently disabled. The given state must be realized to Stage::Position.


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