This applies a force and/or torque to a body which is fully specified as a function of time. More...
#include <PrescribedForce.h>
Public Member Functions | |
PrescribedForce (const OpenSim::Body &body) | |
Construct a PrescribedForce. | |
PrescribedForce (const PrescribedForce &force) | |
Copy constructor. | |
~PrescribedForce () | |
Destructor. | |
virtual Object * | copy () const |
Copy this force and return a pointer to the copy. | |
void | setForceFunctions (Function *forceX, Function *forceY, Function *forceZ) |
Set the functions which specify the force to apply. | |
void | getForceFunctions (Function *forceX, Function *forceY, Function *forceZ) const |
void | setPointFunctions (Function *pointX, Function *pointY, Function *pointZ) |
Set the functions which specify the point at which to apply the force. | |
void | getPointFunctions (Function *&pointX, Function *&pointY, Function *&pointZ) const |
void | setTorqueFunctions (Function *torqueX, Function *torqueY, Function *torqueZ) |
Set the functions which specify the torque to apply. | |
void | getTorqueFunctions (Function *torqueX, Function *torqueY, Function *torqueZ) const |
void | setFunctionsFromFile (std::string anExternalLoadsFileName) |
Setup the functions from a specific type of storage file. | |
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 Body & | getBody () 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. | |
Protected Member Functions | |
virtual void | computeForce (const SimTK::State &state) const |
Compute the force. |
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:
PrescribedForce::PrescribedForce | ( | const OpenSim::Body & | body | ) |
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().
body | the body to apply the force to |
PrescribedForce::PrescribedForce | ( | const PrescribedForce & | force | ) |
Copy constructor.
PrescribedForce::~PrescribedForce | ( | ) |
Destructor.
void PrescribedForce::computeForce | ( | const SimTK::State & | state | ) | const [protected, virtual] |
Compute the force.
Implements OpenSim::CustomForce.
Object * PrescribedForce::copy | ( | ) | const [virtual] |
Copy this force and return a pointer to the copy.
The copy constructor for this class is used.
Reimplemented from OpenSim::Object.
const Body& OpenSim::PrescribedForce::getBody | ( | ) | const [inline] |
Get the body that the prescribed force is acting upon.
Vec3 PrescribedForce::getForceAtTime | ( | double | aTime | ) | const |
Conevenince methods to access prescribed force functions.
void PrescribedForce::getForceFunctions | ( | Function * | forceX, | |
Function * | forceY, | |||
Function * | forceZ | |||
) | const |
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 PrescribedForce::getPointFunctions | ( | Function *& | pointX, | |
Function *& | pointY, | |||
Function *& | pointZ | |||
) | const |
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 PrescribedForce::getTorqueFunctions | ( | Function * | torqueX, | |
Function * | torqueY, | |||
Function * | torqueZ | |||
) | const |
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.
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::setFunctionsFromFile | ( | std::string | anExternalLoadsFileName | ) |
Setup the functions from a specific type of storage file.
anExternalLoadsFileName | the name of a .mot or .sto file. The file must contain 10 data columns labeled time, torqueX, torqueY, torqueZ, forceX, forceY, forceZ, pointX, pointY, 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.
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::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.
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 |