This applies a force and/or torque to a body according describe by arrays contained in a Storage The source of the Storage may be experimental sensor recording or user generated data. More...
#include <ExternalForce.h>
Public Member Functions | |
ExternalForce () | |
Default Construct of an ExternalForce. | |
ExternalForce (const Storage &dataSource, std::string forceIdentifier="force", std::string PointIdentifier="point", std::string torqueIdentifier="torque", std::string appliedToBodyName="", std::string forceExpressedInBodyName="ground", std::string pointExpressedInBodyName="ground") | |
Convenience Constructor of an ExternalForce. | |
ExternalForce (const ExternalForce &force) | |
Copy constructor. | |
ExternalForce (DOMElement *aNode) | |
Constructor from XML file. | |
~ExternalForce () | |
Destructor. | |
virtual Object * | copy () const |
Copy this force and return a pointer to the copy. | |
virtual void | updateFromXMLNode () |
Update this object based on its XML node. | |
void | setDataSource (const Storage *dataSource) |
Associate the data source from which the force, point and/or torque data is to be extracted. | |
void | setAppliedToBodyName (const std::string &applyToName) const |
Specify or obtain the body to which the force will be applied. | |
const std::string & | getAppliedToBodyName () const |
void | setPointExpressedInBodyName (const std::string &pointInBodyName) const |
Specify or obtain the body in which the point of application is expressed. | |
const std::string & | getPointExpressedInBodyName () const |
void | setForceExpressedInBodyName (const std::string &forceInBodyName) const |
Specify or obtain the body in which the force is expressed. | |
const std::string & | getForceExpressedInBodyName () const |
void | setForceIdentifier (const std::string aForceIdentifier) |
Identifiers. | |
void | setPointIdentifier (const std::string aPointIdentifier) |
void | setTorqueIdentifier (const std::string aTorqueIdentifier) |
const std::string & | getForceIdentifier () const |
const std::string & | getPointIdentifier () const |
const std::string & | getTorqueIdentifier () const |
SimTK::Vec3 | getForceAtTime (double aTime) const |
Convenience methods to access external forces at a given time. | |
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. | |
bool | appliesForce () const |
Methods to query the force properties to find out if it's a body vs. | |
bool | specifiesPoint () const |
bool | appliesTorque () const |
ExternalForce & | operator= (const ExternalForce &aForce) |
Assignment operator. | |
OPENSIM_DECLARE_DERIVED (ExternalForce, 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 | _appliedToBodyNameProp |
The body that the external force(torque) is applied to. | |
std::string & | _appliedToBodyName |
PropertyStr | _forceExpressedInBodyNameProp |
The body (reference frame) that the external force(torque) is expressed in. | |
std::string & | _forceExpressedInBodyName |
PropertyStr | _pointExpressedInBodyNameProp |
The body (reference frame) that the point of force application is expressed. | |
std::string & | _pointExpressedInBodyName |
PropertyStr | _dataSourceNameProp |
The name of the data source (Storage) that contains the force as data points in time. | |
std::string & | _dataSourceName |
PropertyStr | _forceIdentifierProp |
The identifier (as part of its label) of the force data in the dataSource necessary to retrieve the force data from the dataSource. | |
std::string & | _forceIdentifier |
PropertyStr | _pointIdentifierProp |
The identifier of the point data in the dataSource necessary to retieve the point data from the dataSource. | |
std::string & | _pointIdentifier |
PropertyStr | _torqueIdentifierProp |
The identifier for the torque data in the dataSource necessary to retieve the torque data from the dataSource. | |
std::string & | _torqueIdentifier |
Friends | |
class | ExternalLoads |
This applies a force and/or torque to a body according describe by arrays contained in a Storage The source of the Storage may be experimental sensor recording or user generated data.
The Storage must be able to supply (1) array of time, (3) arrays for the x,y,z, components of force and/or torque in time. Optionaly (3) arrays for the point of force application in time. This Force must identify a force identifier (e.g. Force1.x Force1.y Force1.y) may be individual labels for force components but they are collectively identified (as "Force1"). Similarly, identifiers for torque and point are expected.
If an identifier is supplied and it cannot uniquely identify the quantity (force, torque, point) in the Storage an Excpetion is thrown.
An ExternalForce must apply either a force or a torque so both identifiers cannot be empty.
ExternalForce::ExternalForce | ( | ) |
Default Construct of an ExternalForce.
Default constructor.
By default ExternalForce has data source identified by name. By setup() time, Tool or modeler must setDataSource() on this Force for it to be able to apply any force. Otherwise, an exception is thrown.
OpenSim::ExternalForce::ExternalForce | ( | const Storage & | dataSource, | |
std::string | forceIdentifier = "force" , |
|||
std::string | PointIdentifier = "point" , |
|||
std::string | torqueIdentifier = "torque" , |
|||
std::string | appliedToBodyName = "" , |
|||
std::string | forceExpressedInBodyName = "ground" , |
|||
std::string | pointExpressedInBodyName = "ground" | |||
) |
Convenience Constructor of an ExternalForce.
dataSource | a storage containing the pertinent force data through time | |
forceIdentifier | string used to access the force data in the dataSource | |
pointIdentifier | string used to access the point of application of the force in dataSource | |
torqueIdentifier | string used to access the force data in the dataSource | |
appliedToBodyName | string used to specify the body to which the force is applied | |
forceExpressedInBodyName | string used to define in which body the force is expressed | |
pointExpressedInBodyName | string used to define the body in which the the point is expressed |
ExternalForce::ExternalForce | ( | const ExternalForce & | force | ) |
Copy constructor.
ExternalForce::ExternalForce | ( | DOMElement * | aNode | ) |
Constructor from XML file.
ExternalForce::~ExternalForce | ( | ) |
Destructor.
bool OpenSim::ExternalForce::appliesForce | ( | ) | const [inline] |
Methods to query the force properties to find out if it's a body vs.
point force and/or if it applies a torque
bool OpenSim::ExternalForce::appliesTorque | ( | ) | const [inline] |
void ExternalForce::computeForce | ( | const SimTK::State & | state, | |
SimTK::Vector_< SimTK::SpatialVec > & | bodyForces, | |||
SimTK::Vector & | generalizedForces | |||
) | const [protected, virtual] |
Compute the force.
Reimplemented from OpenSim::Force.
Object * ExternalForce::copy | ( | ) | const [virtual] |
Copy this force and return a pointer to the copy.
The copy constructor for this class is used.
Implements OpenSim::Force.
const std::string& OpenSim::ExternalForce::getAppliedToBodyName | ( | ) | const [inline] |
Vec3 ExternalForce::getForceAtTime | ( | double | aTime | ) | const |
Convenience methods to access external forces at a given time.
Conevenince methods to access prescribed force functions.
const std::string& OpenSim::ExternalForce::getForceExpressedInBodyName | ( | ) | const [inline] |
const std::string& OpenSim::ExternalForce::getForceIdentifier | ( | ) | const [inline] |
Vec3 ExternalForce::getPointAtTime | ( | double | aTime | ) | const |
const std::string& OpenSim::ExternalForce::getPointExpressedInBodyName | ( | ) | const [inline] |
const std::string& OpenSim::ExternalForce::getPointIdentifier | ( | ) | const [inline] |
OpenSim::Array< std::string > ExternalForce::getRecordLabels | ( | ) | const [virtual] |
Methods used for reporting.
First identify the labels for individual components
Reimplemented from OpenSim::Force.
OpenSim::Array< double > ExternalForce::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 ExternalForce::getTorqueAtTime | ( | double | aTime | ) | const |
const std::string& OpenSim::ExternalForce::getTorqueIdentifier | ( | ) | const [inline] |
OpenSim::ExternalForce::OPENSIM_DECLARE_DERIVED | ( | ExternalForce | , | |
Force | ||||
) |
ExternalForce & ExternalForce::operator= | ( | const ExternalForce & | aForce | ) |
void OpenSim::ExternalForce::setAppliedToBodyName | ( | const std::string & | applyToName | ) | const [inline] |
Specify or obtain the body to which the force will be applied.
void ExternalForce::setDataSource | ( | const Storage * | dataSource | ) |
Associate the data source from which the force, point and/or torque data is to be extracted.
void OpenSim::ExternalForce::setForceExpressedInBodyName | ( | const std::string & | forceInBodyName | ) | const [inline] |
Specify or obtain the body in which the force is expressed.
void OpenSim::ExternalForce::setForceIdentifier | ( | const std::string | aForceIdentifier | ) | [inline] |
Identifiers.
void OpenSim::ExternalForce::setPointExpressedInBodyName | ( | const std::string & | pointInBodyName | ) | const [inline] |
Specify or obtain the body in which the point of application is expressed.
void OpenSim::ExternalForce::setPointIdentifier | ( | const std::string | aPointIdentifier | ) | [inline] |
void OpenSim::ExternalForce::setTorqueIdentifier | ( | const std::string | aTorqueIdentifier | ) | [inline] |
void ExternalForce::setup | ( | Model & | model | ) | [protected, virtual] |
ModelComponent interface.
Reimplemented from OpenSim::Force.
bool OpenSim::ExternalForce::specifiesPoint | ( | ) | const [inline] |
void ExternalForce::updateFromXMLNode | ( | ) | [virtual] |
Update this object based on its XML node.
Reimplemented from OpenSim::Object.
friend class ExternalLoads [friend] |
std::string& OpenSim::ExternalForce::_appliedToBodyName [protected] |
The body that the external force(torque) is applied to.
std::string& OpenSim::ExternalForce::_dataSourceName [protected] |
The name of the data source (Storage) that contains the force as data points in time.
std::string& OpenSim::ExternalForce::_forceExpressedInBodyName [protected] |
The body (reference frame) that the external force(torque) is expressed in.
std::string& OpenSim::ExternalForce::_forceIdentifier [protected] |
The identifier (as part of its label) of the force data in the dataSource necessary to retrieve the force data from the dataSource.
std::string& OpenSim::ExternalForce::_pointExpressedInBodyName [protected] |
The body (reference frame) that the point of force application is expressed.
std::string& OpenSim::ExternalForce::_pointIdentifier [protected] |
The identifier of the point data in the dataSource necessary to retieve the point data from the dataSource.
std::string& OpenSim::ExternalForce::_torqueIdentifier [protected] |
The identifier for the torque data in the dataSource necessary to retieve the torque data from the dataSource.