OpenSim::ForwardTool Class Reference

A concrete tool for perfroming forward dynamics simulations. More...

#include <ForwardTool.h>

Inheritance diagram for OpenSim::ForwardTool:
OpenSim::AbstractTool OpenSim::Object OpenSim::PerturbationTool

List of all members.

Public Member Functions

virtual ~ForwardTool ()
 Destructor.
 ForwardTool ()
 Default constructor.
 ForwardTool (const std::string &aFileName, bool aUpdateFromXMLNode=true, bool aLoadModel=true) SWIG_DECLARE_EXCEPTION
 ForwardTool (const ForwardTool &aObject)
 Copy constructor.
virtual Objectcopy () const
 Virtual copy constructor.
ForwardTooloperator= (const ForwardTool &aForwardTool)
 Assignment operator.
virtual void updateFromXMLNode ()
 Override default implementation by object to intercept and fix the XML node underneath the tool to match current version.
void setManager (Manager &m)
 Set the current integration manager.
const ManagergetManager () const
 Get the current integration manager.
const std::string & getStatesFileName () const
void setStatesFileName (const std::string &aFileName)
bool getUseSpecifiedDt () const
void setUseSpecifiedDt (bool aUseSpecifiedDt)
const std::string & getExternalLoadsFileName () const
void setExternalLoadsFileName (const std::string &aFileName)
const std::string & getExternalLoadsModelKinematicsFileName () const
void setExternalLoadsModelKinematicsFileName (const std::string &aFileName)
const std::string & getExternalLoadsBody1 () const
void setExternalLoadsBody1 (const std::string &aName)
const std::string & getExternalLoadsBody2 () const
void setExternalLoadsBody2 (const std::string &aName)
double getLowpassCutoffFrequencyForLoadKinematics () const
void setLowpassCutoffFrequencyForLoadKinematics (double aLowpassCutoffFrequency)
void setPrintResultFiles (bool aToWrite)
virtual bool run () SWIG_DECLARE_EXCEPTION
 Run the investigation.
void printResults ()
void loadStatesStorage (std::string &statesFileName, Storage *&rYStore) const
const std::string & getParsingLog ()

Static Public Member Functions

static double Step (double t, double t0, double t1)
 A smooth step-down function using cubic polynomial.
static double SigmaUp (double tau, double to, double t)
 A smooth step-up function using exponentials.
static double SigmaDn (double tau, double to, double t)
 A smooth step-down function using exponentials.

Protected Member Functions

void setDesiredStatesForControllers (Storage &rYStore)
int determineInitialTimeFromStatesStorage (double &rTI)
 Determine initial time for a simulation and find the index into the states storage for that time.
void InitializeSpecifiedTimeStepping (Storage *aYStore, Manager &aManager)
 Setup time stepping so that the integrator follows a pre-specified series of time steps.
void addCorrectiveSprings (SimTK::State &s, const Storage *aYStore, const PrescribedForce *aBody1Force, const PrescribedForce *aBody2Force)
 Add corrective springs.
LinearSpringaddLinearCorrectiveSpring (SimTK::State &s, const Storage &aQStore, const Storage &aUStore, const PrescribedForce &aAppliedForce)
 Add a linear corrective spring.
TorsionalSpringaddTorsionalCorrectiveSpring (SimTK::State &s, const Storage &aQStore, const Storage &aUStore, Body *aBody, double aTauOn, double aTimeOn, double aTauOff, double aTimeOff)
 Add a torsional corrective spring.

Protected Attributes

PropertyStr _statesFileNameProp
 Name of the states file.
std::string & _statesFileName
OpenSim::PropertyBool _useSpecifiedDtProp
 If true, the time steps from the states file are used during current integration.
bool & _useSpecifiedDt
OpenSim::PropertyStr _externalLoadsFileNameProp
 Name of the file containing the external loads applied to the model.
std::string & _externalLoadsFileName
OpenSim::PropertyStr _externalLoadsModelKinematicsFileNameProp
 Name of the file containing the model kinematics corresponding to the external loads.
std::string & _externalLoadsModelKinematicsFileName
OpenSim::PropertyStr _externalLoadsBody1Prop
 Name of the body to which the first set of external loads should be applied (e.g., the body name for the right foot).
std::string & _externalLoadsBody1
OpenSim::PropertyStr _externalLoadsBody2Prop
 Name of the body to which the second set of external loads should be applied (e.g., the body name for the left foot).
std::string & _externalLoadsBody2
OpenSim::PropertyDbl _lowpassCutoffFrequencyForLoadKinematicsProp
 Low-pass cut-off frequency for filtering the model kinematics corresponding to the external loads.
