OpenSim::LinearSpring Class Reference

#include <LinearSpring.h>

Inheritance diagram for OpenSim::LinearSpring:
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.
virtual Objectcopy () const
 Construct and return a copy of this object.
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 &state, SimTK::Vector_< SimTK::SpatialVec > &bodyForces, SimTK::Vector &generalizedForces) const
 Callback called right after actuation has been applied by the model.

Protected Member Functions

virtual void setup (Model &aModel)
 Subclasses should override these methods appropriately.
virtual void initState (SimTK::State &state) const
 This is called after a SimTK System and State have been created for 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
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,
SimTK::Vector_< SimTK::SpatialVec > &  bodyForces,
SimTK::Vector &  generalizedForces 
) const [virtual]

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

*

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

Reimplemented from OpenSim::Force.

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 
)
virtual Object* OpenSim::LinearSpring::copy (  )  const [inline, virtual]

Construct and return a copy of this object.

The object is allocated using the new operator, so the caller is responsible for deleting the returned object.

Returns:
Copy of this object.

Implements OpenSim::Force.

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.
virtual void OpenSim::LinearSpring::initState ( SimTK::State &  state  )  const [inline, protected, virtual]

This is called after a SimTK System and State have been created for the Model.

It must be implementd to set initial values of state variables.

Parameters:
state the State to initialize

Reimplemented from OpenSim::Force.

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.
virtual void OpenSim::LinearSpring::setup ( Model model  )  [inline, protected, virtual]

Subclasses should override these methods appropriately.

Reimplemented from OpenSim::Force.


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.

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 Sun Sep 25 00:19:58 2011 for OpenSim by  doxygen 1.6.1