OpenSim::LinearSpring Class Reference

#include <LinearSpring.h>

Inheritance diagram for OpenSim::LinearSpring:
OpenSim::CustomForce OpenSim::Force OpenSim::ModelComponent OpenSim::Object

List of all members.

Public Member Functions

 LinearSpring (const Body &aBody, double start, double stop)
 Construct a Linear Spring.
virtual ~LinearSpring ()
 Destructor.
void setTargetPosition (VectorFunction *aTargetVelocity)
 Set the vector function containing the (t,x,y,z) of the position that the point should be corrected towards, expressed in the global ref frame.
VectorFunctiongetTargetPosition () const
 Get the vector function containing the (t,x,y,z) of the poisiton that the point should be corrected towards, expressed in the global ref frame.
void setPointFunction (VectorFunction *aPointFunction)
 Set the vector function containing the (t,x,y,z) of the point at which the force should be applied in the local coordinate frame.
void setTargetVelocity (VectorFunction *aTargetVelocity)
 Set the vector function containing the (t,x,y,z) of the velocity that the point should be corrected towards, expressed in the global ref frame.
VectorFunctiongetTargetVelocity () const
 Get the vector function containing the (t,x,y,z) of the velocity that the point should be corrected towards, expressed in the global ref frame.
void setScaleFunction (Function *_scaleFunction)
 Set the function containing the scale factor as a function of time.
FunctiongetScaleFunction () const
 Get the function containing the scale factor as a function of time.
void setScaleFactor (double aScaleFactor)
 Set the scale factor that pre-multiplies the applied torque.
double getScaleFactor ()
 Get the scale factor that pre-multiplies the applied torque.
void setKValue (const SimTK::Vec3 &aK)
 Set the spring constant, k.
void getKValue (SimTK::Vec3 &aK) const
 Get the spring constant, k.
void setBValue (const SimTK::Vec3 &aB)
 Set the damping constant, b.
void getBValue (SimTK::Vec3 &aB) const
 Get the damping constant, b.
void setThreshold (double aThreshold)
 Set the magnitude theshold below which no force is applied.
double getThreshold () const
 Get the magnitude theshold below which no force is applied.
void computePointAndTargetFunctions (SimTK::State &s, const Storage &aQStore, const Storage &aUStore, VectorFunction &aPGlobal)
 Compute the local point on a body and the point's target position and velocity in space that it should track.
void computePointFunction (SimTK::State &s, const Storage &aQStore, const Storage &aUStore, VectorFunction &aPGlobal)
 Compute the position and velocity functions that set the position and velocity of the point at which the linear spring applies its force.
void computeTargetFunctions (SimTK::State &s, const Storage &aQStoreForTarget, const Storage &aUStoreForTarget)
virtual void computeForce (const SimTK::State &s) const
 Callback called right after actuation has been applied by the model.

Protected Attributes

VectorFunction_pointFunction
 VectorFunction containing points of force application (t,x,y,z).
VectorFunction_forceFunction
 VectorFunction containing force to be applied (t,x,y,z).
VectorFunction_targetPosition
 Vector function containing the target position of the point expressed in the global reference frame.
VectorFunction_targetVelocity
 Vector function containing the target velocity of the point expressed in the global reference frame.
Function_scaleFunction
 Function containing values for the time-dependent scaling factor.
double _scaleFactor
 Scale factor that pre-multiplies the applied torque.
SimTK::Vec3 _k
 Stiffness.
SimTK::Vec3 _b
 Damping.
double _threshold
 If the magnitude of the spring force is below this threshold, no spring force is applied.
const Body_body
bool _on
 On, off flag.
double _startTime
 Start time for the force.
double _endTime
 End time for the force.

Constructor & Destructor Documentation

LinearSpring::LinearSpring ( const Body aBody,
double  startTime,
double  endTime 
)

Construct a Linear Spring.

Parameters:
aBody Body upon which spring forces are to be applied.
LinearSpring::~LinearSpring (  )  [virtual]

Destructor.


Member Function Documentation

void LinearSpring::computeForce ( const SimTK::State &  s  )  const [virtual]

Callback called right after actuation has been applied by the model.

*

Parameters:
aT Real time.
aX Controls.
aY States.

Implements OpenSim::CustomForce.

void LinearSpring::computePointAndTargetFunctions ( SimTK::State &  s,
const Storage aQStore,
const Storage aUStore,
VectorFunction aPGlobal 
)

Compute the local point on a body and the point's target position and velocity in space that it should track.

A spring force is applied based on the difference between the point's position and velocity and the target position and velocity. The point is specified in the local frame; the target position and velocity are specified in the global frame.

