Simbody  3.4 (development)
SimTK::Force::MobilityLinearSpring Class Reference

A linear spring that acts along or around a mobility coordinate to apply a generalized force there. More...

#include <Force_MobilityLinearSpring.h>

+ Inheritance diagram for SimTK::Force::MobilityLinearSpring:

List of all members.

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.
MobilityLinearSpringsetDefaultStiffness (Real defaultStiffness)
 Provide a new value for the default stiffness k of this spring.
MobilityLinearSpringsetDefaultQZero (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 MobilityLinearSpringsetStiffness (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 MobilityLinearSpringsetQZero (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.

Detailed Description

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.


Constructor & Destructor Documentation

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.

Parameters:
[in,out]forcesThe subsystem to which this force should be added.
[in]mobodMobilizer to which the force should be applied.
[in]whichQTo which of the mobilizer's generalized coordinates q should this force be applied (first is 0)?
[in]defaultStiffnessThe default value for the spring constant k.
[in]defaultQZeroThe 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.


Member Function Documentation

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.

Parameters:
[in]defaultStiffnessThe default value for the spring constant k.
Returns:
A writable reference to this modified force element for convenience in chaining set methods.
See also:
getDefaultStiffness(), setStiffness()

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.

Parameters:
[in]defaultQZeroThe default for the value of the coordinate at which the force is 0.
Returns:
A writable reference to this modified force element for convenience in chaining set methods.
See also:
getDefaultQZero(), setQZero()

Return the default value for the spring's stiffness k.

This is normally set at construction but can be modified with setDefaultStiffness().

See also:
setDefaultStiffness(), getStiffness()

Return the default value for the spring's zero position q0.

This is normally set at construction but can be modified with setDefaultQZero().

See also:
setDefaultQZero(), getQZero()
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.

Parameters:
[in,out]stateThe State in which the stiffness is to be changed.
[in]stiffnessThe new stiffness k (>= 0) that overrides the default.
Returns:
A const reference to this MobilityLinearSpring element for convenience in chaining set methods together.

Changing the spring stiffness invalidates Stage::Dynamics and above in the state since it can affect force generation.

See also:
setDefaultStiffness(), getStiffness()
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.

Parameters:
[in,out]stateThe State in which the zero length is to be changed.
[in]qZeroThe value of the controlled coordinate q at which the generated spring force should be zero. This overrides the default.
Returns:
A const reference to this MobilityLinearSpring element for convenience in chaining set methods together.

Changing the spring stiffness invalidates Stage::Dynamics and above in the state since it can affect force generation.

See also:
setDefaultStiffness(), getStiffness()

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().

See also:
setStiffness(), getDefaultStiffness()
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().

See also:
setQZero(), getDefaultQZero()

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines