#include <SpringGeneralizedForce.h>
Public Member Functions | |
SpringGeneralizedForce (std::string aCoordinateName="") | |
SpringGeneralizedForce (const SpringGeneralizedForce &aForce) | |
Copy constructor. | |
~SpringGeneralizedForce () | |
Destructor. | |
virtual Object * | copy () const |
Copy this force and return a pointer to the copy. | |
void | createSystem (SimTK::MultibodySystem &system) const |
setup sets the actual Coordinate reference _coord | |
SpringGeneralizedForce & | operator= (const SpringGeneralizedForce &aForce) |
Assignment operator. | |
void | setCoordinate (Coordinate *aCoordinate) |
Coordinate * | getCoordinate () const |
void | setStiffness (double aStiffness) |
Set the stiffness of the spring. | |
double | getStiffness () const |
Get the stiffness of the force. | |
void | setRestLength (double aRestLength) |
Set the rest length of the spring. | |
double | getRestLength () const |
Get the rest length of the spring. | |
void | setViscosity (double aViscosity) |
Set the viscosity of the spring. | |
double | getViscosity () const |
Get the viscosity of the spring. | |
virtual OpenSim::Array < std::string > | getRecordLabels () const |
Methods to query a Force for the value actually applied during simulation The names of the quantities (column labels) is returned by this first function getRecordLabels(). | |
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, SimTK::Vector_< SimTK::SpatialVec > &bodyForces, SimTK::Vector &mobilityForces) const |
Compute all quantities necessary for applying the spring force to the model. | |
virtual void | setup (Model &aModel) |
setup sets the _model pointer to proper value _coordinate is actually set inside _createSystem | |
OPENSIM_DECLARE_DERIVED (SpringGeneralizedForce, Force) | |
Protected Attributes | |
PropertyStr | _propCoordinateName |
Name of coordinate to which the spring gen force is applied. | |
PropertyDbl | _propStiffness |
Stiffness. | |
PropertyDbl | _propRestLength |
Rest length. | |
PropertyDbl | _propViscosity |
Viscosity. | |
std::string & | _coordName |
double & | _stiffness |
double & | _restLength |
double & | _viscosity |
Coordinate * | _coord |
Corresponding generalized coordinate to which the coordinate actuator is applied. |
OpenSim::SpringGeneralizedForce::SpringGeneralizedForce | ( | std::string | aCoordinateName = "" |
) |
SpringGeneralizedForce::SpringGeneralizedForce | ( | const SpringGeneralizedForce & | aForce | ) |
Copy constructor.
aforce | force to be copied. |
SpringGeneralizedForce::~SpringGeneralizedForce | ( | ) |
Destructor.
void SpringGeneralizedForce::computeForce | ( | const SimTK::State & | s, | |
SimTK::Vector_< SimTK::SpatialVec > & | bodyForces, | |||
SimTK::Vector & | generalizedForces | |||
) | const [protected, virtual] |
Compute all quantities necessary for applying the spring force to the model.
Force applied = -stiffness * (_coordinateValue - restLength) - viscosity * _coordinateSpeed
Reimplemented from OpenSim::Force.
Object * SpringGeneralizedForce::copy | ( | ) | const [virtual] |
Copy this force and return a pointer to the copy.
The copy constructor for this class is used.
Implements OpenSim::Force.
void SpringGeneralizedForce::createSystem | ( | SimTK::MultibodySystem & | system | ) | const [virtual] |
setup sets the actual Coordinate reference _coord
Reimplemented from OpenSim::Force.
Coordinate* OpenSim::SpringGeneralizedForce::getCoordinate | ( | ) | const |
OpenSim::Array< std::string > SpringGeneralizedForce::getRecordLabels | ( | ) | const [virtual] |
Methods to query a Force for the value actually applied during simulation The names of the quantities (column labels) is returned by this first function getRecordLabels().
Reimplemented from OpenSim::Force.
OpenSim::Array< double > SpringGeneralizedForce::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.
double SpringGeneralizedForce::getRestLength | ( | ) | const |
Get the rest length of the spring.
double SpringGeneralizedForce::getStiffness | ( | ) | const |
Get the stiffness of the force.
double SpringGeneralizedForce::getViscosity | ( | ) | const |
Get the viscosity of the spring.
OpenSim::SpringGeneralizedForce::OPENSIM_DECLARE_DERIVED | ( | SpringGeneralizedForce | , | |
Force | ||||
) | [protected] |
SpringGeneralizedForce & SpringGeneralizedForce::operator= | ( | const SpringGeneralizedForce & | aForce | ) |
void OpenSim::SpringGeneralizedForce::setCoordinate | ( | Coordinate * | aCoordinate | ) |
void SpringGeneralizedForce::setRestLength | ( | double | aRestLength | ) |
Set the rest length of the spring.
aRestLength | Rest length of the spring. |
void SpringGeneralizedForce::setStiffness | ( | double | aStiffness | ) |
Set the stiffness of the spring.
Normally the stiffness is a positive quantity. Negative stiffnessess will result in an unstable system- the force will push away from the rest length instead of pulling toward it.
aStiffness | Stiffness of the spring force. |
void SpringGeneralizedForce::setup | ( | Model & | aModel | ) | [protected, virtual] |
setup sets the _model pointer to proper value _coordinate is actually set inside _createSystem
Reimplemented from OpenSim::Force.
void SpringGeneralizedForce::setViscosity | ( | double | aViscosity | ) |
Set the viscosity of the spring.
Normally the viscosity should be a positive number. Negative viscosities will put energy into the system rather than apply a damping force.
aViscosity | Viscosity of the spring. |
Coordinate* OpenSim::SpringGeneralizedForce::_coord [mutable, protected] |
Corresponding generalized coordinate to which the coordinate actuator is applied.
std::string& OpenSim::SpringGeneralizedForce::_coordName [protected] |
Name of coordinate to which the spring gen force is applied.
Rest length.
Stiffness.
Viscosity.
double& OpenSim::SpringGeneralizedForce::_restLength [protected] |
double& OpenSim::SpringGeneralizedForce::_stiffness [protected] |
double& OpenSim::SpringGeneralizedForce::_viscosity [protected] |