Simbody
3.3
|
Model a compliant stop element that acts to keep a mobilizer coordinate q within specified bounds. More...
#include <Force_MobilityLinearStop.h>
Public Member Functions | |
MobilityLinearStop (GeneralForceSubsystem &forces, const MobilizedBody &mobod, MobilizerQIndex whichQ, Real defaultStiffness, Real defaultDissipation, Real defaultQLow=-Infinity, Real defaultQHigh=Infinity) | |
Create a MobilityLinearStop force element on a particular generalized coordinate. More... | |
MobilityLinearStop () | |
Default constructor creates an empty handle that can be assigned to refer to any MobilityLinearStop object. More... | |
MobilityLinearStop & | setDefaultBounds (Real defaultQLow, Real defaultQHigh) |
Provide new values for the default lower and upper bounds of this stop. More... | |
MobilityLinearStop & | setDefaultMaterialProperties (Real defaultStiffness, Real defaultDissipation) |
Provide new values for the default material properties of this stop, which are assumed to be the same for the upper and lower stops. More... | |
Real | getDefaultLowerBound () const |
Return the default value for the stop's lower bound (a generalized coordinate value). More... | |
Real | getDefaultUpperBound () const |
Return the default value for the stop's upper bound (a generalized coordinate value). More... | |
Real | getDefaultStiffness () const |
Return the default value for the stop material's stiffness k. More... | |
Real | getDefaultDissipation () const |
Return the default value for the stop's material's dissipation coefficient d. More... | |
void | setBounds (State &state, Real qLow, Real qHigh) const |
Change the values of the lower and upper bounds in the given state; these may differ from the default values supplied at construction. More... | |
void | setMaterialProperties (State &state, Real stiffness, Real dissipation) const |
Change the values of this stop's material properties in the given state; these may differ from the default values supplied at construction. More... | |
Real | getLowerBound (const State &state) const |
Return the value for the lower bound that is stored in the given state. More... | |
Real | getUpperBound (const State &state) const |
Return the value for the upper bound that is stored in the given state. More... | |
Real | getStiffness (const State &state) const |
Return the value for the stop material's stiffness k that is stored in the given state. More... | |
Real | getDissipation (const State &state) const |
Return the value for the stop material's dissipation coefficient d that is stored in the given state. 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 non-virtual. More... | |
PIMPLHandle & | operator= (const PIMPLHandle &source) |
Copy assignment makes the current handle either a deep (value) or shallow (reference) copy of the supplied source PIMPL object, based on whether this is a "pointer sematics" (PTR=true) or "object (value) semantics" (PTR=false, default) class. More... | |
void | setImpl (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... | |
Model a compliant stop element that acts to keep a mobilizer coordinate q within specified bounds.
This force element generates no force when the coordinate is in bounds, but when either the lower or upper bound is exceeded it generates a generalized force opposing further violation of the bound. The generated force is composed of a stiffness force (or torque, or generalized force) that is linear in the violation of the bound, and dissipation that is linear in the rate qdot.
Given a mobilizer coordinate q and limits q_low and q_high, the generalized force generated here is:
{ 0, q_low <= q <= q_high f = { min(0, -k*x*(1+d*qdot)), q > q_high, x=q-q_high (x>0, f<=0) { max(0, -k*x*(1-d*qdot)), q < q_low, x=q-q_low (x<0, f>=0)
where k is a stiffness parameter, and d is a dissipation coefficient.
Note that dissipation occurs both during compression and expansion, but we will never generate a "sticking" force. This is a Hunt and Crossley-like dissipation model. It has the nice property that the damping force is zero when you first touch the stop.
SimTK::Force::MobilityLinearStop::MobilityLinearStop | ( | GeneralForceSubsystem & | forces, |
const MobilizedBody & | mobod, | ||
MobilizerQIndex | whichQ, | ||
Real | defaultStiffness, | ||
Real | defaultDissipation, | ||
Real | defaultQLow = -Infinity , |
||
Real | defaultQHigh = Infinity |
||
) |
Create a MobilityLinearStop force element on a particular generalized coordinate.
forces | subsystem to which this force element should be added |
mobod | mobilizer to which the force should be applied |
whichQ | to which of the mobilizer's generalized coordinates q should this force be applied (first is 0)? |
defaultStiffness | default stop stiffness (>= 0) |
defaultDissipation | default stop dissipation coefficient (>= 0) |
defaultQLow | default lower bound (-Infinity) |
defaultQHigh | default upper bound (+Infinity) |
Note that if you have an integer value for the generalized coordinate (q) index, you have to cast it to a MobilizerQIndex here. The generalized coordinates are numbered starting with 0 for each mobilizer. Here is an example:
Default constructor creates an empty handle that can be assigned to refer to any MobilityLinearStop object.
MobilityLinearStop& SimTK::Force::MobilityLinearStop::setDefaultBounds | ( | Real | defaultQLow, |
Real | defaultQHigh | ||
) |
Provide new values for the default lower and upper bounds of this stop.
This is a topological change because it affects the value that the containing System's default state will have when realizeTopology() is called. This is for use during construction, not for during a simulation where you should be using setBounds() to set the bounds in a State rather than in the System.
defaultQLow | Default lower bound (generalized coordinate value); <= defaultQHigh. Set to -Infinity to disable the lower bound by default. |
defaultQHigh | Default upper bound (generalized coordinate value); >= defaultQLow. Set to Infinity to disable the upper bound by default. |
MobilityLinearStop& SimTK::Force::MobilityLinearStop::setDefaultMaterialProperties | ( | Real | defaultStiffness, |
Real | defaultDissipation | ||
) |
Provide new values for the default material properties of this stop, which are assumed to be the same for the upper and lower stops.
This is a topological change because it affects the value that the containing System's default state will have when realizeTopology() is called. This is for use during construction, not for during a simulation where you should be using setMaterialProperties() to set the material properties in a State rather than in the System.
defaultStiffness | default stop stiffness (>= 0) |
defaultDissipation | default stop dissipation coefficient (>= 0) |
Real SimTK::Force::MobilityLinearStop::getDefaultLowerBound | ( | ) | const |
Return the default value for the stop's lower bound (a generalized coordinate value).
This is normally set at construction.
Real SimTK::Force::MobilityLinearStop::getDefaultUpperBound | ( | ) | const |
Return the default value for the stop's upper bound (a generalized coordinate value).
This is normally set at construction.
Real SimTK::Force::MobilityLinearStop::getDefaultStiffness | ( | ) | const |
Return the default value for the stop material's stiffness k.
This is normally set at construction.
Real SimTK::Force::MobilityLinearStop::getDefaultDissipation | ( | ) | const |
Return the default value for the stop's material's dissipation coefficient d.
This is normally set at construction.
void SimTK::Force::MobilityLinearStop::setBounds | ( | State & | state, |
Real | qLow, | ||
Real | qHigh | ||
) | const |
Change the values of the lower and upper bounds in the given state; these may differ from the default values supplied at construction.
state | The State in which the bounds are changed. |
qLow | Lower bound (generalized coordinate value); <= qHigh. Set to -Infinity to disable the lower bound. |
qHigh | Upper bound (generalized coordinate value); >= qLow. Set to Infinity to disable the upper bound. |
Changing these bounds invalidates Stage::Dynamics and above in the state since it can affect force generation.
void SimTK::Force::MobilityLinearStop::setMaterialProperties | ( | State & | state, |
Real | stiffness, | ||
Real | dissipation | ||
) | const |
Change the values of this stop's material properties in the given state; these may differ from the default values supplied at construction.
state | The State in which the material properties are changed. |
stiffness | The stop material stiffness k (>= 0). |
dissipation | The stop material dissipation coefficient d (>= 0). |
Changing these properties invalidates Stage::Dynamics and above in the state since it can affect force generation.
Real SimTK::Force::MobilityLinearStop::getLowerBound | ( | const State & | state | ) | const |
Return the value for the lower bound that is stored in the given state.
Note that this is not the same thing as the default lower bound that was supplied on construction.
Real SimTK::Force::MobilityLinearStop::getUpperBound | ( | const State & | state | ) | const |
Return the value for the upper bound that is stored in the given state.
Note that this is not the same thing as the default upper bound that was supplied on construction.
Real SimTK::Force::MobilityLinearStop::getStiffness | ( | const State & | state | ) | const |
Return the value for the stop material's stiffness k that is stored in the given state.
Note that this is not the same thing as the default stiffness that was supplied on construction.
Real SimTK::Force::MobilityLinearStop::getDissipation | ( | const State & | state | ) | const |
Return the value for the stop material's dissipation coefficient d that is stored in the given state.
Note that this is not the same thing as the default dissipation coefficient that was supplied on construction.