Simbody
3.4 (development)
|
A linear spring that acts along or around a mobility coordinate to apply a generalized force there. More...
#include <Force_MobilityLinearSpring.h>
Public Member Functions | |
MobilityLinearSpring (GeneralForceSubsystem &forces, const MobilizedBody &mobod, MobilizerQIndex whichQ, Real defaultStiffness, Real defaultQZero) | |
Create a MobilityLinearSpring force element on a particular generalized coordinate. | |
MobilityLinearSpring () | |
Default constructor creates an empty handle that can be assigned to refer to any MobilityLinearSpring object. | |
MobilityLinearSpring & | setDefaultStiffness (Real defaultStiffness) |
Provide a new value for the default stiffness k of this spring. | |
MobilityLinearSpring & | setDefaultQZero (Real defaultQZero) |
Provide a new value for the zero position q0 of this spring, at which position the spring force will be zero. | |
Real | getDefaultStiffness () const |
Return the default value for the spring's stiffness k. | |
Real | getDefaultQZero () const |
Return the default value for the spring's zero position q0. | |
const MobilityLinearSpring & | setStiffness (State &state, Real stiffness) const |
Change the value of the spring stiffness in the given state; this may differ from the default value supplied at construction. | |
const MobilityLinearSpring & | setQZero (State &state, Real qZero) const |
Change the value of the spring zero length in the given state; this may differ from the default value supplied at construction. | |
Real | getStiffness (const State &state) const |
Return the value for the spring's stiffness k that is stored in the given state. | |
Real | getQZero (const State &state) const |
Return the value for the spring zero position q0 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. | |
MobilityLinearSpring (GeneralForceSubsystem &forces, const MobilizedBody &mobod, int whichQ, Real defaultStiffness, Real defaultQZero) | |
Deprecated: Alternate signature for backwards compatibilty -- for safety you should prefer using the other constructor signature that takes a MobilizerQIndex rather than a plain int. |
A linear spring that acts along or around a mobility coordinate to apply a generalized force there.
The stiffness k is provided, along with an arbitrary "zero" coordinate value q0 at which the spring generates no force. The generated force is k*(q-q0), and potential energy is pe = 1/2 k (q-q0)^2.
SimTK::Force::MobilityLinearSpring::MobilityLinearSpring | ( | GeneralForceSubsystem & | forces, |
const MobilizedBody & | mobod, | ||
MobilizerQIndex | whichQ, | ||
Real | defaultStiffness, | ||
Real | defaultQZero | ||
) |
Create a MobilityLinearSpring force element on a particular generalized coordinate.
[in,out] | forces | The subsystem to which this force should be added. |
[in] | mobod | Mobilizer to which the force should be applied. |
[in] | whichQ | To which of the mobilizer's generalized coordinates q should this force be applied (first is 0)? |
[in] | defaultStiffness | The default value for the spring constant k. |
[in] | defaultQZero | The default for the value of the coordinate q0 at which the force is 0. |
Default constructor creates an empty handle that can be assigned to refer to any MobilityLinearSpring object.
SimTK::Force::MobilityLinearSpring::MobilityLinearSpring | ( | GeneralForceSubsystem & | forces, |
const MobilizedBody & | mobod, | ||
int | whichQ, | ||
Real | defaultStiffness, | ||
Real | defaultQZero | ||
) | [inline] |
Deprecated: Alternate signature for backwards compatibilty -- for safety you should prefer using the other constructor signature that takes a MobilizerQIndex rather than a plain int.
MobilityLinearSpring& SimTK::Force::MobilityLinearSpring::setDefaultStiffness | ( | Real | defaultStiffness | ) |
Provide a new value for the default stiffness k of this spring.
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 setStiffness() to set the stiffness in a State rather than in the System.
[in] | defaultStiffness | The default value for the spring constant k. |
MobilityLinearSpring& SimTK::Force::MobilityLinearSpring::setDefaultQZero | ( | Real | defaultQZero | ) |
Provide a new value for the zero position q0 of this spring, at which position the spring force will be zero.
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 setQZero() to set the zero position in a State rather than in the System.
[in] | defaultQZero | The default for the value of the coordinate at which the force is 0. |
Real SimTK::Force::MobilityLinearSpring::getDefaultStiffness | ( | ) | const |
Return the default value for the spring's stiffness k.
This is normally set at construction but can be modified with setDefaultStiffness().
Real SimTK::Force::MobilityLinearSpring::getDefaultQZero | ( | ) | const |
Return the default value for the spring's zero position q0.
This is normally set at construction but can be modified with setDefaultQZero().
const MobilityLinearSpring& SimTK::Force::MobilityLinearSpring::setStiffness | ( | State & | state, |
Real | stiffness | ||
) | const |
Change the value of the spring stiffness in the given state; this may differ from the default value supplied at construction.
[in,out] | state | The State in which the stiffness is to be changed. |
[in] | stiffness | The new stiffness k (>= 0) that overrides the default. |
Changing the spring stiffness invalidates Stage::Dynamics and above in the state since it can affect force generation.
const MobilityLinearSpring& SimTK::Force::MobilityLinearSpring::setQZero | ( | State & | state, |
Real | qZero | ||
) | const |
Change the value of the spring zero length in the given state; this may differ from the default value supplied at construction.
[in,out] | state | The State in which the zero length is to be changed. |
[in] | qZero | The value of the controlled coordinate q at which the generated spring force should be zero. This overrides the default. |
Changing the spring stiffness invalidates Stage::Dynamics and above in the state since it can affect force generation.
Real SimTK::Force::MobilityLinearSpring::getStiffness | ( | const State & | state | ) | const |
Return the value for the spring'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 or in setDefaultStiffness().
Real SimTK::Force::MobilityLinearSpring::getQZero | ( | const State & | state | ) | const |
Return the value for the spring zero position q0 that is stored in the given state.
Note that this is not the same thing as the default q0 that was supplied on construction or in setDefaultQZero().