#include <TorsionalSpring.h>
Public Member Functions | |
TorsionalSpring (const Body &aBody, double startTime, double endTime) | |
Construct a derivative callback instance for applying external torques during an integration. | |
virtual | ~TorsionalSpring () |
Destructor. | |
void | setTargetPosition (VectorFunction *aPosFunction) |
Set the vetor function containing the nominal angular postion of the body. | |
VectorFunction * | getTargetPosition () const |
Get the vector function containing the nominal angular position of the body. | |
void | setTargetVelocity (VectorFunction *aVelFunction) |
Set the vector function containing the nominal angular velocity of the body. | |
VectorFunction * | getTargetVelocity () const |
Get the vector function containing the nominal angular velocity of the body. | |
void | setScaleFunction (Function *_scaleFunction) |
Set the function containing the scale factor as a function of time. | |
Function * | getScaleFunction () const |
Get the function containing the scale factor as a function of time. | |
void | setScaleFactor (double aScaleFactor) |
Set the scale factor that pre-multiplies the applied torque. | |
double | getScaleFactor () |
Get the scale factor that pre-multiplies the applied torque. | |
void | setKValue (const SimTK::Vec3 &aK) |
Set the spring constant, k. | |
void | getKValue (SimTK::Vec3 &aK) |
Get the spring constant, k. | |
void | setBValue (const SimTK::Vec3 &aB) |
Set the damping constant, b. | |
void | getBValue (SimTK::Vec3 &aB) |
Get the damping constant, b. | |
void | setThreshold (double aThreshold) |
Set the magnitude theshold below which no torque is applied. | |
double | getThreshold () const |
Get the magnitude theshold below which no torque is applied. | |
void | computeTargetFunctions (SimTK::State &s, const Storage &aQStore, const Storage &aUStore) |
Compute the target orientation and angular velocity of the body. | |
virtual void | computeForce (const SimTK::State &s) const |
Implement the Force. | |
Protected Attributes | |
VectorFunction * | _targetPosition |
Vector function containing target orientation of the body. | |
VectorFunction * | _targetVelocity |
Vector function containing target angular velocity of the body. | |
Function * | _scaleFunction |
Function containing values for the time-dependent torque scaling factor. | |
double | _scaleFactor |
Scale factor that pre-multiplies the applied torque. | |
SimTK::Vec3 | _k |
Stiffness. | |
SimTK::Vec3 | _b |
Damping. | |
double | _threshold |
If the magnitude of the torque is below this threshold, no torque is applied. | |
const Body & | _body |
bool | _on |
On, off flag. | |
double | _startTime |
Start time for the force. | |
double | _endTime |
End time for the force. |
TorsionalSpring::TorsionalSpring | ( | const Body & | aBody, | |
double | startTime, | |||
double | endTime | |||
) |
TorsionalSpring::~TorsionalSpring | ( | ) | [virtual] |
Destructor.
void TorsionalSpring::computeForce | ( | const SimTK::State & | s | ) | const [virtual] |
void TorsionalSpring::computeTargetFunctions | ( | SimTK::State & | s, | |
const Storage & | aQStore, | |||
const Storage & | aUStore | |||
) |
Compute the target orientation and angular velocity of the body.
A spring force is applied based on the difference between the body's actual orientation and angular velocities and corresponding target values. The target orientation and angular velocity are computed with respect to the global frame.
aQStore | Storage containing the time history of generalized coordinates for the model. Note that all generalized coordinates must be specified and in radians and Euler parameters. | |
aUStore | Stoarge containing the time history of generalized speeds for the model. Note that all generalized speeds must be specified and in radians. |
void TorsionalSpring::getBValue | ( | SimTK::Vec3 & | aB | ) |
Get the damping constant, b.
void TorsionalSpring::getKValue | ( | SimTK::Vec3 & | aK | ) |
Get the spring constant, k.
double TorsionalSpring::getScaleFactor | ( | ) |
Get the scale factor that pre-multiplies the applied torque.
Function * TorsionalSpring::getScaleFunction | ( | ) | const |
Get the function containing the scale factor as a function of time.
VectorFunction * TorsionalSpring::getTargetPosition | ( | ) | const |
Get the vector function containing the nominal angular position of the body.
VectorFunction * TorsionalSpring::getTargetVelocity | ( | ) | const |
Get the vector function containing the nominal angular velocity of the body.
double TorsionalSpring::getThreshold | ( | ) | const |
Get the magnitude theshold below which no torque is applied.
aThreshold | Magnitude threshold. A negative value or 0 will result in the torque always being applied. |
void TorsionalSpring::setBValue | ( | const SimTK::Vec3 & | aB | ) |
Set the damping constant, b.
aK | Vector of three values of b. |
void TorsionalSpring::setKValue | ( | const SimTK::Vec3 & | aK | ) |
Set the spring constant, k.
aK | Vector of three values of k. |
void TorsionalSpring::setScaleFactor | ( | double | aScaleFactor | ) |
Set the scale factor that pre-multiplies the applied torque.
aScaleFactor |
void TorsionalSpring::setScaleFunction | ( | Function * | aScaleFunction | ) |
Set the function containing the scale factor as a function of time.
aScaleFunction. |
void TorsionalSpring::setTargetPosition | ( | VectorFunction * | aPosFunction | ) |
Set the vetor function containing the nominal angular postion of the body.
aPosFunction | Vector function containing the nominal angular position of the body in the intertial reference frame. |
void TorsionalSpring::setTargetVelocity | ( | VectorFunction * | aVelFunction | ) |
Set the vector function containing the nominal angular velocity of the body.
aPosFunction | Vector function containing the nominal angular velocity of the body in the intertial reference frame. |
void TorsionalSpring::setThreshold | ( | double | aThreshold | ) |
Set the magnitude theshold below which no torque is applied.
aThreshold | Magnitude threshold. A negative value or 0 will result in the torque always being applied. |
SimTK::Vec3 OpenSim::TorsionalSpring::_b [protected] |
Damping.
const Body& OpenSim::TorsionalSpring::_body [protected] |
double OpenSim::TorsionalSpring::_endTime [protected] |
End time for the force.
SimTK::Vec3 OpenSim::TorsionalSpring::_k [protected] |
Stiffness.
bool OpenSim::TorsionalSpring::_on [protected] |
On, off flag.
double OpenSim::TorsionalSpring::_scaleFactor [protected] |
Scale factor that pre-multiplies the applied torque.
Function* OpenSim::TorsionalSpring::_scaleFunction [protected] |
Function containing values for the time-dependent torque scaling factor.
double OpenSim::TorsionalSpring::_startTime [protected] |
Start time for the force.
VectorFunction* OpenSim::TorsionalSpring::_targetPosition [protected] |
Vector function containing target orientation of the body.
VectorFunction* OpenSim::TorsionalSpring::_targetVelocity [protected] |
Vector function containing target angular velocity of the body.
double OpenSim::TorsionalSpring::_threshold [protected] |
If the magnitude of the torque is below this threshold, no torque is applied.