#include <Constraint.h>
Public Member Functions | |
virtual | ~Implementation () |
Destructor is virtual so derived classes get a chance to clean up if necessary. | |
virtual Implementation * | clone () const =0 |
This method should produce a deep copy identical to the concrete derived Implementation object underlying this Implementation base class object. | |
Implementation (SimbodyMatterSubsystem &, int mp, int mv, int ma) | |
This Implementation base class constructor sets the topological defaults for the number of position level (holonomic), velocity level (nonholonomic), and acceleration-only constraint equations to be generated. | |
Implementation (SimbodyMatterSubsystem &) | |
The default constructor for the Implementation base class sets the number of generated equations to zero for this constraint, meaning the Constraint won't do anything by default. | |
const SimbodyMatterSubsystem & | getMatterSubsystem () const |
void | invalidateTopologyCache () const |
Call this if you want to make sure that the next realizeTopology() call does something. | |
Implementation & | setDefaultNumConstraintEquations (int mp, int mv, int ma) |
This is an alternate way to set the default number of equations to be generated if you didn't specify them in the base class constructor. | |
Implementation & | setDisabledByDefault (bool shouldBeDisabled) |
Normally Constraints are enabled when defined and can be disabled later. | |
ConstrainedBodyIndex | addConstrainedBody (const MobilizedBody &) |
Call this during construction phase to add a body to the topological structure of this Constraint. | |
ConstrainedMobilizerIndex | addConstrainedMobilizer (const MobilizedBody &) |
Call this during construction phase to add a mobilizer to the topological structure of this Constraint. | |
MobilizedBodyIndex | getMobilizedBodyIndexOfConstrainedBody (ConstrainedBodyIndex) const |
MobilizedBodyIndex | getMobilizedBodyIndexOfConstrainedMobilizer (ConstrainedMobilizerIndex) const |
Real | getOneQ (const State &, ConstrainedMobilizerIndex, MobilizerQIndex) const |
Extract from the State the value of a single generalized coordinate q from one of this Constraint's ConstrainedMobilizers. | |
Real | getOneU (const State &, ConstrainedMobilizerIndex, MobilizerUIndex) const |
Extract from the State the value of a single generalized speed (mobility) u from one of this Constraint's ConstrainedMobilizers. | |
Real | getOneQDot (const State &, ConstrainedMobilizerIndex, MobilizerQIndex, bool realizingVelocity=false) const |
Extract from the State cache the value of a single generalized coordinate time derivative qdot. | |
Real | getOneQDotDot (const State &, ConstrainedMobilizerIndex, MobilizerQIndex, bool realizingAcceleration=false) const |
Extract from the State cache the value of a single generalized coordinate second time derivative qdotdot. | |
Real | getOneUDot (const State &, ConstrainedMobilizerIndex, MobilizerUIndex, bool realizingAcceleration=false) const |
Extract from the State cache the value of a single generalized speed time derivative udot. | |
void | addInOneMobilityForce (const State &, ConstrainedMobilizerIndex, MobilizerUIndex whichU, Real force, Vector &mobilityForces) const |
Apply a scalar generalized (mobility) force force to a particular mobility of one of this Constraint's Constrained Mobilizers, adding it in to the appropriate slot of the mobilityForces vector, which is of length getNumConstrainedU() for this Constraint. | |
const Transform & | getBodyTransform (const State &s, ConstrainedBodyIndex B, bool realizingPosition=false) const |
Extract from the State cache the spatial transform X_AB giving the location and orientation of a Constrained Body B's body frame in this Constraint's Ancestor frame A. | |
const SpatialVec & | getBodyVelocity (const State &s, ConstrainedBodyIndex B, bool realizingVelocity=false) const |
Extract from the State cache the spatial velocity V_AB giving the linear and angular velocity of a Constrained Body B's body frame measured and expressed in this Constraint's Ancestor frame A. | |
const SpatialVec & | getBodyAcceleration (const State &s, ConstrainedBodyIndex B, bool realizingAcceleration=false) const |
Extract from the State cache the spatial acceleration A_AB giving the linear and angular acceleration of a Constrained Body B's body frame measured and expressed in this Constraint's Ancestor frame A. | |
const Rotation & | getBodyRotation (const State &s, ConstrainedBodyIndex B, bool realizingPosition=false) const |
Extract from the State cache the rotation matrix R_AB giving the orientation of a Constrained Body B's body frame in this Constraint's Ancestor frame A. | |
const Vec3 & | getBodyAngularVelocity (const State &s, ConstrainedBodyIndex B, bool realizingVelocity=false) const |
Extract from the State cache the angular velocity w_AB giving the angular velocity of a Constrained Body B's body frame measured and expressed in this Constraint's Ancestor frame A. | |
const Vec3 & | getBodyAngularAcceleration (const State &s, ConstrainedBodyIndex B, bool realizingAcceleration=false) const |
Extract from the State cache the angular acceleration b_AB giving the angular acceleration of a Constrained Body B's body frame measured and expressed in this Constraint's Ancestor frame A. | |
const Vec3 & | getBodyOriginLocation (const State &s, ConstrainedBodyIndex B, bool realizingPosition=false) const |
Extract from the State cache the position vector p_AB (or more explicitly, p_OA_OB) giving the location of a Constrained Body B's body frame origin OB relative to this Constraint's Ancestor (A) frame origin OA. | |
const Vec3 & | getBodyOriginVelocity (const State &s, ConstrainedBodyIndex B, bool realizingVelocity=false) const |
Extract from the State cache the linear velocity v_AB (or more explicitly, v_A_OB) giving the linear velocity of a Constrained Body B's body frame origin OB measured and expressed in this Constraint's Ancestor frame A. | |
const Vec3 & | getBodyOriginAcceleration (const State &s, ConstrainedBodyIndex B, bool realizingAcceleration=false) const |
Extract from the State cache the linear acceleration a_AB (or more explicitly, a_A_OB) giving the linear acceleration of a Constrained Body B's body frame origin OB, measured and expressed in this Constraint's Ancestor frame A. | |
Vec3 | findStationLocation (const State &s, ConstrainedBodyIndex B, const Vec3 &p_BS, bool realizingPosition=false) const |
Calculate the location p_AS in the Ancestor frame of a station S of a Constrained Body B, specified with the position vector p_BS (or more explicitly, p_OB_S) from the B frame origin to the point S, expressed in the B frame. | |
Vec3 | findStationVelocity (const State &s, ConstrainedBodyIndex B, const Vec3 &p_BS, bool realizingVelocity=false) const |
Calculate the velocity v_AS in the Ancestor frame of a station S of a Constrained Body B, specified with the position vector p_BS (or more explicitly, p_OB_S) from the B frame origin to the point S, expressed in the B frame. | |
Vec3 | findStationAcceleration (const State &s, ConstrainedBodyIndex B, const Vec3 &p_BS, bool realizingAcceleration=false) const |
Calculate the acceleration a_AS in the Ancestor frame of a station S of a Constrained Body B, specified with the position vector p_BS (or more explicitly, p_OB_S) from the B frame origin to the point S, expressed in the B frame. | |
void | addInStationForce (const State &s, ConstrainedBodyIndex B, const Vec3 &p_BS, const Vec3 &forceInA, Vector_< SpatialVec > &bodyForcesInA) const |
Apply an Ancestor-frame force to a B-frame station S given by the position vector p_BS (or more explicitly, p_OB_S) from the B frame origin to the point S, expressed in the B frame, adding to the appropriate bodyForcesInA entry for this ConstrainedBody B. | |
void | addInBodyTorque (const State &s, ConstrainedBodyIndex B, const Vec3 &torqueInA, Vector_< SpatialVec > &bodyForcesInA) const |
Apply an Ancestor-frame torque to body B, adding to the appropriate bodyForcesInA entry for this ConstrainedBody B. | |
Protected Member Functions | |
virtual void | calcDecorativeGeometryAndAppend (const State &s, Stage stage, std::vector< DecorativeGeometry > &geom) const |
Implement this optional method if you would like your constraint to generate any suggestions for geometry that could be used as default visualization as an aid to understanding a system containing this constraint. | |
Optional realize() Virtual Methods | |
Provide implementations of these methods if you want to allocate State variables (such as modeling options or parameters) or want to pre-calculate some expensive quantities and store them in the State cache for your future use.
Note that the Position, Velocity, and Acceleration-stage realize methods will be called before the constraint error calculating methods associated with this Constraint's constraint equations. That means, for example, you can calculate some distances in realizePosition() and them use them in realizePositionErrors(). | |
virtual void | realizeTopology (State &) const |
The Matter Subsystem's realizeTopology() method will call this method after all MobilizedBody topology has been processed. | |
virtual void | realizeModel (State &) const |
The Matter Subsystem's realizeModel() method will call this method after all MobilizedBody Model-stage processing has been done. | |
virtual void | realizeInstance (const State &) const |
The Matter Subsystem's realizeInstance() method will call this method after all MobilizedBody Instance-stage processing has been done. | |
virtual void | realizeTime (const State &) const |
The Matter Subsystem's realizeTime() method will call this method after any MobilizedBody Time-stage processing has been done. | |
virtual void | realizePosition (const State &) const |
The Matter Subsystem's realizePosition() method will call this method after any MobilizedBody Position-stage processing has been done. | |
virtual void | realizeVelocity (const State &) const |
The Matter Subsystem's realizeVelocity() method will call this method after any MobilizedBody Velocity-stage processing has been done. | |
virtual void | realizeDynamics (const State &) const |
The Matter Subsystem's realizeDynamics() method will call this method after any MobilizedBody Dynamics-stage processing has been done. | |
virtual void | realizeAcceleration (const State &) const |
The Matter Subsystem's realizeAcceleration() method will call this method after any MobilizedBody Acceleration-stage processing has been done. | |
virtual void | realizeReport (const State &) const |
The Matter Subsystem's realizeReport() method will call this method after any MobilizedBody Report-stage processing has been done. | |
Position (Holonomic) Constraint Virtuals | |
These must be defined if there are any position (holonomic) constraints defined.
Note that the number mp of expected position constraints is passed in by Simbody for redundancy; this should agree with what you are expecting and defines the number of Real values Simbody expects you to write on or view at the address it provides. | |
virtual void | realizePositionErrors (const State &, int mp, Real *perr) const |
During realizePosition(), calculate the mp position-constraint errors due to the position-level specification of a holonomic constraint and write them to perr . | |
virtual void | realizePositionDotErrors (const State &, int mp, Real *pverr) const |
During realizeVelocity(), calculate the mp errors arising from the first time derivative of the position-level specification of a holonomic constraint and write them to pverr . | |
virtual void | realizePositionDotDotErrors (const State &, int mp, Real *paerr) const |
During realizeAcceleration(), calculate the mp errors arising from the second time derivative of the position-level specification of a holonomic constraint and write them to paerr . | |
virtual void | applyPositionConstraintForces (const State &, int mp, const Real *multipliers, Vector_< SpatialVec > &bodyForces, Vector &mobilityForces) const |
From the mp supplied Lagrange multipliers provided in multipliers , calculate the forces produced by this Constraint on its ConstrainedBodies and ConstrainedMobilizers. | |
Velocity (Nonholonomic) Constraint Virtuals | |
These must be defined if there are any velocity (nonholonomic) constraints defined. | |
virtual void | realizeVelocityErrors (const State &, int mv, Real *verr) const |
During realizeVelocity(), calculate the mv errors arising from the initial velocity-level specification of a nonholonomic constraint and write them to verr . | |
virtual void | realizeVelocityDotErrors (const State &, int mv, Real *vaerr) const |
During realizeAcceleration(), calculate the mv errors arising from the first time derivative of the velocity-level specification of a nonholonomic constraint and write them to vaerr . | |
virtual void | applyVelocityConstraintForces (const State &, int mv, const Real *multipliers, Vector_< SpatialVec > &bodyForces, Vector &mobilityForces) const |
From the mv supplied Lagrange multipliers provided in multipliers , calculate the forces produced by this Constraint on its ConstrainedBodies and ConstrainedMobilizers due to its velocity-level (nonholonomic) constraints. | |
Acceleration-Only Constraint Virtuals | |
These must be defined if there are any acceleration-only constraints defined. | |
virtual void | realizeAccelerationErrors (const State &, int ma, Real *aerr) const |
During realizeAcceleration(), calculate the ma errors arising from the specification of an acceleration-only constraint and write them to aerr . | |
virtual void | applyAccelerationConstraintForces (const State &, int ma, const Real *multipliers, Vector_< SpatialVec > &bodyForces, Vector &mobilityForces) const |
From the ma supplied Lagrange multipliers provided in multipliers , calculate the forces produced by this Constraint on its ConstrainedBodies and ConstrainedMobilizers due to its acceleration-only constraints. | |
Friends | |
class | Constraint::CustomImpl |
virtual ~Implementation | ( | ) | [inline, virtual] |
Destructor is virtual so derived classes get a chance to clean up if necessary.
Implementation | ( | SimbodyMatterSubsystem & | , | |
int | mp, | |||
int | mv, | |||
int | ma | |||
) |
This Implementation base class constructor sets the topological defaults for the number of position level (holonomic), velocity level (nonholonomic), and acceleration-only constraint equations to be generated.
The default constructor for the Implementation base class sets the number of generated equations to zero for this constraint, meaning the Constraint won't do anything by default.
The actual number can be changed using setNumConstraintEquationsInUse() prior to realizeModel().
virtual Implementation* clone | ( | ) | const [pure virtual] |
This method should produce a deep copy identical to the concrete derived Implementation object underlying this Implementation base class object.
Note that the result is new heap space; the caller must be sure to take ownership of the returned pointer and call delete on it when done.
const SimbodyMatterSubsystem& getMatterSubsystem | ( | ) | const |
void invalidateTopologyCache | ( | ) | const |
Call this if you want to make sure that the next realizeTopology() call does something.
This is done automatically when you modify the constraint in ways understood by Simbody, such as adding a ConstrainedBody. But if you are just changing some of your own topology and want to make sure you get a chance to recompute something in realizeTopology(), make this call at the time of modification.
Implementation& setDefaultNumConstraintEquations | ( | int | mp, | |
int | mv, | |||
int | ma | |||
) |
This is an alternate way to set the default number of equations to be generated if you didn't specify them in the base class constructor.
A reference to this Implementation is returned so that this can be used in a sequence like an assignment operator.
Implementation& 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. A reference to this Implementation is returned so that this can be used in a sequence like an assignment operator.
ConstrainedBodyIndex addConstrainedBody | ( | const MobilizedBody & | ) |
Call this during construction phase to add a body to the topological structure of this Constraint.
This body's mobilizer's mobilities are *not* part of the constraint; mobilizers must be added separately. Numbering starts from 0 for each Constraint. The supplied MobilizedBody must be in the Matter Subsystem of which this Constraint is a part.
ConstrainedMobilizerIndex addConstrainedMobilizer | ( | const MobilizedBody & | ) |
Call this during construction phase to add a mobilizer to the topological structure of this Constraint.
All the coordinates q and mobilities u for this mobilizer are added also, but we don't know how many of those there will be until Stage::Model. Numbering starts from 0 for each Constraint. The supplied MobilizedBody must be in the Matter Subsystem of which this Constraint is a part.
MobilizedBodyIndex getMobilizedBodyIndexOfConstrainedBody | ( | ConstrainedBodyIndex | ) | const |
MobilizedBodyIndex getMobilizedBodyIndexOfConstrainedMobilizer | ( | ConstrainedMobilizerIndex | ) | const |
Real getOneQ | ( | const State & | , | |
ConstrainedMobilizerIndex | , | |||
MobilizerQIndex | ||||
) | const |
Real getOneU | ( | const State & | , | |
ConstrainedMobilizerIndex | , | |||
MobilizerUIndex | ||||
) | const |
Extract from the State the value of a single generalized speed (mobility) u from one of this Constraint's ConstrainedMobilizers.
The State needs to be realized only as high as Model stage, but don't use this value in a position-level method like realizePositionErrors() or in any off the applyConstraintForces methods! Those must be limited to dependencies on time and configuration only.
Real getOneQDot | ( | const State & | , | |
ConstrainedMobilizerIndex | , | |||
MobilizerQIndex | , | |||
bool | realizingVelocity = false | |||
) | const |
Extract from the State cache the value of a single generalized coordinate time derivative qdot.
State must already be realized to the Velocity stage, or if you are currently realizing that stage set realizingVelocity
true in which case the State need only have been realized to the previous (Position) stage.
Real getOneQDotDot | ( | const State & | , | |
ConstrainedMobilizerIndex | , | |||
MobilizerQIndex | , | |||
bool | realizingAcceleration = false | |||
) | const |
Extract from the State cache the value of a single generalized coordinate second time derivative qdotdot.
State must already be realized to the Acceleration stage, or if you are currently realizing that stage set realizingAcceleration
true in which case the State need only have been realized to the previous (Dynamics) stage.
Real getOneUDot | ( | const State & | , | |
ConstrainedMobilizerIndex | , | |||
MobilizerUIndex | , | |||
bool | realizingAcceleration = false | |||
) | const |
Extract from the State cache the value of a single generalized speed time derivative udot.
State must already be realized to the Acceleration stage, or if you are currently realizing that stage set realizingAcceleration
true in which case the State need only have been realized to the previous (Dynamics) stage.
void addInOneMobilityForce | ( | const State & | , | |
ConstrainedMobilizerIndex | , | |||
MobilizerUIndex | whichU, | |||
Real | force, | |||
Vector & | mobilityForces | |||
) | const |
Apply a scalar generalized (mobility) force force
to a particular mobility of one of this Constraint's Constrained Mobilizers, adding it in to the appropriate slot of the mobilityForces vector, which is of length getNumConstrainedU() for this Constraint.
State need only have been realized to Model stage, but this is intended for use in applyConstraintForce methods at Position stage.
const Transform& getBodyTransform | ( | const State & | s, | |
ConstrainedBodyIndex | B, | |||
bool | realizingPosition = false | |||
) | const |
Extract from the State cache the spatial transform X_AB giving the location and orientation of a Constrained Body B's body frame in this Constraint's Ancestor frame A.
The State must already be realized to the Position stage, or if you are currently realizing that stage set realizingPosition
true in which case State need only have been realized to the previous (Time) stage.
const SpatialVec& getBodyVelocity | ( | const State & | s, | |
ConstrainedBodyIndex | B, | |||
bool | realizingVelocity = false | |||
) | const |
Extract from the State cache the spatial velocity V_AB giving the linear and angular velocity of a Constrained Body B's body frame measured and expressed in this Constraint's Ancestor frame A.
The State must already be realized to the Velocity stage, or if you are currently realizing that stage set realizingVelocity
true in which case State need only have been realized to the previous (Position) stage.
const SpatialVec& getBodyAcceleration | ( | const State & | s, | |
ConstrainedBodyIndex | B, | |||
bool | realizingAcceleration = false | |||
) | const |
Extract from the State cache the spatial acceleration A_AB giving the linear and angular acceleration of a Constrained Body B's body frame measured and expressed in this Constraint's Ancestor frame A.
The State must already be realized to the Acceleration stage, or if you are currently realizing that stage set realizingAcceleration
true in which case State need only have been realized to the previous (Dynamics) stage.
const Rotation& getBodyRotation | ( | const State & | s, | |
ConstrainedBodyIndex | B, | |||
bool | realizingPosition = false | |||
) | const [inline] |
Extract from the State cache the rotation matrix R_AB giving the orientation of a Constrained Body B's body frame in this Constraint's Ancestor frame A.
The State must already be realized to the Position stage, or if you are currently realizing that stage set realizingPosition
true in which case State need only have been realized to the previous (Time) stage.
const Vec3& getBodyAngularVelocity | ( | const State & | s, | |
ConstrainedBodyIndex | B, | |||
bool | realizingVelocity = false | |||
) | const [inline] |
Extract from the State cache the angular velocity w_AB giving the angular velocity of a Constrained Body B's body frame measured and expressed in this Constraint's Ancestor frame A.
The State must already be realized to the Velocity stage, or if you are currently realizing that stage set realizingVelocity
true in which case State need only have been realized to the previous (Position) stage.
const Vec3& getBodyAngularAcceleration | ( | const State & | s, | |
ConstrainedBodyIndex | B, | |||
bool | realizingAcceleration = false | |||
) | const [inline] |
Extract from the State cache the angular acceleration b_AB giving the angular acceleration of a Constrained Body B's body frame measured and expressed in this Constraint's Ancestor frame A.
The State must already be realized to the Acceleration stage, or if you are currently realizing that stage set realizingAcceleration
true in which case State need only have been realized to the previous (Dynamics) stage.
const Vec3& getBodyOriginLocation | ( | const State & | s, | |
ConstrainedBodyIndex | B, | |||
bool | realizingPosition = false | |||
) | const [inline] |
Extract from the State cache the position vector p_AB (or more explicitly, p_OA_OB) giving the location of a Constrained Body B's body frame origin OB relative to this Constraint's Ancestor (A) frame origin OA.
The State must already be realized to the Position stage, or if you are currently realizing that stage set realizingPosition
true in which case State need only have been realized to the previous (Time) stage.
const Vec3& getBodyOriginVelocity | ( | const State & | s, | |
ConstrainedBodyIndex | B, | |||
bool | realizingVelocity = false | |||
) | const [inline] |
Extract from the State cache the linear velocity v_AB (or more explicitly, v_A_OB) giving the linear velocity of a Constrained Body B's body frame origin OB measured and expressed in this Constraint's Ancestor frame A.
The State must already be realized to the Velocity stage, or if you are currently realizing that stage set realizingVelocity
true in which case State need only have been realized to the previous (Position) stage.
const Vec3& getBodyOriginAcceleration | ( | const State & | s, | |
ConstrainedBodyIndex | B, | |||
bool | realizingAcceleration = false | |||
) | const [inline] |
Extract from the State cache the linear acceleration a_AB (or more explicitly, a_A_OB) giving the linear acceleration of a Constrained Body B's body frame origin OB, measured and expressed in this Constraint's Ancestor frame A.
The State must already be realized to the Acceleration stage, or if you are currently realizing that stage set realizingAcceleration
true in which case State need only have been realized to the previous (Dynamics) stage.
Vec3 findStationLocation | ( | const State & | s, | |
ConstrainedBodyIndex | B, | |||
const Vec3 & | p_BS, | |||
bool | realizingPosition = false | |||
) | const [inline] |
Calculate the location p_AS in the Ancestor frame of a station S of a Constrained Body B, specified with the position vector p_BS (or more explicitly, p_OB_S) from the B frame origin to the point S, expressed in the B frame.
The return value is a position vector from the Ancestor frame's origin OA to the location of the point S, expressed in the Ancestor frame. The State must already be realized to the Position stage, or if you are currently realizing that stage set realizingPosition
true in which case State need only have been realized to the previous (Time) stage.
Vec3 findStationVelocity | ( | const State & | s, | |
ConstrainedBodyIndex | B, | |||
const Vec3 & | p_BS, | |||
bool | realizingVelocity = false | |||
) | const [inline] |
Calculate the velocity v_AS in the Ancestor frame of a station S of a Constrained Body B, specified with the position vector p_BS (or more explicitly, p_OB_S) from the B frame origin to the point S, expressed in the B frame.
The return value is a vector expressed in the Ancestor frame. The State must already be realized to the Velocity stage, or if you are currently realizing that stage set realizingVelocity
true in which case State need only have been realized to the previous (Position) stage.
Vec3 findStationAcceleration | ( | const State & | s, | |
ConstrainedBodyIndex | B, | |||
const Vec3 & | p_BS, | |||
bool | realizingAcceleration = false | |||
) | const [inline] |
Calculate the acceleration a_AS in the Ancestor frame of a station S of a Constrained Body B, specified with the position vector p_BS (or more explicitly, p_OB_S) from the B frame origin to the point S, expressed in the B frame.
The return value is a vector expressed in the Ancestor frame. The State must already be realized to the Acceleration stage, or if you are currently realizing that stage set realizingAcceleration
true in which case State need only have been realized to the previous (Dynamics) stage.
void addInStationForce | ( | const State & | s, | |
ConstrainedBodyIndex | B, | |||
const Vec3 & | p_BS, | |||
const Vec3 & | forceInA, | |||
Vector_< SpatialVec > & | bodyForcesInA | |||
) | const |
Apply an Ancestor-frame force to a B-frame station S given by the position vector p_BS (or more explicitly, p_OB_S) from the B frame origin to the point S, expressed in the B frame, adding to the appropriate bodyForcesInA
entry for this ConstrainedBody B.
void addInBodyTorque | ( | const State & | s, | |
ConstrainedBodyIndex | B, | |||
const Vec3 & | torqueInA, | |||
Vector_< SpatialVec > & | bodyForcesInA | |||
) | const |
Apply an Ancestor-frame torque to body B, adding to the appropriate bodyForcesInA
entry for this ConstrainedBody B.
virtual void realizeTopology | ( | State & | ) | const [inline, protected, virtual] |
The Matter Subsystem's realizeTopology() method will call this method after all MobilizedBody topology has been processed.
This gives the Constraint a chance to
virtual void realizeModel | ( | State & | ) | const [inline, protected, virtual] |
The Matter Subsystem's realizeModel() method will call this method after all MobilizedBody Model-stage processing has been done.
This gives the Constraint a chance to
virtual void realizeInstance | ( | const State & | ) | const [inline, protected, virtual] |
The Matter Subsystem's realizeInstance() method will call this method after all MobilizedBody Instance-stage processing has been done.
This gives the Constraint a chance to
virtual void realizeTime | ( | const State & | ) | const [inline, protected, virtual] |
The Matter Subsystem's realizeTime() method will call this method after any MobilizedBody Time-stage processing has been done.
This gives the Constraint a chance to
virtual void realizePosition | ( | const State & | ) | const [inline, protected, virtual] |
The Matter Subsystem's realizePosition() method will call this method after any MobilizedBody Position-stage processing has been done.
This gives the Constraint a chance to
virtual void realizeVelocity | ( | const State & | ) | const [inline, protected, virtual] |
The Matter Subsystem's realizeVelocity() method will call this method after any MobilizedBody Velocity-stage processing has been done.
This gives the Constraint a chance to
virtual void realizeDynamics | ( | const State & | ) | const [inline, protected, virtual] |
The Matter Subsystem's realizeDynamics() method will call this method after any MobilizedBody Dynamics-stage processing has been done.
This gives the Constraint a chance to
virtual void realizeAcceleration | ( | const State & | ) | const [inline, protected, virtual] |
The Matter Subsystem's realizeAcceleration() method will call this method after any MobilizedBody Acceleration-stage processing has been done.
This gives the Constraint a chance to
virtual void realizeReport | ( | const State & | ) | const [inline, protected, virtual] |
The Matter Subsystem's realizeReport() method will call this method after any MobilizedBody Report-stage processing has been done.
This gives the Constraint a chance to
virtual void realizePositionErrors | ( | const State & | , | |
int | mp, | |||
Real * | perr | |||
) | const [protected, virtual] |
During realizePosition(), calculate the mp
position-constraint errors due to the position-level specification of a holonomic constraint and write them to perr
.
The State will have been realized to Stage::Time, and the part of the Stage::Position cache information relating to MobilizedBodies is available.
virtual void realizePositionDotErrors | ( | const State & | , | |
int | mp, | |||
Real * | pverr | |||
) | const [protected, virtual] |
During realizeVelocity(), calculate the mp
errors arising from the first time derivative of the position-level specification of a holonomic constraint and write them to pverr
.
The State will have been realized to Stage::Position, and the part of the Stage::Velocity cache information relating to MobilizedBodies is available.
virtual void realizePositionDotDotErrors | ( | const State & | , | |
int | mp, | |||
Real * | paerr | |||
) | const [protected, virtual] |
During realizeAcceleration(), calculate the mp
errors arising from the second time derivative of the position-level specification of a holonomic constraint and write them to paerr
.
The State will have been realized to Stage::Dynamics, and the part of the Stage::Acceleration cache information relating to MobilizedBodies is available.
virtual void applyPositionConstraintForces | ( | const State & | , | |
int | mp, | |||
const Real * | multipliers, | |||
Vector_< SpatialVec > & | bodyForces, | |||
Vector & | mobilityForces | |||
) | const [protected, virtual] |
From the mp
supplied Lagrange multipliers provided in multipliers
, calculate the forces produced by this Constraint on its ConstrainedBodies and ConstrainedMobilizers.
Body spatial forces are applied at the body origin and expressed in the Ancestor frame and written to an array bodyForces
of length getNumConstrainedBodies(). Mobility forces are written to an array mobilityForces
of length getNumConstrainedU(), that is, the number of constrained mobilities, not the number of constrained mobilizers. The State will have been realize to Stage::Position and all Position-stage cache information is available including any that may have been calculated during the prior call to this Constraint's realizePositionErrors() method and realizePosition() method. Simbody will already have ensured that the force-return arrays have been allocated to the right size and initialized to zero; you need only write the non-zero ones.
virtual void realizeVelocityErrors | ( | const State & | , | |
int | mv, | |||
Real * | verr | |||
) | const [protected, virtual] |
During realizeVelocity(), calculate the mv
errors arising from the initial velocity-level specification of a nonholonomic constraint and write them to verr
.
The State will have been realized to Stage::Position, and the part of the Stage::Velocity cache information relating to MobilizedBodies is available.
virtual void realizeVelocityDotErrors | ( | const State & | , | |
int | mv, | |||
Real * | vaerr | |||
) | const [protected, virtual] |
During realizeAcceleration(), calculate the mv
errors arising from the first time derivative of the velocity-level specification of a nonholonomic constraint and write them to vaerr
.
The State will have been realized to Stage::Dynamics, and the part of the Stage::Acceleration cache information relating to MobilizedBodies is available.
virtual void applyVelocityConstraintForces | ( | const State & | , | |
int | mv, | |||
const Real * | multipliers, | |||
Vector_< SpatialVec > & | bodyForces, | |||
Vector & | mobilityForces | |||
) | const [protected, virtual] |
From the mv
supplied Lagrange multipliers provided in multipliers
, calculate the forces produced by this Constraint on its ConstrainedBodies and ConstrainedMobilizers due to its velocity-level (nonholonomic) constraints.
Body spatial forces are applied at the body origin and expressed in the Ancestor frame and written to an array bodyForces
of length getNumConstrainedBodies(). Mobility forces are written to an array mobilityForces
of length getNumConstrainedU(), that is, the number of constrained mobilities, not the number of constrained mobilizers. The State will have been realize to Stage::Position and all Position-stage cache information is available including any that may have been calculated during the prior call to this Constraint's realizePosition() method. Simbody will already have ensured that the force-return arrays have been allocated to the right size and initialized to zero; you need only write the non-zero ones.
virtual void realizeAccelerationErrors | ( | const State & | , | |
int | ma, | |||
Real * | aerr | |||
) | const [protected, virtual] |
During realizeAcceleration(), calculate the ma
errors arising from the specification of an acceleration-only constraint and write them to aerr
.
The State will have been realized to Stage::Dynamics, and the part of the Stage::Acceleration cache information relating to MobilizedBodies is available.
virtual void applyAccelerationConstraintForces | ( | const State & | , | |
int | ma, | |||
const Real * | multipliers, | |||
Vector_< SpatialVec > & | bodyForces, | |||
Vector & | mobilityForces | |||
) | const [protected, virtual] |
From the ma
supplied Lagrange multipliers provided in multipliers
, calculate the forces produced by this Constraint on its ConstrainedBodies and ConstrainedMobilizers due to its acceleration-only constraints.
Body spatial forces are applied at the body origin and expressed in the Ancestor frame and written to an array bodyForces
of length getNumConstrainedBodies(). Mobility forces are written to an array mobilityForces
of length getNumConstrainedU(), that is, the number of constrained mobilities, not the number of constrained mobilizers. The State will have been realize to Stage::Position and all Position-stage cache information is available including any that may have been calculated during the prior call to this Constraint's realizePosition() method. Simbody will already have ensured that the force-return arrays have been allocated to the right size and initialized to zero; you need only write the non-zero ones.
virtual void calcDecorativeGeometryAndAppend | ( | const State & | s, | |
Stage | stage, | |||
std::vector< DecorativeGeometry > & | geom | |||
) | const [inline, protected, virtual] |
Implement this optional method if you would like your constraint to generate any suggestions for geometry that could be used as default visualization as an aid to understanding a system containing this constraint.
For example, if your constraint connects two points, you might want to draw a line between those points. You can also generate text labels, and you can provide methods for controlling the presence or appearance of your generated geometry. If you don't implement this routine no geometry will be generated.
friend class Constraint::CustomImpl [friend] |