OpenSim::TorsionalSpring Class Reference

#include <TorsionalSpring.h>

Inheritance diagram for OpenSim::TorsionalSpring:
OpenSim::Force OpenSim::ModelComponent OpenSim::Object

List of all members.

Public Member Functions

 TorsionalSpring (const Body &aBody, double startTime, double endTime)
 Construct a derivative callback instance for applying external torques during an integration.
virtual ~TorsionalSpring ()
 Destructor.
virtual Objectcopy () const
 Construct and return a copy of this object.
void setTargetPosition (VectorFunction *aPosFunction)
 Set the vetor function containing the nominal angular postion of the body.
VectorFunctiongetTargetPosition () const
 Get the vector function containing the nominal angular position of the body.
void setTargetVelocity (VectorFunction *aVelFunction)
 Set the vector function containing the nominal angular velocity of the body.
VectorFunctiongetTargetVelocity () const
 Get the vector function containing the nominal angular velocity of the body.
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)
 Get the spring constant, k.
void setBValue (const SimTK::Vec3 &aB)
 Set the damping constant, b.
void getBValue (SimTK::Vec3 &aB)
 Get the damping constant, b.
void setThreshold (double aThreshold)
 Set the magnitude theshold below which no torque is applied.
double getThreshold () const
 Get the magnitude theshold below which no torque is applied.
void computeTargetFunctions (SimTK::State &s, const Storage &aQStore, const Storage &aUStore)
 Compute the target orientation and angular velocity of the body.
virtual void computeForce (const SimTK::State &state, SimTK::Vector_< SimTK::SpatialVec > &bodyForces, SimTK::Vector &generalizedForces) const
 Implement the Force.

Protected Attributes

VectorFunction_targetPosition
 Vector function containing target orientation of the body.
VectorFunction_targetVelocity
 Vector function containing target angular velocity of the body.
Function_scaleFunction
 Function containing values for the time-dependent torque 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 torque is below this threshold, no torque is applied.
const Body_body
double _startTime
 Start time for the force.
double _endTime
 End time for the force.

Constructor & Destructor Documentation

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

Construct a derivative callback instance for applying external torques during an integration.

Parameters:
aModel Model for which external torques are to be applied.
aBody Body to which external torques are to be applied.
TorsionalSpring::~TorsionalSpring (  )  [virtual]

Destructor.


Member Function Documentation

void TorsionalSpring::computeForce ( const SimTK::State &  s,
SimTK::Vector_< SimTK::SpatialVec > &  bodyForces,
SimTK::Vector &  generalizedForces 
) const [virtual]

Implement the Force.

Parameters:
s States.

Reimplemented from OpenSim::Force.

void TorsionalSpring::computeTargetFunctions ( SimTK::State &  s,
const Storage aQStore,
const Storage aUStore 
)

Compute the target orientation and angular velocity of the body.

A spring force is applied based on the difference between the body's actual orientation and angular velocities and corresponding target values. The target orientation and angular velocity are computed with respect to 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.
virtual Object* OpenSim::TorsionalSpring::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 TorsionalSpring::getBValue ( SimTK::Vec3 &  aB  ) 

Get the damping constant, b.

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

Get the spring constant, k.

Returns:
aK.
double TorsionalSpring::getScaleFactor (  ) 

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

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

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

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

Get the vector function containing the nominal angular position of the body.

Returns:
aPosFunction.
VectorFunction * TorsionalSpring::getTargetVelocity (  )  const

Get the vector function containing the nominal angular velocity of the body.

Returns:
aVelFunction.
double TorsionalSpring::getThreshold (  )  const

Get the magnitude theshold below which no torque is applied.

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

Set the damping constant, b.

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

Set the spring constant, k.

Parameters:
aK Vector of three values of k.
void TorsionalSpring::setScaleFactor ( double  aScaleFactor  ) 

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

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

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

Parameters:
aScaleFunction. 
void TorsionalSpring::setTargetPosition ( VectorFunction aPosFunction  ) 

Set the vetor function containing the nominal angular postion of the body.

Parameters:
aPosFunction Vector function containing the nominal angular position of the body in the intertial reference frame.
void TorsionalSpring::setTargetVelocity ( VectorFunction aVelFunction  ) 

Set the vector function containing the nominal angular velocity of the body.

Parameters:
aPosFunction Vector function containing the nominal angular velocity of the body in the intertial reference frame.
void TorsionalSpring::setThreshold ( double  aThreshold  ) 

Set the magnitude theshold below which no torque is applied.

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

Member Data Documentation

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

Damping.

End time for the force.

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

Stiffness.

Scale factor that pre-multiplies the applied torque.

Function containing values for the time-dependent torque scaling factor.

Start time for the force.

Vector function containing target orientation of the body.

Vector function containing target angular velocity of the body.

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


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

Generated on Sun Sep 25 00:20:00 2011 for OpenSim by  doxygen 1.6.1