Simbody
3.6

Arbitrary discrete body forces and mobility (generalized) forces. Useful for applying external forces or forces that are updated at discrete times due to the occurrence of events. More...
Public Member Functions  
DiscreteForces (GeneralForceSubsystem &forces, const SimbodyMatterSubsystem &matter)  
Create a DiscreteForces force element. More...  
DiscreteForces ()  
Default constructor creates an empty handle. More...  
void  clearAllForces (State &state) const 
Set to zero all forces stored by this force element in the given state, including both generalized forces and body spatial forces. More...  
void  clearAllMobilityForces (State &state) const 
Set to zero all generalized forces stored by this force element in the given state. More...  
void  clearAllBodyForces (State &state) const 
Set to zero all body spatial forces (force and torques) stored by this force element in the given state. More...  
void  setOneMobilityForce (State &state, const MobilizedBody &mobod, MobilizerUIndex whichU, Real force) const 
Change the value of a generalized force to be applied in the given state. More...  
void  setOneBodyForce (State &state, const MobilizedBody &mobod, const SpatialVec &spatialForceInG) const 
Change the value of the discrete spatial force (force and torque) to be applied to a body in the given state. More...  
void  addForceToBodyPoint (State &state, const MobilizedBody &mobod, const Vec3 &pointInB, const Vec3 &forceInG) const 
Convenience method to add in a force applied at a point (station) on a particular body into the forces currently set to be applied to that body in this state. More...  
void  setAllMobilityForces (State &state, const Vector &f) const 
Set all the generalized forces at once. More...  
void  setAllBodyForces (State &state, const Vector_< SpatialVec > &bodyForcesInG) const 
Set all the body spatial forces at once. More...  
Real  getOneMobilityForce (const State &state, const MobilizedBody &mobod, MobilizerUIndex whichU) const 
Return the value for a generalized force that is stored in the given state. More...  
SpatialVec  getOneBodyForce (const State &state, const MobilizedBody &mobod) const 
Return the value for the discrete spatial force (force and torque) on a particular body that is stored in the given state. More...  
const Vector &  getAllMobilityForces (const State &state) const 
Get a reference to the internal Vector of all the generalized forces currently set to be applied by this force element. More...  
const Vector_< SpatialVec > &  getAllBodyForces (const State &state) const 
Get a reference to the internal Vector of all the body spatial forces currently set to be applied by this force element. More...  
Public Member Functions inherited from SimTK::Force  
void  disable (State &) const 
Disable this force element, effectively removing it from the System for computational purposes (it is still using its ForceIndex, however). More...  
void  enable (State &) const 
Enable this force element if it was previously disabled. More...  
bool  isDisabled (const State &) const 
Test whether this force element is currently disabled in the supplied State. More...  
void  setDisabledByDefault (bool shouldBeDisabled) 
Normally force elements are enabled when defined and can be disabled later. More...  
bool  isDisabledByDefault () const 
Test whether this force element is disabled by default in which case it must be explicitly enabled before it will take effect. More...  
void  calcForceContribution (const State &state, Vector_< SpatialVec > &bodyForces, Vector_< Vec3 > &particleForces, Vector &mobilityForces) const 
Calculate the force that would be applied by this force element if the given state were realized to Dynamics stage. More...  
Real  calcPotentialEnergyContribution (const State &state) const 
Calculate the potential energy contribution that is made by this force element at the given state. More...  
Force ()  
Default constructor for Force handle base class does nothing. More...  
operator ForceIndex () const  
Implicit conversion to ForceIndex when needed. More...  
const GeneralForceSubsystem &  getForceSubsystem () const 
Get the GeneralForceSubsystem of which this Force is an element. More...  
ForceIndex  getForceIndex () const 
Get the index of this force element within its parent force subsystem. More...  
Public Member Functions inherited from SimTK::PIMPLHandle< Force, ForceImpl, 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 Force &other) const 
Determine whether the supplied handle is the same object as "this" PIMPLHandle. More...  
void  disown (Force &newOwner) 
Give up ownership of the implementation to an empty handle. More...  
PIMPLHandle &  referenceAssign (const Force &source) 
"Copy" assignment but with shallow (pointer) semantics. More...  
PIMPLHandle &  copyAssign (const Force &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 ForceImpl &  getImpl () const 
Get a const reference to the implementation associated with this Handle. More...  
ForceImpl &  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::PIMPLHandle< Force, ForceImpl, true >  
typedef PIMPLHandle< Force, ForceImpl, PTR >  HandleBase 
typedef HandleBase  ParentHandle 
Protected Member Functions inherited from SimTK::Force  
Force (ForceImpl *r)  
Use this in a derived Force handle class constructor to supply the concrete implementation object to be stored in the handle base. More...  
Protected Member Functions inherited from SimTK::PIMPLHandle< Force, ForceImpl, true >  
PIMPLHandle ()  
The default constructor makes this an empty handle. More...  
PIMPLHandle (ForceImpl *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 nonvirtual. More...  
PIMPLHandle &  operator= (const PIMPLHandle &source) 
Copy assignment makes the current handle either a deep (value) or shallow (reference) copy of the supplied source PIMPL object, based on whether this is a "pointer sematics" (PTR=true) or "object (value) semantics" (PTR=false, default) class. More...  
void  setImpl (ForceImpl *p) 
Set the implementation for this empty handle. More...  
bool  hasSameImplementation (const Force &other) const 
Determine whether the supplied handle is a reference to the same implementation object as is referenced by "this" PIMPLHandle. More...  
Arbitrary discrete body forces and mobility (generalized) forces. Useful for applying external forces or forces that are updated at discrete times due to the occurrence of events.
SimTK::Force::DiscreteForces::DiscreteForces  (  GeneralForceSubsystem &  forces, 
const SimbodyMatterSubsystem &  matter  
) 

inline 
Default constructor creates an empty handle.

inline 
Set to zero all forces stored by this force element in the given state, including both generalized forces and body spatial forces.
void SimTK::Force::DiscreteForces::clearAllMobilityForces  (  State &  state  )  const 
Set to zero all generalized forces stored by this force element in the given state.
void SimTK::Force::DiscreteForces::clearAllBodyForces  (  State &  state  )  const 
Set to zero all body spatial forces (force and torques) stored by this force element in the given state.
void SimTK::Force::DiscreteForces::setOneMobilityForce  (  State &  state, 
const MobilizedBody &  mobod,  
MobilizerUIndex  whichU,  
Real  force  
)  const 
Change the value of a generalized force to be applied in the given state.
Set this to zero if you don't want it to do anything. You can call this method any time after realizeTopology() since the force just needs to be saved in the state.
state  The state in which the generalized force is to be saved. 
mobod  The mobilizer to which the force should be applied. 
whichU  To which of the mobilizer's mobilities (degrees of freedom) should this force be applied (first is 0)? 
force  The scalar value of the generalized force. 
void SimTK::Force::DiscreteForces::setOneBodyForce  (  State &  state, 
const MobilizedBody &  mobod,  
const SpatialVec &  spatialForceInG  
)  const 
Change the value of the discrete spatial force (force and torque) to be applied to a body in the given state.
Set this to zero if you don't want any force applied to the body. You can call this method any time after realizeTopology() since the force just needs to be saved in the state.
state  The state in which the force is to be saved. 
mobod  The mobilized body to which the force should be applied. 
spatialForceInG  The (torque,force) pair as a SpatialVec. These are expressed in the Ground frame and the force is applied to the body origin. 
void SimTK::Force::DiscreteForces::addForceToBodyPoint  (  State &  state, 
const MobilizedBody &  mobod,  
const Vec3 &  pointInB,  
const Vec3 &  forceInG  
)  const 
Convenience method to add in a force applied at a point (station) on a particular body into the forces currently set to be applied to that body in this state.
The station location is given in the body frame and the force is given in the Ground frame. Note that the state must have been realized to Stage::Position because we need to know the body orientation in order to shift the applied force to the body origin.
Be sure to call setOneBodyForce() to initialize this force to zero before you start accumulating point forces using this method.
state  The state in which the force is saved. Must already have been realized to at least Stage::Position. 
mobod  The mobilized body to which the force will be applied. 
pointInB  The body station at which the force will be applied, measured and expressed in the body frame. 
forceInG  The force vector to be applied, expressed in Ground. 
Set all the generalized forces at once.
These will be applied until they are changed.
state  The state in which the generalized forces are saved. 
f  The set of n generalized forces. This Vector must be either empty (in which case it is treated as though it were all zero) or the same length as the number of generalized speeds (state.getNU()). 
void SimTK::Force::DiscreteForces::setAllBodyForces  (  State &  state, 
const Vector_< SpatialVec > &  bodyForcesInG  
)  const 
Set all the body spatial forces at once.
These will be applied until they are changed.
state  The state in which the forces are saved. 
bodyForcesInG  The set of nb spatial forces (torque,force) pairs, expressed in the Ground frame, with the forces applied at each body frame origin. This Vector must be either empty (in which case it is treated as though it were all zero) or the same length as the number of mobilized bodies in the system (and don't forget that Ground is mobilized body 0). 
Real SimTK::Force::DiscreteForces::getOneMobilityForce  (  const State &  state, 
const MobilizedBody &  mobod,  
MobilizerUIndex  whichU  
)  const 
Return the value for a generalized force that is stored in the given state.
If no calls to setGeneralizedForce() have been made on this state then zero will be returned.
SpatialVec SimTK::Force::DiscreteForces::getOneBodyForce  (  const State &  state, 
const MobilizedBody &  mobod  
)  const 
Return the value for the discrete spatial force (force and torque) on a particular body that is stored in the given state.
The result is a force applied at the body origin and expressed in the Ground frame.
Get a reference to the internal Vector of all the generalized forces currently set to be applied by this force element.
This will be length zero if no forces are being applied; otherwise, its length will be the number of generalized speeds u in the given state. The returned reference is a reference into the given state object.
const Vector_<SpatialVec>& SimTK::Force::DiscreteForces::getAllBodyForces  (  const State &  state  )  const 
Get a reference to the internal Vector of all the body spatial forces currently set to be applied by this force element.
This will be length zero if no body forces are being applied; otherwise, its length will be the number of mobilized bodies in the containing MultibodySystem. The returned reference is a reference into the given state object.