double & _lowpassCutoffFrequencyForLoadKinematics
OpenSim::PropertyBool _outputDetailedResultsProp
 Flag indicating whether or not to output corrective spring loads and other quantities.
bool & _outputDetailedResults
OpenSim::PropertyBool _body1LinSpringActiveProp
 Flag indicating whether or not to turn on a linear corrective spring for the right foot.
bool & _body1LinSpringActive
OpenSim::PropertyBool _body1TorSpringActiveProp
 Flag indicating whether or not to turn on a torsional corrective spring for the right foot.
bool & _body1TorSpringActive
OpenSim::PropertyBool _body2LinSpringActiveProp
 Flag indicating whether or not to turn on a linear corrective spring for the left foot.
bool & _body2LinSpringActive
OpenSim::PropertyBool _body2TorSpringActiveProp
 Flag indicating whether or not to turn on a torsional corrective spring for the left foot.
bool & _body2TorSpringActive
PropertyDbl _body1TorSpringTimeOnProp
 Time at which the torsional spring comes on for body1 (if the spring is active).
double & _body1TorSpringTimeOn
PropertyDbl _body1TorSpringTimeOffProp
 Time at which the torsional spring turns off for body1 (if the spring is active).
double & _body1TorSpringTimeOff
PropertyDbl _body2TorSpringTimeOnProp
 Time at which the torsional spring turns on for body2 (if the spring is active).
double & _body2TorSpringTimeOn
PropertyDbl _body2TorSpringTimeOffProp
 Time at which the torsional spring turns off for body2 (if the spring is active).
double & _body2TorSpringTimeOff
PropertyDbl _tauProp
 Rise time for scaling functions for the torsional corrective springs.
double & _tau
PropertyDbl _tauBody1OnProp
 Scaling rise-time for the body1 torsional spring turning on.
double & _tauBody1On
PropertyDbl _tauBody1OffProp
 Scaling rise-time for the body1 torsional spring turning off.
double & _tauBody1Off
PropertyDbl _tauBody2OnProp
 Scaling rise-time for the body2 torsional spring turning on.
double & _tauBody2On
PropertyDbl _tauBody2OffProp
 Scaling rise-time for the body2 torsional spring turning off.
double & _tauBody2Off
PropertyDbl _springTransitionStartForceProp
 Force magnitude above which the linear springs start to scale in to effect.
double & _springTransitionStartForce
PropertyDbl _springTransitionEndForceProp
 Force magnitude below which the linear springs start to scale out of effect.
double & _springTransitionEndForce
PropertyDbl _forceThresholdProp
 Force magnitude below which no corrective linear spring forces are applied.
double & _forceThreshold
PropertyDbl _torqueThresholdProp
 Torque mangnitude below which no corrective torsional spring foreces are applied.
double & _torqueThreshold
PropertyDblVec3 _kLinProp
 Stiffness for linear corrective springs.
SimTK::Vec3 & _kLin
PropertyDblVec3 _bLinProp
 Damping for linear corrective springs.
SimTK::Vec3 & _bLin
PropertyDblVec3 _kTorProp
 Stiffness for torsional corrective springs.
SimTK::Vec3 & _kTor
PropertyDblVec3 _bTorProp
 Damping for torsional corrective springs.
SimTK::Vec3 & _bTor
LinearSpring_body1Lin
 Pointer to the linear and torsional corrective springs.
LinearSpring_body2Lin
TorsionalSpring_body1Tor
TorsionalSpring_body2Tor
Storage_yStore
 Storage for the input states.
bool _printResultFiles
 Flag indicating whether or not to write to the results (GUI will set this to false).
Manager_manager
 pointer to the simulation Manager
std::string _parsingLog

Detailed Description

A concrete tool for perfroming forward dynamics simulations.

Author:
Frank C. Anderson
Version:
1.0

Constructor & Destructor Documentation

ForwardTool::~ForwardTool (  )  [virtual]

Destructor.

ForwardTool::ForwardTool (  ) 

Default constructor.

OpenSim::ForwardTool::ForwardTool ( const std::string &  aFileName,
bool  aUpdateFromXMLNode = true,
bool  aLoadModel = true 
)
ForwardTool::ForwardTool ( const ForwardTool aTool  ) 

Copy constructor.

Copy constructors for all Tools only copy the non-XML variable members of the object; that is, the object's DOMnode and XMLDocument are not copied but set to NULL. The reason for this is that for the object and all its derived classes to establish the correct connection to the XML document nodes, the the object would need to reconstruct based on the XML document not the values of the object's member variables.

