OpenSim::PrescribedForce Class Reference

This applies a force and/or torque to a body which is fully specified as a function of time. More...

#include <PrescribedForce.h>

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

List of all members.

Public Member Functions

 PrescribedForce (OpenSim::Body *body=0)
 Construct a PrescribedForce.
 PrescribedForce (const PrescribedForce &force)
 Copy constructor.
 PrescribedForce (DOMElement *aNode)
 Constructor from XML file.
 ~PrescribedForce ()
 Destructor.
virtual Objectcopy () const
 Copy this force and return a pointer to the copy.
virtual void updateFromXMLNode ()
 Update this object based on its XML node.
void setBodyName (const std::string &aBodyName)
const std::string & getBodyName () const
void setForceFunctions (Function *forceX, Function *forceY, Function *forceZ)
 Set the functions which specify the force to apply.
const FunctionSetgetForceFunctions () const
FunctionSetupdForceFunctions ()
void getForceFunctionNames (OpenSim::Array< std::string > &aFunctionNames)
void setForceFunctionNames (const OpenSim::Array< std::string > &aFunctionNames, const OpenSim::Storage &kineticsStore)
void clearForceFunctions ()
void setPointFunctions (Function *pointX, Function *pointY, Function *pointZ)
 Set the functions which specify the point at which to apply the force.
const FunctionSetgetPointFunctions () const
FunctionSetupdPointFunctions ()
void getPointFunctionNames (OpenSim::Array< std::string > &aFunctionNames)
void setPointFunctionNames (const OpenSim::Array< std::string > &aFunctionNames, const OpenSim::Storage &kineticsStore)
void clearPointFunctions ()
void setTorqueFunctions (Function *torqueX, Function *torqueY, Function *torqueZ)
 Set the functions which specify the torque to apply.
const FunctionSetgetTorqueFunctions () const
FunctionSetupdTorqueFunctions ()
void getTorqueFunctionNames (OpenSim::Array< std::string > &aFunctionNames)
void setTorqueFunctionNames (const OpenSim::Array< std::string > &aFunctionNames, const OpenSim::Storage &kineticsStore)
void clearTorqueFunctions ()
bool getForceIsInGlobalFrame () const
 Get whether the force and torque are specified in inertial coordinates or in the body's local coordinates.
void setForceIsInGlobalFrame (bool isGlobal)
 Set whether the force and torque are specified in inertial coordinates or in the body's local coordinates.
bool getPointIsInGlobalFrame () const
 Get whether the point is specified in inertial coordinates or in the body's local coordinates.
void setPointIsInGlobalFrame (bool isGlobal)
 Set whether the point is specified in inertial coordinates or in the body's local coordinates.
const OpenSim::BodygetBody () const
 Get the body that the prescribed force is acting upon.
SimTK::Vec3 getForceAtTime (double aTime) const
 Conevenince methods to access prescribed force functions.
SimTK::Vec3 getPointAtTime (double aTime) const
SimTK::Vec3 getTorqueAtTime (double aTime) const
virtual OpenSim::Array
< std::string > 
getRecordLabels () const
 Methods used for reporting.
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.
PrescribedForceoperator= (const PrescribedForce &aJoint)
 Assignment operator.
 OPENSIM_DECLARE_DERIVED (PrescribedForce, Force)

Protected Member Functions

virtual void setup (Model &model)
 ModelComponent interface.
virtual void computeForce (const SimTK::State &state, SimTK::Vector_< SimTK::SpatialVec > &bodyForces, SimTK::Vector &generalizedForces) const
 Compute the force.

Protected Attributes

PropertyStr _bodyNameProp
 The body that the Prescribed force is applied to.
std::string & _bodyName
PropertyBool _forceIsGlobalProp
bool & _forceIsGlobal
PropertyBool _pointIsGlobalProp
bool & _pointIsGlobal
PropertyObj _forceFunctionSetProp
FunctionSet_forceFunctionSet
PropertyObj _pointFunctionSetProp
FunctionSet_pointFunctionSet
PropertyObj _torqueFunctionSetProp
FunctionSet_torqueFunctionSet

Detailed Description

This applies a force and/or torque to a body which is fully specified as a function of time.

It is defined by three sets of functions, all of which are optional:

Author:
Peter Eastman, Matt DeMers

Constructor & Destructor Documentation

PrescribedForce::PrescribedForce ( OpenSim::Body body = 0  ) 

Construct a PrescribedForce.

Default constructor.

By default, the force, torque, and point functions are all unspecified, meaning that it applies no force or torque. To specify them, call setForceFunctions(), setTorqueFunctions(), and setPointFunctions().

Parameters:
body the body to apply the force to
PrescribedForce::PrescribedForce ( const PrescribedForce force  ) 

Copy constructor.

PrescribedForce::PrescribedForce ( DOMElement *  aNode  ) 

Constructor from XML file.

PrescribedForce::~PrescribedForce (  ) 

Destructor.


Member Function Documentation

void OpenSim::PrescribedForce::clearForceFunctions (  )  [inline]
void OpenSim::PrescribedForce::clearPointFunctions (  )  [inline]
void OpenSim::PrescribedForce::clearTorqueFunctions (  )  [inline]
void PrescribedForce::computeForce ( const SimTK::State &  state,
SimTK::Vector_< SimTK::SpatialVec > &  bodyForces,
SimTK::Vector &  generalizedForces 
) const [protected, virtual]

Compute the force.

Reimplemented from OpenSim::Force.