Parameters:
aQStore Storage containing the time history of generalized coordinates for the model. Note that all generalized coordinates must be specified and in radians and Euler parameters.
aUStore Stoarge containing the time history of generalized speeds for the model. Note that all generalized speeds must be specified and in radians.
aPStore Storage containing the time history of the position of the point in the global frame.
void LinearSpring::computePointFunction ( SimTK::State &  s,
const Storage aQStore,
const Storage aUStore,
VectorFunction aPGlobal 
)

Compute the position and velocity functions that set the position and velocity of the point at which the linear spring applies its force.

This method takes the time histories of a point's position and velocity in the inertial frame and converts them to the local (body) frame.

Parameters:
aQStore Storage containing the time history of generalized coordinates for the model. Note that all generalized coordinates must be specified and in radians and Euler parameters.
aUStore Storage containing the time history of generalized speeds for the model. Note that all generalized speeds must be specified and in radians.
aPStore Storage containing the time history of the position at which the force is to be applied in the global frame.
void LinearSpring::computeTargetFunctions ( SimTK::State &  s,
const Storage aQStoreForTarget,
const Storage aUStoreForTarget 
)
void LinearSpring::getBValue ( SimTK::Vec3 &  aB  )  const

Get the damping constant, b.

Returns:
aB.
void LinearSpring::getKValue ( SimTK::Vec3 &  aK  )  const

Get the spring constant, k.

Returns:
aK.
double LinearSpring::getScaleFactor (  ) 

Get the scale factor that pre-multiplies the applied torque.

Returns:
aScaleFactor.
Function * LinearSpring::getScaleFunction (  )  const

Get the function containing the scale factor as a function of time.

Returns:
aScaleFunction.
VectorFunction * LinearSpring::getTargetPosition (  )  const

Get the vector function containing the (t,x,y,z) of the poisiton that the point should be corrected towards, expressed in the global ref frame.

Returns:
Vector function containing the target position expressed in the global reference frame.
VectorFunction * LinearSpring::getTargetVelocity (  )  const

Get the vector function containing the (t,x,y,z) of the velocity that the point should be corrected towards, expressed in the global ref frame.

Returns:
Vector function containing the target velocity expressed in the global reference frame.
double LinearSpring::getThreshold (  )  const

Get the magnitude theshold below which no force is applied.

Parameters:
aThreshold Magnitude threshold. A negative value or 0 will result in the force always being applied.
void LinearSpring::setBValue ( const SimTK::Vec3 &  aB  ) 

Set the damping constant, b.

Parameters:
aK Vector of three values of b.
void LinearSpring::setKValue ( const SimTK::Vec3 &  aK  ) 

Set the spring constant, k.

Parameters:
aK Vector of three values of k.
void LinearSpring::setPointFunction ( VectorFunction aPointFunction  ) 

Set the vector function containing the (t,x,y,z) of the point at which the force should be applied in the local coordinate frame.

Parameters:
aPointFunction containing force application point function.
void LinearSpring::setScaleFactor ( double  aScaleFactor  ) 

Set the scale factor that pre-multiplies the applied torque.

Parameters:
aScaleFactor 
void LinearSpring::setScaleFunction ( Function aScaleFunction  ) 

Set the function containing the scale factor as a function of time.

Parameters:
aScaleFunction. 
void LinearSpring::setTargetPosition ( VectorFunction aTargetPosition  ) 

Set the vector function containing the (t,x,y,z) of the position that the point should be corrected towards, expressed in the global ref frame.

Parameters:
aTargetPosition Vector function containing the target position expressed in the global reference frame.
void LinearSpring::setTargetVelocity ( VectorFunction aTargetVelocity  ) 

Set the vector function containing the (t,x,y,z) of the velocity that the point should be corrected towards, expressed in the global ref frame.

Parameters:
aTargetVelocity Vector function containing the target velocity expressed in the global reference frame.
void LinearSpring::setThreshold ( double  aThreshold  ) 

Set the magnitude theshold below which no force is applied.

Parameters:
aThreshold Magnitude threshold. A negative value or 0 will result in the force always being applied.

Member Data Documentation

SimTK::Vec3 OpenSim::LinearSpring::_b [protected]

Damping.

const Body& OpenSim::LinearSpring::_body [protected]
double OpenSim::LinearSpring::_endTime [protected]

End time for the force.

VectorFunction containing force to be applied (t,x,y,z).

SimTK::Vec3 OpenSim::LinearSpring::_k [protected]

Stiffness.

bool OpenSim::LinearSpring::_on [protected]

On, off flag.

VectorFunction containing points of force application (t,x,y,z).

Scale factor that pre-multiplies the applied torque.

Function containing values for the time-dependent scaling factor.

Start time for the force.

Vector function containing the target position of the point expressed in the global reference frame.

Vector function containing the target velocity of the point expressed in the global reference frame.

If the magnitude of the spring force is below this threshold, no spring force is applied.


The documentation for this class was generated from the following files:

Generated on Wed Dec 16 15:03:46 2009 for OpenSim by  doxygen 1.6.1