There are three proper ways to generate an XML document for an Tool:

1) Construction based on XML file (

See also:
Tool(const char *aFileName)). In this case, the XML document is created by parsing the XML file.

2) Construction by Tool(const XMLDocument *aDocument). This constructor explictly requests construction based on an XML document. In this way the proper connection between an object's node and the corresponding node within the XML document is established. This constructor is a copy constructor of sorts because all essential Tool member variables should be held within the XML document. The advantage of this style of construction is that nodes within the XML document, such as comments that may not have any associated Tool member variable, are preserved.

3) A call to generateXMLDocument(). This method generates an XML document for the Tool from scratch. Only the essential document nodes are created (that is, nodes that correspond directly to member variables.).

Parameters:
aTool Object to be copied.
See also:
Tool(const XMLDocument *aDocument)
Tool(const char *aFileName)
generateXMLDocument()

Member Function Documentation

void ForwardTool::addCorrectiveSprings ( SimTK::State &  s,
const Storage aYStore,
const PrescribedForce aBody1Force,
const PrescribedForce aBody2Force 
) [protected]

Add corrective springs.

LinearSpring * ForwardTool::addLinearCorrectiveSpring ( SimTK::State &  s,
const Storage aQStore,
const Storage aUStore,
const PrescribedForce aAppliedForce 
) [protected]

Add a linear corrective spring.

TorsionalSpring * ForwardTool::addTorsionalCorrectiveSpring ( SimTK::State &  s,
const Storage aQStore,
const Storage aUStore,
OpenSim::Body aBody,
double  aTauOn,
double  aTimeOn,
double  aTauOff,
double  aTimeOff 
) [protected]

Add a torsional corrective spring.

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

Virtual copy constructor.

Reimplemented from OpenSim::Object.

Reimplemented in OpenSim::PerturbationTool.

int ForwardTool::determineInitialTimeFromStatesStorage ( double &  rTI  )  [protected]

Determine initial time for a simulation and find the index into the states storage for that time.

Parameters:
rTI Requested initial time for the simulation. If the time does not match a time in the states storage exactly, the initial time is altered so that there is an exact match.
Returns:
Index into the states storage corresponding to the initial states for the simulation. A return of -1 indicates no valid states.
const std::string& OpenSim::ForwardTool::getExternalLoadsBody1 (  )  const [inline]
const std::string& OpenSim::ForwardTool::getExternalLoadsBody2 (  )  const [inline]
const std::string& OpenSim::ForwardTool::getExternalLoadsFileName (  )  const [inline]
const std::string& OpenSim::ForwardTool::getExternalLoadsModelKinematicsFileName (  )  const [inline]
double OpenSim::ForwardTool::getLowpassCutoffFrequencyForLoadKinematics (  )  const [inline]
const Manager & ForwardTool::getManager (  )  const

Get the current integration manager.

const std::string& OpenSim::ForwardTool::getParsingLog (  )  [inline]
const std::string& OpenSim::ForwardTool::getStatesFileName (  )  const [inline]
bool OpenSim::ForwardTool::getUseSpecifiedDt (  )  const [inline]
void ForwardTool::InitializeSpecifiedTimeStepping ( Storage aYStore,
Manager aManager 
) [protected]

Setup time stepping so that the integrator follows a pre-specified series of time steps.

void ForwardTool::loadStatesStorage ( std::string &  statesFileName,
Storage *&  rYStore 
) const
ForwardTool & ForwardTool::operator= ( const ForwardTool aTool  ) 

Assignment operator.

Returns:
Reference to this object.

Reimplemented from OpenSim::AbstractTool.

Reimplemented in OpenSim::PerturbationTool.

void ForwardTool::printResults (  ) 
bool ForwardTool::run (  )  [virtual]

Run the investigation.

Implements OpenSim::AbstractTool.

Reimplemented in OpenSim::PerturbationTool.

void OpenSim::ForwardTool::setDesiredStatesForControllers ( Storage rYStore  )  [protected]
void OpenSim::ForwardTool::setExternalLoadsBody1 ( const std::string &  aName  )  [inline]
void OpenSim::ForwardTool::setExternalLoadsBody2 ( const std::string &  aName  )  [inline]
void OpenSim::ForwardTool::setExternalLoadsFileName ( const std::string &  aFileName  )  [inline]
void OpenSim::ForwardTool::setExternalLoadsModelKinematicsFileName ( const std::string &  aFileName  )  [inline]
void OpenSim::ForwardTool::setLowpassCutoffFrequencyForLoadKinematics ( double  aLowpassCutoffFrequency  )  [inline]
void ForwardTool::setManager ( Manager m  ) 