Object * PrescribedForce::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.

const OpenSim::Body& OpenSim::PrescribedForce::getBody (  )  const [inline]

Get the body that the prescribed force is acting upon.

const std::string& OpenSim::PrescribedForce::getBodyName (  )  const [inline]
Vec3 PrescribedForce::getForceAtTime ( double  aTime  )  const

Conevenince methods to access prescribed force functions.

void OpenSim::PrescribedForce::getForceFunctionNames ( OpenSim::Array< std::string > &  aFunctionNames  )  [inline]
const FunctionSet& OpenSim::PrescribedForce::getForceFunctions (  )  const [inline]
bool PrescribedForce::getForceIsInGlobalFrame (  )  const

Get whether the force and torque are specified in inertial coordinates or in the body's local coordinates.

Vec3 PrescribedForce::getPointAtTime ( double  aTime  )  const
void OpenSim::PrescribedForce::getPointFunctionNames ( OpenSim::Array< std::string > &  aFunctionNames  )  [inline]
const FunctionSet& OpenSim::PrescribedForce::getPointFunctions (  )  const [inline]
bool PrescribedForce::getPointIsInGlobalFrame (  )  const

Get whether the point is specified in inertial coordinates or in the body's local coordinates.

OpenSim::Array< std::string > PrescribedForce::getRecordLabels (  )  const [virtual]

Methods used for reporting.

Reimplemented from OpenSim::Force.

OpenSim::Array< double > PrescribedForce::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.

Vec3 PrescribedForce::getTorqueAtTime ( double  aTime  )  const
void OpenSim::PrescribedForce::getTorqueFunctionNames ( OpenSim::Array< std::string > &  aFunctionNames  )  [inline]
const FunctionSet& OpenSim::PrescribedForce::getTorqueFunctions (  )  const [inline]
OpenSim::PrescribedForce::OPENSIM_DECLARE_DERIVED ( PrescribedForce  ,
Force   
)
PrescribedForce & PrescribedForce::operator= ( const PrescribedForce aForce  ) 

Assignment operator.

Returns:
Reference to this object.

Reimplemented from OpenSim::Force.

void OpenSim::PrescribedForce::setBodyName ( const std::string &  aBodyName  )  [inline]
void PrescribedForce::setForceFunctionNames ( const OpenSim::Array< std::string > &  aFunctionNames,
const OpenSim::Storage kineticsStore 
)
void PrescribedForce::setForceFunctions ( Function forceX,
Function forceY,
Function forceZ 
)

Set the functions which specify the force to apply.

By default the force is specified in inertial coordinates. This can be changed by calling setForceIsInGlobalFrame().

All of the Function objects should have been allocated on the heap with the "new" operator. This object takes over ownership of them, and will delete them when it is deleted itself.

Parameters:
forceX a function of time which calculates the X component of the force to apply
forceY a function of time which calculates the Y component of the force to apply
forceZ a function of time which calculates the Z component of the force to apply
void PrescribedForce::setForceIsInGlobalFrame ( bool  isGlobal  ) 

Set whether the force and torque are specified in inertial coordinates or in the body's local coordinates.

void PrescribedForce::setPointFunctionNames ( const OpenSim::Array< std::string > &  aFunctionNames,
const OpenSim::Storage kineticsStore 
)
void PrescribedForce::setPointFunctions ( Function pointX,
Function pointY,
Function pointZ 
)

Set the functions which specify the point at which to apply the force.

By default the point is specified in the body's local coordinates. This can be changed by calling setPointIsInGlobalFrame().

All of the Function objects should have been allocated on the heap with the "new" operator. This object takes over ownership of them, and will delete them when it is deleted itself.

Parameters:
pointX a function of time which calculates the X coordinate of the point at which to apply the force
pointY a function of time which calculates the Y coordinate of the point at which to apply the force
pointZ a function of time which calculates the Z coordinate of the point at which to apply the force
void PrescribedForce::setPointIsInGlobalFrame ( bool  isGlobal  ) 

Set whether the point is specified in inertial coordinates or in the body's local coordinates.

void PrescribedForce::setTorqueFunctionNames ( const OpenSim::Array< std::string > &  aFunctionNames,
const OpenSim::Storage kineticsStore 
)
void PrescribedForce::setTorqueFunctions ( Function torqueX,
Function torqueY,
Function torqueZ 
)

Set the functions which specify the torque to apply.

By default the torque is specified in inertial coordinates. This can be changed by calling setForceIsInGlobalFrame().

All of the Function objects should have been allocated on the heap with the "new" operator. This object takes over ownership of them, and will delete them when it is deleted itself.

Parameters:
torqueX a function of time which calculates the X component of the torque to apply
torqueY a function of time which calculates the Y component of the torque to apply
torqueZ a function of time which calculates the Z component of the torque to apply
void PrescribedForce::setup ( Model model  )  [protected, virtual]

ModelComponent interface.

Reimplemented from OpenSim::Force.

void PrescribedForce::updateFromXMLNode (  )  [virtual]

Update this object based on its XML node.

Reimplemented from OpenSim::Object.

FunctionSet& OpenSim::PrescribedForce::updForceFunctions (  )  [inline]
FunctionSet& OpenSim::PrescribedForce::updPointFunctions (  )  [inline]
FunctionSet& OpenSim::PrescribedForce::updTorqueFunctions (  )  [inline]

Member Data Documentation

std::string& OpenSim::PrescribedForce::_bodyName [protected]

The body that the Prescribed force is applied to.


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