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

A discrete mobility (generalized) force f applied to a particular mobility that is specified at construction. Useful for applying external forces or forces that are updated at discrete times due to the occurrence of events. More...

#include <Force_MobilityDiscreteForce.h>

+ Inheritance diagram for SimTK::Force::MobilityDiscreteForce:

List of all members.

Public Member Functions

 MobilityDiscreteForce (GeneralForceSubsystem &forces, const MobilizedBody &mobod, MobilizerUIndex whichU, Real defaultForce=0)
 Create a MobilityDiscreteForce.
 MobilityDiscreteForce (GeneralForceSubsystem &forces, const MobilizedBody &mobod, Real defaultForce=0)
 Alternate constructor signature for when the mobilizer has only a single generalized speed, in which case we'll use MobilizerUIndex(0).
 MobilityDiscreteForce ()
 Default constructor creates an empty handle.
MobilityDiscreteForcesetDefaultMobilityForce (Real defaultForce)
 Provide a new value for the defaultForce, overriding the one provided in the constructor.
Real getDefaultMobilityForce () const
 Return the value that this generalized force will have by default.
void setMobilityForce (State &state, Real f) const
 Change the value of the generalized force to be applied in the given state.
Real getMobilityForce (const State &state) const
 Return the value for this generalized force that is stored in the given state.

Detailed Description

A discrete mobility (generalized) force f applied to a particular mobility that is specified at construction. Useful for applying external forces or forces that are updated at discrete times due to the occurrence of events.

Note that a mobility is a generalized speed (u), not a generalized coordinate (q). The meaning of a generalized force 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 something else then f has a comparable definition (the defining condition is that f*u should always have physically meaningful units of power). This force does not contribute to the potential energy, so adding it to a system will cause potential+kinetic energy not to be conserved.

If you want to be able to apply discrete forces to any body or mobilizer specifying which one in advance, see Force::DiscreteForces.

See also:
Force::DiscreteForces

Constructor & Destructor Documentation

SimTK::Force::MobilityDiscreteForce::MobilityDiscreteForce ( GeneralForceSubsystem forces,
const MobilizedBody mobod,
MobilizerUIndex  whichU,
Real  defaultForce = 0 
)

Create a MobilityDiscreteForce.

Parameters:
forcessubsystem to which this force element should be added
mobodmobilizer to which the force should be applied
whichUto which of the mobilizer's mobilities (degrees of freedom) should this force be applied (first is 0)?
defaultForceinitial value for the generalized force to be applied (default 0)

Note that if you have an integer value for the generalized speed (u) index, you have to cast it to a MobilizerUIndex here. The generalized speeds are numbered starting with 0 for each mobilizer. Here is an example:

        GeneralForceSubsystem forces;
        MobilizedBody::Pin    pinJoint(...);
        MobilityDiscreteForce myForce(forces, pinJoint, MobilizerUIndex(0));
SimTK::Force::MobilityDiscreteForce::MobilityDiscreteForce ( GeneralForceSubsystem forces,
const MobilizedBody mobod,
Real  defaultForce = 0 
) [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.


Member Function Documentation

Provide a new value for the defaultForce, overriding the one provided in the constructor.

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

Parameters:
defaultForcethe value this generalized force should have by default
Returns:
a writable reference to this modified force element
See also:
setMobilityForce(), getDefaultMobilityForce()

Return the value that this generalized force will have by default.

This is normally set in the constructor, or left to its default value of 0. It can also be set in setDefaultMobilityForce(). Note that this is not the same as the value that may be set in any particular State.

See also:
getMobilityForce(), setDefaultMobilityForce()
void SimTK::Force::MobilityDiscreteForce::setMobilityForce ( State state,
Real  f 
) const

Change the value of the generalized force to be applied in the given state.

Set this to zero if you don't want it to do anything.

See also:
getMobilityForce()

Return the value for this generalized force that is stored in the given state.

If no calls to setMobilityForce() have been made on this state then it will have the defaultForce value that was supplied on construction or via setDefaultMobilityForce().

See also:
setMobilityForce()

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