Set the current integration manager.

Parameters:
m pointer to itegration manager
void OpenSim::ForwardTool::setPrintResultFiles ( bool  aToWrite  )  [inline]
void OpenSim::ForwardTool::setStatesFileName ( const std::string &  aFileName  )  [inline]
void OpenSim::ForwardTool::setUseSpecifiedDt ( bool  aUseSpecifiedDt  )  [inline]
double ForwardTool::SigmaDn ( double  tau,
double  to,
double  t 
) [static]

A smooth step-down function using exponentials.

Parameters:
tau Rise and fall time constant.
to Location of the midpoint of the step.
t Independent variable
double ForwardTool::SigmaUp ( double  tau,
double  to,
double  t 
) [static]

A smooth step-up function using exponentials.

Parameters:
tau Rise and fall time constant.
to Location of the midpoint of the step.
t Independent variable
double ForwardTool::Step ( double  t,
double  t0,
double  t1 
) [static]

A smooth step-down function using cubic polynomial.

x=0 for t<t0, x=1 for t>t1, and x=smooth step in between t0 and t1.

Parameters:
t Parameter at which to evaluate step function
t0 Parameter value at which step starts (result=0 to the left)
t1 Parameter value at which step ends (result=1 to the right)
void ForwardTool::updateFromXMLNode (  )  [virtual]

Override default implementation by object to intercept and fix the XML node underneath the tool to match current version.

Reimplemented from OpenSim::AbstractTool.

Reimplemented in OpenSim::PerturbationTool.


Member Data Documentation

SimTK::Vec3& OpenSim::ForwardTool::_bLin [protected]

Damping for linear corrective springs.

Pointer to the linear and torsional corrective springs.

Flag indicating whether or not to turn on a linear corrective spring for the right foot.

Flag indicating whether or not to turn on a torsional corrective spring for the right foot.

Time at which the torsional spring turns off for body1 (if the spring is active).

Time at which the torsional spring comes on for body1 (if the spring is active).

Flag indicating whether or not to turn on a linear corrective spring for the left foot.

Flag indicating whether or not to turn on a torsional corrective spring for the left foot.

Time at which the torsional spring turns off for body2 (if the spring is active).

Time at which the torsional spring turns on for body2 (if the spring is active).

SimTK::Vec3& OpenSim::ForwardTool::_bTor [protected]

Damping for torsional corrective springs.

Name of the body to which the first set of external loads should be applied (e.g., the body name for the right foot).

Name of the body to which the second set of external loads should be applied (e.g., the body name for the left foot).

Name of the file containing the external loads applied to the model.

Name of the file containing the model kinematics corresponding to the external loads.

Force magnitude below which no corrective linear spring forces are applied.

This allows an unperturbed forward integration to execute with minimal drift.

SimTK::Vec3& OpenSim::ForwardTool::_kLin [protected]

Stiffness for linear corrective springs.

SimTK::Vec3& OpenSim::ForwardTool::_kTor [protected]

Stiffness for torsional corrective springs.

Low-pass cut-off frequency for filtering the model kinematics corresponding to the external loads.

A negative value results in no filtering. The default value is -1.0, so no filtering.

pointer to the simulation Manager

Flag indicating whether or not to output corrective spring loads and other quantities.

std::string OpenSim::ForwardTool::_parsingLog [protected]

Flag indicating whether or not to write to the results (GUI will set this to false).

Force magnitude below which the linear springs start to scale out of effect.

Force magnitude above which the linear springs start to scale in to effect.

std::string& OpenSim::ForwardTool::_statesFileName [protected]

Name of the states file.

The states file must at a minimum contain the initial states for a simulation. If a complete set of states is available, the time stamps can be used to specify the integration steps and corrective springs, which allow perturbations, can be added to the simulation.

double& OpenSim::ForwardTool::_tau [protected]

Scaling rise-time for the body1 torsional spring turning off.

double& OpenSim::ForwardTool::_tauBody1On [protected]

Scaling rise-time for the body1 torsional spring turning on.

Scaling rise-time for the body2 torsional spring turning off.

double& OpenSim::ForwardTool::_tauBody2On [protected]

Scaling rise-time for the body2 torsional spring turning on.

Rise time for scaling functions for the torsional corrective springs.

Torque mangnitude below which no corrective torsional spring foreces are applied.

This allows an unperturbed forward integration to execute with minimal drift.

If true, the time steps from the states file are used during current integration.

Storage for the input states.


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

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