Simbody  3.7
SimTK::Constraint::NoSlip1D Class Reference

One non-holonomic constraint equation. More...

+ Inheritance diagram for SimTK::Constraint::NoSlip1D:

Public Member Functions

 NoSlip1D (MobilizedBody &caseBodyC, const Vec3 &P_C, const UnitVec3 &n_C, MobilizedBody &movingBody0, MobilizedBody &movingBody1)
 Define the up to three bodies involved in this constraint: the two "moving" bodies and a Case body, and a default contact point and no-slip direction in the Case body frame C. More...
 
 NoSlip1D ()
 Default constructor creates an empty handle. More...
 
void setContactPoint (State &state, const Vec3 &point_C) const
 Change the contact point at which this Constraint acts. More...
 
void setDirection (State &state, const UnitVec3 &direction_C) const
 Change the no-slip direction along which this Constraint acts. More...
 
const Vec3getContactPoint (const State &state) const
 Return from the given state the contact point, in the Case body frame. More...
 
const UnitVec3getDirection (const State &state) const
 Return from the given state the no-slip direction, in the Case body frame. More...
 
NoSlip1DsetDirectionDisplayLength (Real)
 For visualization only, set the length of the line used to show the no-slip direction. More...
 
NoSlip1DsetPointDisplayRadius (Real)
 For visualization only, set the radius of the sphere used to show the contact point location. More...
 
Real getDirectionDisplayLength () const
 Return the current value of the visualization line length for the no-slip direction. More...
 
Real getPointDisplayRadius () const
 Return the current value of the radius for visualization of the contact point. More...
 
NoSlip1DsetDefaultContactPoint (const Vec3 &)
 Change the default contact point; this is the initial value for for the actual contact point and is a topological change. More...
 
NoSlip1DsetDefaultDirection (const UnitVec3 &)
 Change the default no-slip direction; this is the initial value for for the actual direction and is a topological change. More...
 
MobilizedBodyIndex getCaseMobilizedBodyIndex () const
 Get the mobilized body index of the Case body that was set during construction. More...
 
MobilizedBodyIndex getMovingBodyMobilizedBodyIndex (int which) const
 Get the mobilized body index of moving body 0 or moving body 1 that was set during construction. More...
 
const UnitVec3getDefaultDirection () const
 Obtain the default value for the no-slip direction, expressed in the Case body frame. More...
 
const Vec3getDefaultContactPoint () const
 Obtain the default value for the contact point, in the Case body frame. More...
 
Real getVelocityError (const State &state) const
 Get the velocity error for this constraint equation, using configuration and velocity information from the given state, which must already have been realized through Velocity stage. More...
 
Real getAccelerationError (const State &) const
 Get the acceleration error for this constraint equation, using configuration, velocity, and acceleration information from the given state, which must already have been realized through Acceleration stage. More...
 
Real getMultiplier (const State &) const
 Get the Lagrange multiplier for this constraint equation, using configuration, velocity, and acceleration information from the given state, which must already have been realized through Acceleration stage. More...
 
Real getForceAtContactPoint (const State &) const
 Determine the constraint force currently being 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 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

One non-holonomic constraint equation.

There is a contact point P and a no-slip direction n fixed in a case body C. There are two moving bodies B0 and B1. The material point of B0 and the material point of B1 which are each coincident with the contact point P must have identical velocities in C, along the direction n. This can be used to implement simple rolling contact between disks, such as occurs in gear trains.

The assembly condition is the same as the run-time constraint: the velocities must be made to match.

Constructor & Destructor Documentation

◆ NoSlip1D() [1/2]

SimTK::Constraint::NoSlip1D::NoSlip1D ( MobilizedBody caseBodyC,
const Vec3 P_C,
const UnitVec3 n_C,
MobilizedBody movingBody0,
MobilizedBody movingBody1 
)

Define the up to three bodies involved in this constraint: the two "moving" bodies and a Case body, and a default contact point and no-slip direction in the Case body frame C.

(If you are modeling gears then the Case is the gearbox.) The case serves to define the contact geometry but no forces are applied to it. It is OK for the Case body to be the same body as one of the moving bodies.

◆ NoSlip1D() [2/2]

Default constructor creates an empty handle.

Member Function Documentation

◆ setContactPoint()

