An analysis for reporting the joint reaction loads from a model. More...
#include <JointReaction.h>
Classes | |
struct | JointReactionKey |
Public Member Functions | |
virtual | ~JointReaction () |
Destructor. | |
JointReaction (Model *aModel=0) | |
Construct a JointReaction instance. | |
JointReaction (const std::string &aFileName) | |
Construct an object from file. | |
JointReaction (const JointReaction &aObject) | |
Copy constructor. | |
virtual Object * | copy () const |
Clone. | |
JointReaction & | operator= (const JointReaction &aJointReaction) |
Assign this object to the values of another. | |
virtual void | setModel (Model &aModel) |
Set the model for which this analysis is to be run. | |
virtual int | begin (const SimTK::State &s) |
This method is called at the beginning of an analysis so that any necessary initializations may be performed. | |
virtual int | step (const SimTK::State &s) |
This method is called to perform the analysis. | |
virtual int | end (const SimTK::State &s) |
This method is called at the end of an analysis so that any necessary finalizations may be performed. | |
virtual int | printResults (const std::string &aBaseName, const std::string &aDir="", double aDT=-1.0, const std::string &aExtension=".sto") |
Print the results of the analysis. | |
Protected Member Functions | |
int | record (const SimTK::State &s) |
Compute and record the results. | |
void | setupReactionList () |
Setup the ReactionList which controls the joints included in the analysis, the bodies the loads are applied to, and the frames the loads are expressed in. | |
void | constructDescription () |
Construct a description for the joint reaction loads files. | |
void | constructColumnLabels () |
Construct column labels for the output results. | |
void | setupStorage () |
Set up storage objects. | |
void | loadForcesFromFile () |
Load actuation storage from file. | |
Protected Attributes | |
PropertyStr | _forcesFileNameProp |
String containing the name of the optional forces storage file. | |
std::string & | _forcesFileName |
PropertyStrArray | _jointNamesProp |
String Array containting the names of the joints to be analysed. | |
Array< std::string > & | _jointNames |
PropertyStrArray | _onBodyProp |
String Array indicating which body of a joint (parent or child) the reaction load is applied to. | |
Array< std::string > & | _onBody |
PropertyStrArray | _inFrameProp |
String Array indicating which frame (ground, parent child) the reaction load is expressed in. | |
Array< std::string > & | _inFrame |
Storage * | _storeActuation |
Storage for holding actuator forces IF SPECIFIED by user. | |
Storage | _storeReactionLoads |
Storage for recording joint Reaction loads. | |
Array< double > | _dydt |
Internal work array for holding the computed accelerations. | |
Array< double > | _allLoads |
Internal work array for holding the computed joint loads for all joints in the model. | |
Array< double > | _Loads |
Internal work array for holding the computed joint loads of all joints specified in _jointNames. | |
Array< JointReactionKey > | _reactionList |
Internal work array for holding the JointReactionKeys to identify the desired joints, onBody, and inFrame to be output. | |
bool | _useForceStorage |
An analysis for reporting the joint reaction loads from a model.
For a given joint, the reaction load is calculated as the forces and moments required to constrain the body motions to satisfy the joint as if the joint did not exist. The reaction load acts at the joint center (mobilizer frame) of both the parent and child bodies and either force can be reported and expressed in the either the child, parent or ground frames. The default behavior is the the force on the child expressed in the ground frame.
JointReaction::~JointReaction | ( | ) | [virtual] |
Destructor.
Delete any variables allocated using the "new" operator. You will not necessarily have any of these.
JointReaction::JointReaction | ( | Model * | aModel = 0 |
) |
Construct a JointReaction instance.
aModel | Model for which the analysis is to be run. |
JointReaction::JointReaction | ( | const std::string & | aFileName | ) |
Construct an object from file.
The object is constructed from the root element of the XML document. The type of object is the tag name of the XML root element.
aFileName | File name of the document. |
JointReaction::JointReaction | ( | const JointReaction & | aObject | ) |
Copy constructor.
int JointReaction::begin | ( | const SimTK::State & | s | ) | [virtual] |
This method is called at the beginning of an analysis so that any necessary initializations may be performed.
This method is meant to be called at the begining of an integration
s | reference to the current state |
Reimplemented from OpenSim::Analysis.
void JointReaction::constructColumnLabels | ( | ) | [protected] |
Construct column labels for the output results.
For analyses that run during a simulation, the first column is almost always time. For the purpose of example, the code below adds labels appropriate for recording the translation and orientation of each body in the model.
This method needs to be called as necessary to update the column labels.
void JointReaction::constructDescription | ( | ) | [protected] |
Construct a description for the joint reaction loads files.
Object * JointReaction::copy | ( | ) | const [virtual] |
Clone.
Reimplemented from OpenSim::Analysis.
int JointReaction::end | ( | const SimTK::State & | s | ) | [virtual] |
This method is called at the end of an analysis so that any necessary finalizations may be performed.
s | reference to the current state |
Reimplemented from OpenSim::Analysis.
void JointReaction::loadForcesFromFile | ( | ) | [protected] |
Load actuation storage from file.
If called, this method sets _storeActuation to the forces data in _forcesFileName
JointReaction & JointReaction::operator= | ( | const JointReaction & | aJointReaction | ) |
Assign this object to the values of another.
Reimplemented from OpenSim::Analysis.
virtual int OpenSim::JointReaction::printResults | ( | const std::string & | aBaseName, | |
const std::string & | aDir = "" , |
|||
double | aDT = -1.0 , |
|||
const std::string & | aExtension = ".sto" | |||
) | [virtual] |
Print the results of the analysis.
aFileName | File to which to print the data. | |
aDT | Time interval between results (linear interpolation is used). If not included as an argument or negative, all time steps are printed without interpolation. |
Reimplemented from OpenSim::Analysis.
int JointReaction::record | ( | const SimTK::State & | s | ) | [protected] |
Compute and record the results.
This method computes the reaction loads at all joints in the model, then truncates the results to contain only the loads at the requested joints and finally, if necessary, modifies the loads to be acting on the specified body and expressed in the specified frame
aT | Current time in the simulation. | |
aX | Current values of the controls. | |
aY | Current values of the states. |
if a forces file is specified replace the computed actuation with the /** forces from storage.
define 2 variable length vectors of Vec3 vectors to contain calculated forces and moments for all the bodies in the model
void JointReaction::setModel | ( | Model & | aModel | ) | [virtual] |
Set the model for which this analysis is to be run.
Sometimes the model on which an analysis should be run is not available at the time an analysis is created. Or, you might want to change the model. This method is used to set the model on which the analysis is to be run.
aModel | Model pointer |
Reimplemented from OpenSim::Analysis.
void JointReaction::setupReactionList | ( | ) | [protected] |
Setup the ReactionList which controls the joints included in the analysis, the bodies the loads are applied to, and the frames the loads are expressed in.
void JointReaction::setupStorage | ( | ) | [protected] |
Set up storage objects.
The storage objects in the analysis are used to record the results of the analysis and write them to file.
int JointReaction::step | ( | const SimTK::State & | s | ) | [virtual] |
This method is called to perform the analysis.
It can be called during the execution of a forward integrations or after the integration by feeding it the necessary data.
s | reference to the current stateaClientData General use pointer for sending in client data. |
Reimplemented from OpenSim::Analysis.
Array<double> OpenSim::JointReaction::_allLoads [protected] |
Internal work array for holding the computed joint loads for all joints in the model.
Array<double> OpenSim::JointReaction::_dydt [protected] |
Internal work array for holding the computed accelerations.
std::string& OpenSim::JointReaction::_forcesFileName [protected] |
String containing the name of the optional forces storage file.
Array<std::string>& OpenSim::JointReaction::_inFrame [protected] |
PropertyStrArray OpenSim::JointReaction::_inFrameProp [protected] |
String Array indicating which frame (ground, parent child) the reaction load is expressed in.
Array<std::string>& OpenSim::JointReaction::_jointNames [protected] |
String Array containting the names of the joints to be analysed.
Array<double> OpenSim::JointReaction::_Loads [protected] |
Internal work array for holding the computed joint loads of all joints specified in _jointNames.
Array<std::string>& OpenSim::JointReaction::_onBody [protected] |
PropertyStrArray OpenSim::JointReaction::_onBodyProp [protected] |
String Array indicating which body of a joint (parent or child) the reaction load is applied to.
Array<JointReactionKey> OpenSim::JointReaction::_reactionList [protected] |
Internal work array for holding the JointReactionKeys to identify the desired joints, onBody, and inFrame to be output.
Storage* OpenSim::JointReaction::_storeActuation [protected] |
Storage for holding actuator forces IF SPECIFIED by user.
Storage OpenSim::JointReaction::_storeReactionLoads [protected] |
Storage for recording joint Reaction loads.
bool OpenSim::JointReaction::_useForceStorage [protected] |