OpenSim::SpringGeneralizedForce Class Reference

#include <SpringGeneralizedForce.h>

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

List of all members.

Public Member Functions

 SpringGeneralizedForce (std::string aCoordinateName="")
 SpringGeneralizedForce (const SpringGeneralizedForce &aForce)
 Copy constructor.
 ~SpringGeneralizedForce ()
 Destructor.
virtual Objectcopy () const
 Copy this force and return a pointer to the copy.
void createSystem (SimTK::MultibodySystem &system) const
 setup sets the actual Coordinate reference _coord
SpringGeneralizedForceoperator= (const SpringGeneralizedForce &aForce)
 Assignment operator.
void setCoordinate (Coordinate *aCoordinate)
CoordinategetCoordinate () const
void setStiffness (double aStiffness)
 Set the stiffness of the spring.
double getStiffness () const
 Get the stiffness of the force.
void setRestLength (double aRestLength)
 Set the rest length of the spring.
double getRestLength () const
 Get the rest length of the spring.
void setViscosity (double aViscosity)
 Set the viscosity of the spring.
double getViscosity () const
 Get the viscosity of the spring.
virtual OpenSim::Array
< std::string > 
getRecordLabels () const
 Methods to query a Force for the value actually applied during simulation The names of the quantities (column labels) is returned by this first function getRecordLabels().
virtual OpenSim::Array< double > getRecordValues (const SimTK::State &state) const
 Given SimTK::State object extract all the values necessary to report forces, application location frame, etc.

Protected Member Functions

virtual void computeForce (const SimTK::State &state, SimTK::Vector_< SimTK::SpatialVec > &bodyForces, SimTK::Vector &mobilityForces) const
 Compute all quantities necessary for applying the spring force to the model.
virtual void setup (Model &aModel)
 setup sets the _model pointer to proper value _coordinate is actually set inside _createSystem
 OPENSIM_DECLARE_DERIVED (SpringGeneralizedForce, Force)

Protected Attributes

PropertyStr _propCoordinateName
 Name of coordinate to which the spring gen force is applied.
PropertyDbl _propStiffness
 Stiffness.
PropertyDbl _propRestLength
 Rest length.
PropertyDbl _propViscosity
 Viscosity.
std::string & _coordName
double & _stiffness
double & _restLength
double & _viscosity
Coordinate_coord
 Corresponding generalized coordinate to which the coordinate actuator is applied.

Constructor & Destructor Documentation

OpenSim::SpringGeneralizedForce::SpringGeneralizedForce ( std::string  aCoordinateName = ""  ) 
SpringGeneralizedForce::SpringGeneralizedForce ( const SpringGeneralizedForce aForce  ) 

Copy constructor.

Parameters:
aforce force to be copied.
SpringGeneralizedForce::~SpringGeneralizedForce (  ) 

Destructor.


Member Function Documentation

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

Compute all quantities necessary for applying the spring force to the model.

Force applied = -stiffness * (_coordinateValue - restLength) - viscosity * _coordinateSpeed

Reimplemented from OpenSim::Force.

Object * SpringGeneralizedForce::copy (  )  const [virtual]

Copy this force and return a pointer to the copy.

The copy constructor for this class is used.

Returns:
Pointer to a copy of this force.

Implements OpenSim::Force.

void SpringGeneralizedForce::createSystem ( SimTK::MultibodySystem &  system  )  const [virtual]

setup sets the actual Coordinate reference _coord

Reimplemented from OpenSim::Force.

Coordinate* OpenSim::SpringGeneralizedForce::getCoordinate (  )  const
OpenSim::Array< std::string > SpringGeneralizedForce::getRecordLabels (  )  const [virtual]

Methods to query a Force for the value actually applied during simulation The names of the quantities (column labels) is returned by this first function getRecordLabels().

Reimplemented from OpenSim::Force.

OpenSim::Array< double > SpringGeneralizedForce::getRecordValues ( const SimTK::State &  state  )  const [virtual]

Given SimTK::State object extract all the values necessary to report forces, application location frame, etc.

used in conjunction with getRecordLabels and should return same size Array

Reimplemented from OpenSim::Force.

double SpringGeneralizedForce::getRestLength (  )  const

Get the rest length of the spring.

Returns:
Rest length of the spring.
double SpringGeneralizedForce::getStiffness (  )  const

Get the stiffness of the force.

Returns:
Stiffness of the force.
double SpringGeneralizedForce::getViscosity (  )  const

Get the viscosity of the spring.

Returns:
Stiffness of the spring.
OpenSim::SpringGeneralizedForce::OPENSIM_DECLARE_DERIVED ( SpringGeneralizedForce  ,
Force   
) [protected]
SpringGeneralizedForce & SpringGeneralizedForce::operator= ( const SpringGeneralizedForce aForce  ) 

Assignment operator.

Returns:
Reference to the altered object.

Reimplemented from OpenSim::Force.

void OpenSim::SpringGeneralizedForce::setCoordinate ( Coordinate aCoordinate  ) 
void SpringGeneralizedForce::setRestLength ( double  aRestLength  ) 

Set the rest length of the spring.

Parameters:
aRestLength Rest length of the spring.
void SpringGeneralizedForce::setStiffness ( double  aStiffness  ) 

Set the stiffness of the spring.

Normally the stiffness is a positive quantity. Negative stiffnessess will result in an unstable system- the force will push away from the rest length instead of pulling toward it.

Parameters:
aStiffness Stiffness of the spring force.
void SpringGeneralizedForce::setup ( Model aModel  )  [protected, virtual]

setup sets the _model pointer to proper value _coordinate is actually set inside _createSystem

Reimplemented from OpenSim::Force.

void SpringGeneralizedForce::setViscosity ( double  aViscosity  ) 

Set the viscosity of the spring.

Normally the viscosity should be a positive number. Negative viscosities will put energy into the system rather than apply a damping force.

Parameters:
aViscosity Viscosity of the spring.

Member Data Documentation

Corresponding generalized coordinate to which the coordinate actuator is applied.

Name of coordinate to which the spring gen force is applied.

Rest length.

Stiffness.

Viscosity.


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

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