void SimTK::Constraint::NoSlip1D::setContactPoint ( State state,
const Vec3 point_C 
) const

Change the contact point at which this Constraint acts.

Provide the station location in the Case body local frame. This overrides the default point that was supplied on construction. This is an Instance-stage change.

◆ setDirection()

void SimTK::Constraint::NoSlip1D::setDirection ( State state,
const UnitVec3 direction_C 
) const

Change the no-slip direction along which this Constraint acts.

Provide the direction unit vector in the Case body local frame. This overrides the default direction that was supplied on construction. This is an Instance-stage change.

◆ getContactPoint()

const Vec3& SimTK::Constraint::NoSlip1D::getContactPoint ( const State state) const

Return from the given state the contact point, in the Case body frame.

◆ getDirection()

const UnitVec3& SimTK::Constraint::NoSlip1D::getDirection ( const State state) const

Return from the given state the no-slip direction, in the Case body frame.

◆ setDirectionDisplayLength()

NoSlip1D& SimTK::Constraint::NoSlip1D::setDirectionDisplayLength ( Real  )

For visualization only, set the length of the line used to show the no-slip direction.

◆ setPointDisplayRadius()

NoSlip1D& SimTK::Constraint::NoSlip1D::setPointDisplayRadius ( Real  )

For visualization only, set the radius of the sphere used to show the contact point location.

◆ getDirectionDisplayLength()

Real SimTK::Constraint::NoSlip1D::getDirectionDisplayLength ( ) const

Return the current value of the visualization line length for the no-slip direction.

◆ getPointDisplayRadius()

Real SimTK::Constraint::NoSlip1D::getPointDisplayRadius ( ) const

Return the current value of the radius for visualization of the contact point.

◆ setDefaultContactPoint()

NoSlip1D& SimTK::Constraint::NoSlip1D::setDefaultContactPoint ( const Vec3 )

Change the default contact point; this is the initial value for for the actual contact point and is a topological change.

◆ setDefaultDirection()

NoSlip1D& SimTK::Constraint::NoSlip1D::setDefaultDirection ( const UnitVec3 )

Change the default no-slip direction; this is the initial value for for the actual direction and is a topological change.

◆ getCaseMobilizedBodyIndex()

MobilizedBodyIndex SimTK::Constraint::NoSlip1D::getCaseMobilizedBodyIndex ( ) const

Get the mobilized body index of the Case body that was set during construction.

◆ getMovingBodyMobilizedBodyIndex()

MobilizedBodyIndex SimTK::Constraint::NoSlip1D::getMovingBodyMobilizedBodyIndex ( int  which) const

Get the mobilized body index of moving body 0 or moving body 1 that was set during construction.

Set which to 0 or 1 accordingly.

◆ getDefaultDirection()

const UnitVec3& SimTK::Constraint::NoSlip1D::getDefaultDirection ( ) const

Obtain the default value for the no-slip direction, expressed in the Case body frame.

◆ getDefaultContactPoint()

const Vec3& SimTK::Constraint::NoSlip1D::getDefaultContactPoint ( ) const

Obtain the default value for the contact point, in the Case body frame.

◆ getVelocityError()

Real SimTK::Constraint::NoSlip1D::getVelocityError ( const State state) const

Get the velocity error for this constraint equation, using configuration and velocity information from the given state, which must already have been realized through Velocity stage.

◆ getAccelerationError()

Real SimTK::Constraint::NoSlip1D::getAccelerationError ( const State ) const

Get the acceleration error for this constraint equation, using configuration, velocity, and acceleration information from the given state, which must already have been realized through Acceleration stage.

◆ getMultiplier()

Real SimTK::Constraint::NoSlip1D::getMultiplier ( const State ) const

Get the Lagrange multiplier for this constraint equation, using configuration, velocity, and acceleration information from the given state, which must already have been realized through Acceleration stage.

While this is linearly related to the constraint force it may have arbitrary sign and scaling; if you want an actual force use getForceAtContactPoint() instead.

◆ getForceAtContactPoint()

Real SimTK::Constraint::NoSlip1D::getForceAtContactPoint ( const State ) const

Determine the constraint force currently being generated by this constraint.

The force is as applied to the second moving body, that is, moving body 1, and is applied along the no-slip direction vector.


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