Simbody
3.4 (development)
|
A constant generalized force f (a scalar) applied to a mobility. More...
#include <Force_MobilityConstantForce.h>
Public Member Functions | |
MobilityConstantForce (GeneralForceSubsystem &forces, const MobilizedBody &mobod, MobilizerUIndex whichU, Real defaultForce) | |
Add a MobilityConstantForce element to the indicated Subsystem. | |
MobilityConstantForce (GeneralForceSubsystem &forces, const MobilizedBody &mobod, Real defaultForce) | |
Alternate constructor signature for when the mobilizer has only a single generalized speed, in which case we'll use MobilizerUIndex(0). | |
MobilityConstantForce () | |
Default constructor creates an empty handle. | |
MobilityConstantForce & | setDefaultForce (Real defaultForce) |
Provide a new value for the default generalied force to be applied by this force element. | |
Real | getDefaultForce () const |
Return the default value for the generalized force. | |
void | setForce (State &state, Real force) const |
Change the value of the generalized force that is stored in the given state; this may differ from the default value supplied at construction. | |
Real | getForce (const State &state) const |
Return the value for the generalized force that is stored in the given state. | |
Deprecated | |
Methods here are for backwards compatibility but have been replaced with better ones that you should use. | |
MobilityConstantForce (GeneralForceSubsystem &forces, const MobilizedBody &mobod, int whichU, Real defaultForce) | |
Deprecated: Alternate signature for backwards compatibilty -- for safety you should prefer using the other constructor signature that takes a MobilizerUIndex rather than a plain int. |
A constant generalized force f (a scalar) applied to a mobility.
The mobility here selects a generalized speed (u), not a generalized coordinate (q), and the meaning depends on the definition of the generalized speed. If that speed is a translation then this is a force; if a rotation then this is a torque; if anything more general then this is in compatible force units. This force does not contribute to the potential energy, so adding it to a system will cause energy not to be conserved unless you account for the power injected or dissipated here.
SimTK::Force::MobilityConstantForce::MobilityConstantForce | ( | GeneralForceSubsystem & | forces, |
const MobilizedBody & | mobod, | ||
MobilizerUIndex | whichU, | ||
Real | defaultForce | ||
) |
Add a MobilityConstantForce element to the indicated Subsystem.
forces | Subsystem to which this force should be added. |
mobod | Mobilizer to which the force should be applied. |
whichU | Index within mobod of the generalized speed u to which this force should be applied (first is zero). |
defaultForce | Default value for the generalized force. |
SimTK::Force::MobilityConstantForce::MobilityConstantForce | ( | GeneralForceSubsystem & | forces, |
const MobilizedBody & | mobod, | ||
Real | defaultForce | ||
) | [inline] |
Alternate constructor signature for when the mobilizer has only a single generalized speed, in which case we'll use MobilizerUIndex(0).
See the other signature for documentation.
Default constructor creates an empty handle.
SimTK::Force::MobilityConstantForce::MobilityConstantForce | ( | GeneralForceSubsystem & | forces, |
const MobilizedBody & | mobod, | ||
int | whichU, | ||
Real | defaultForce | ||
) | [inline] |
Deprecated: Alternate signature for backwards compatibilty -- for safety you should prefer using the other constructor signature that takes a MobilizerUIndex rather than a plain int.
MobilityConstantForce& SimTK::Force::MobilityConstantForce::setDefaultForce | ( | Real | defaultForce | ) |
Provide a new value for the default generalied force to be applied by this force element.
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 setForce() to set the force in a State rather than in the System.
defaultForce | Default value for the generalized force. |
Real SimTK::Force::MobilityConstantForce::getDefaultForce | ( | ) | const |
Return the default value for the generalized force.
This is normally set at construction but may have been changed with setDefaultForce().
void SimTK::Force::MobilityConstantForce::setForce | ( | State & | state, |
Real | force | ||
) | const |
Change the value of the generalized force that is stored in the given state; this may differ from the default value supplied at construction.
state | The State in which the bounds are changed. |
force | The value of the generalized force to be applied when the state is subsequently used. |
Changing this force invalidates Stage::Dynamics and above in the state since it affects force generation.
Real SimTK::Force::MobilityConstantForce::getForce | ( | const State & | state | ) | const |
Return the value for the generalized force that is stored in the given state.
Note that this is not the same thing as the default force that was supplied on construction or with setDefaultForce().