A class implementing a Simbody generalized coordinate. More...
#include <Coordinate.h>
Public Types | |
enum | MotionType { Rotational, Translational, Coupled } |
Motion type that is described by the coordinate. More... | |
Public Member Functions | |
Coordinate () | |
Default constructor. | |
Coordinate (const std::string &aName, MotionType aMotionType, double aRangeMin, double aRangeMax) | |
Constructor. | |
Coordinate (const Coordinate &aCoordinate) | |
Copy constructor. | |
virtual | ~Coordinate () |
Destructor. | |
virtual Object * | copy () const |
Copy this coordinate and return a pointer to the copy. | |
Coordinate & | operator= (const Coordinate &aCoordinate) |
Assignment operator. | |
void | copyData (const Coordinate &aCoordinate) |
Copy data members from one Coordinate to another. | |
virtual void | setup (Model &aModel) |
Perform some set up functions that happen after the object has been deserialized or copied. | |
virtual void | setJoint (const Joint &aOwningJoint) |
Set the joint to which this coordinate belongs. | |
virtual const Joint & | getJoint () const |
Get the joint to which this coordinate belongs. | |
Model & | getModel () const |
Get the Model this object is part of. | |
virtual void | updateFromCoordinate (const Coordinate &aCoordinate) |
Update an existing coordinate with parameter values from a new one, but only for the parameters that were explicitly specified in the XML node. | |
virtual double | getValue (const SimTK::State &s) const |
Get the value. | |
virtual bool | setValue (SimTK::State &s, double aValue, bool aEnforceContraints=true) const |
Set the value. | |
virtual double | getSpeedValue (const SimTK::State &s) const |
virtual bool | setSpeedValue (SimTK::State &s, double aValue) const |
const std::string | getSpeedName () const |
virtual double | getAccelerationValue (const SimTK::State &s) const |
virtual bool | getValueUseDefault () const |
virtual void | getRange (double rRange[2]) const |
virtual bool | setRange (double aRange[2]) |
Set the range min and max. | |
virtual double | getRangeMin () const |
virtual double | getRangeMax () const |
virtual bool | setRangeMin (double aMin) |
Set the range min. | |
virtual bool | setRangeMax (double aMax) |
Set the range max. | |
virtual bool | getRangeUseDefault () const |
virtual double | getDefaultValue () const |
virtual bool | setDefaultValue (double aDefaultValue) |
Set the default value. | |
double | getDefaultSpeedValue () const |
void | setDefaultSpeedValue (double aDefaultSpeedValue) |
virtual double | getInitialValue () const |
virtual void | setInitialValue (double aInitialValue) |
Set the initial value. | |
virtual bool | getDefaultValueUseDefault () const |
virtual bool | getClamped (const SimTK::State &s) const |
Get whether or not this coordinate is clamped. | |
virtual bool | setClamped (SimTK::State &s, bool aClamped) const |
virtual bool | getDefaultClamped () const |
virtual void | setDefaultClamped (bool aClamped) |
virtual bool | getClampedUseDefault () const |
virtual bool | getLocked (const SimTK::State &s) const |
Get whether or not this coordinate is locked. | |
virtual bool | setLocked (SimTK::State &s, bool aLocked) const |
Set whether or not this coordinate is locked. | |
virtual bool | getDefaultLocked () const |
virtual void | setDefaultLocked (bool aLocked) |
virtual bool | getLockedUseDefault () const |
virtual bool | isPrescribed (const SimTK::State &s) const |
void | setIsPrescribed (SimTK::State &s, bool isPrescribed) const |
Set whether or not this coordinate is being prescribed. | |
virtual bool | getDefaultIsPrescribed () const |
void | setDefaultIsPrescribed (bool isPrescribed) |
void | setPrescribedFunction (const Function &function) |
Set the prescribed motion function. | |
virtual OpenSim::Function * | getPrescribedFunction () const |
Get the prescribed motion function. | |
virtual MotionType | getMotionType () const |
virtual void | setMotionType (MotionType aMotionType) |
Set coordinate's motion type. | |
virtual bool | isDependent (const SimTK::State &s) const |
Determine if the the coordinate is dependent on other coordinates or not. | |
virtual bool | isConstrained (const SimTK::State &s) const |
Return true if coordinate is locked, prescribed, or dependent on other coordinates. | |
int | getMobilityIndex () const |
SimTK::MobilizedBodyIndex | getBodyIndex () const |
virtual std::string | getStateVariableName (int index) const |
Get the name of a state variable allocated by this ModelComponent. | |
virtual int | getStateVariableYIndex (int index) const |
Get the YIndex of a state variable allocated by this ModelComponent. | |
OPENSIM_DECLARE_DERIVED (Coordinate, Object) | |
Protected Member Functions | |
virtual void | createSystem (SimTK::MultibodySystem &system) const |
This is called when a SimTK System is being created for the Model. | |
virtual void | initState (SimTK::State &s) const |
This is called after a SimTK System and State have been created for the Model. | |
virtual void | setDefaultsFromState (const SimTK::State &state) |
Set all default values for this object to match those in a specified State. | |
virtual int | getNumStateVariables () const |
Gets the number of "Continuous" state variables maintained by the ModelComponent If the ModelComponent defines any that are of interest to the user, names should also be given. | |
Protected Attributes | |
PropertyStr | _motionTypeNameProp |
std::string & | _motionTypeName |
PropertyDbl | _defaultValueProp |
double & | _defaultValue |
PropertyDbl | _defaultSpeedValueProp |
double & | _defaultSpeedValue |
PropertyDbl | _initialValueProp |
double & | _initialValue |
PropertyDblArray | _rangeProp |
Array< double > & | _range |
PropertyBool | _clampedProp |
Flag indicating whether the coordinate is clamped or not. | |
bool & | _clamped |
PropertyBool | _lockedProp |
Flag indicating whether the coordinate is locked or not. | |
bool & | _locked |
SimTK::Function * | _lockFunction |
PropertyBool | _isPrescribedProp |
Flag indicating whether the coordinate is prescribed or not. | |
bool & | _isPrescribed |
PropertyObjPtr< OpenSim::Function > | _prescribedFunctionProp |
Specify the desired prescribed motion as a function of time. | |
OpenSim::Function *& | _prescribedFunction |
SimTK::MobilizedBodyIndex | _bodyIndex |
ID of the body which this coordinate serves. | |
int | _mobilityIndex |
Mobility index for this coordinate. | |
MotionType | _motionType |
Motion type (translational, rotational or combination). | |
Joint const * | _joint |
Simbody joint that owns this coordinate. | |
int | _qIndex |
Friends | |
class | Constraint |
class | CoordinateCouplerConstraint |
class | Joint |
class | Model |
A class implementing a Simbody generalized coordinate.
Coordinate::Coordinate | ( | ) |
Default constructor.
Coordinate::Coordinate | ( | const std::string & | aName, | |
MotionType | aMotionType, | |||
double | aRangeMin, | |||
double | aRangeMax | |||
) |
Constructor.
Coordinate::Coordinate | ( | const Coordinate & | aCoordinate | ) |
Copy constructor.
aCoordinate | Coordinate to be copied. |
Coordinate::~Coordinate | ( | ) | [virtual] |
Destructor.
Object * Coordinate::copy | ( | ) | const [virtual] |
Copy this coordinate and return a pointer to the copy.
The copy constructor for this class is used.
Reimplemented from OpenSim::Object.
void Coordinate::copyData | ( | const Coordinate & | aCoordinate | ) |
Copy data members from one Coordinate to another.
aCoordinate | Coordinate to be copied. |
void Coordinate::createSystem | ( | SimTK::MultibodySystem & | system | ) | const [protected, virtual] |
This is called when a SimTK System is being created for the Model.
It must be implemented to add appropriate elements to the System corresponding to this object. Methods for adding modeling options, state variables and their derivatives, discrete variables, as well must be called with createSystem() only.
system | the System being created |
Reimplemented from OpenSim::ModelComponent.
double Coordinate::getAccelerationValue | ( | const SimTK::State & | s | ) | const [virtual] |
SimTK::MobilizedBodyIndex OpenSim::Coordinate::getBodyIndex | ( | ) | const [inline] |
bool Coordinate::getClamped | ( | const SimTK::State & | s | ) | const [virtual] |
Get whether or not this coordinate is clamped.
Calls the underlying constraint at the dynamics level.
virtual bool OpenSim::Coordinate::getClampedUseDefault | ( | ) | const [inline, virtual] |
virtual bool OpenSim::Coordinate::getDefaultClamped | ( | ) | const [inline, virtual] |
virtual bool OpenSim::Coordinate::getDefaultIsPrescribed | ( | ) | const [inline, virtual] |
virtual bool OpenSim::Coordinate::getDefaultLocked | ( | ) | const [inline, virtual] |
double OpenSim::Coordinate::getDefaultSpeedValue | ( | ) | const [inline] |
virtual double OpenSim::Coordinate::getDefaultValue | ( | ) | const [inline, virtual] |
virtual bool OpenSim::Coordinate::getDefaultValueUseDefault | ( | ) | const [inline, virtual] |
virtual double OpenSim::Coordinate::getInitialValue | ( | ) | const [inline, virtual] |
const Joint & Coordinate::getJoint | ( | ) | const [virtual] |
Get the joint to which this coordinate belongs.
bool Coordinate::getLocked | ( | const SimTK::State & | s | ) | const [virtual] |
Get whether or not this coordinate is locked.
Calls the underlying constraint at the dynamics level.
virtual bool OpenSim::Coordinate::getLockedUseDefault | ( | ) | const [inline, virtual] |
int OpenSim::Coordinate::getMobilityIndex | ( | ) | const [inline] |
Model& OpenSim::Coordinate::getModel | ( | ) | const [inline] |
Get the Model this object is part of.
Reimplemented from OpenSim::ModelComponent.
virtual MotionType OpenSim::Coordinate::getMotionType | ( | ) | const [inline, virtual] |
virtual int OpenSim::Coordinate::getNumStateVariables | ( | ) | const [inline, protected, virtual] |
Gets the number of "Continuous" state variables maintained by the ModelComponent If the ModelComponent defines any that are of interest to the user, names should also be given.
Implements OpenSim::ModelComponent.
OpenSim::Function * Coordinate::getPrescribedFunction | ( | ) | const [virtual] |
Get the prescribed motion function.
virtual void OpenSim::Coordinate::getRange | ( | double | rRange[2] | ) | const [inline, virtual] |
virtual double OpenSim::Coordinate::getRangeMax | ( | ) | const [inline, virtual] |
virtual double OpenSim::Coordinate::getRangeMin | ( | ) | const [inline, virtual] |
virtual bool OpenSim::Coordinate::getRangeUseDefault | ( | ) | const [inline, virtual] |
const std::string Coordinate::getSpeedName | ( | ) | const |
double Coordinate::getSpeedValue | ( | const SimTK::State & | s | ) | const [virtual] |
std::string Coordinate::getStateVariableName | ( | int | index | ) | const [virtual] |
Get the name of a state variable allocated by this ModelComponent.
The default implementation throws an exception, so subclasses that allocate state variables must override it.
index | the index of the state variable (0 to getNumStateVariables()-1) |
Reimplemented from OpenSim::ModelComponent.
int Coordinate::getStateVariableYIndex | ( | int | index | ) | const [virtual] |
Get the YIndex of a state variable allocated by this ModelComponent.
The default implementation throws an exception, so subclasses that allocate state variables must override it.
index | the index of the state variable (0 to getNumStateVariables()-1) |
Reimplemented from OpenSim::ModelComponent.
double Coordinate::getValue | ( | const SimTK::State & | s | ) | const [virtual] |
Get the value.
virtual bool OpenSim::Coordinate::getValueUseDefault | ( | ) | const [inline, virtual] |
virtual void OpenSim::Coordinate::initState | ( | SimTK::State & | state | ) | const [protected, virtual] |
This is called after a SimTK System and State have been created for the Model.
It must be implementd to set initial values of state variables.
state | the State to initialize |
Reimplemented from OpenSim::ModelComponent.
bool Coordinate::isConstrained | ( | const SimTK::State & | s | ) | const [virtual] |
Return true if coordinate is locked, prescribed, or dependent on other coordinates.
Determine if the the coordinate is constrained or not.
Specifically, is locked, prescribed, or completely dependent on other coordinates? If so return true, false otherwise.
bool Coordinate::isDependent | ( | const SimTK::State & | s | ) | const [virtual] |
Determine if the the coordinate is dependent on other coordinates or not.
If so return true, false otherwise.
bool Coordinate::isPrescribed | ( | const SimTK::State & | s | ) | const [virtual] |
OpenSim::Coordinate::OPENSIM_DECLARE_DERIVED | ( | Coordinate | , | |
Object | ||||
) |
Coordinate & Coordinate::operator= | ( | const Coordinate & | aCoordinate | ) |
virtual bool OpenSim::Coordinate::setClamped | ( | SimTK::State & | s, | |
bool | aClamped | |||
) | const [virtual] |
virtual void OpenSim::Coordinate::setDefaultClamped | ( | bool | aClamped | ) | [inline, virtual] |
void OpenSim::Coordinate::setDefaultIsPrescribed | ( | bool | isPrescribed | ) | [inline] |
virtual void OpenSim::Coordinate::setDefaultLocked | ( | bool | aLocked | ) | [inline, virtual] |
void Coordinate::setDefaultsFromState | ( | const SimTK::State & | state | ) | [protected, virtual] |
Set all default values for this object to match those in a specified State.
It must be implemented/overriden to set any default values defined by each subclass.
state | the State from which to take values that should become the defaults for this object |
Reimplemented from OpenSim::ModelComponent.
void OpenSim::Coordinate::setDefaultSpeedValue | ( | double | aDefaultSpeedValue | ) | [inline] |
bool Coordinate::setDefaultValue | ( | double | aDefaultValue | ) | [virtual] |
Set the default value.
aDefaultValue | default value to change to. |
void Coordinate::setInitialValue | ( | double | aInitialValue | ) | [virtual] |
Set the initial value.
Used to initialize the initial_value field in sdm.q
void Coordinate::setIsPrescribed | ( | SimTK::State & | s, | |
bool | isPrescribed | |||
) | const |
Set whether or not this coordinate is being prescribed.
A prescribed constraint is used specify motion at the dynamics level. If isPrescribed is set after clamping or locking it takes precedence- and clamped and locked are false.
isPrescribed | If true the coordinate is prescribed; if false not prescribed. |
void Coordinate::setJoint | ( | const Joint & | aOwningJoint | ) | [virtual] |
bool Coordinate::setLocked | ( | SimTK::State & | s, | |
bool | aLocked | |||
) | const [virtual] |
Set whether or not this coordinate is locked.
A prescribed constraint is used to lock the joint at the dynamics level. If lock is applied after clamping or prescribed motion it takes precedence.
aLocked | If true the joint is locked; if false the joint is unlocked. |
void Coordinate::setMotionType | ( | MotionType | aMotionType | ) | [virtual] |
Set coordinate's motion type.
void Coordinate::setPrescribedFunction | ( | const Function & | function | ) |
Set the prescribed motion function.
bool Coordinate::setRange | ( | double | aRange[2] | ) | [virtual] |
Set the range min and max.
aRange | range min and man to change to. |
bool Coordinate::setRangeMax | ( | double | aMax | ) | [virtual] |
Set the range max.
aRange | range max to change to. |
bool Coordinate::setRangeMin | ( | double | aMin | ) | [virtual] |
Set the range min.
aRange | range min to change to. |
bool Coordinate::setSpeedValue | ( | SimTK::State & | s, | |
double | aValue | |||
) | const [virtual] |
void Coordinate::setup | ( | Model & | aModel | ) | [virtual] |
Perform some set up functions that happen after the object has been deserialized or copied.
aModel | OpenSim model containing this Coordinate. |
Reimplemented from OpenSim::ModelComponent.
bool Coordinate::setValue | ( | SimTK::State & | s, | |
double | aValue, | |||
bool | enforceConstraints = true | |||
) | const [virtual] |
void Coordinate::updateFromCoordinate | ( | const Coordinate & | aCoordinate | ) | [virtual] |
Update an existing coordinate with parameter values from a new one, but only for the parameters that were explicitly specified in the XML node.
aCoordinate | coordinate to update from |
friend class Constraint [friend] |
friend class CoordinateCouplerConstraint [friend] |
friend class Joint [friend] |
friend class Model [friend] |
SimTK::MobilizedBodyIndex OpenSim::Coordinate::_bodyIndex [protected] |
ID of the body which this coordinate serves.
bool& OpenSim::Coordinate::_clamped [protected] |
PropertyBool OpenSim::Coordinate::_clampedProp [protected] |
Flag indicating whether the coordinate is clamped or not.
Clamped means that the coordinate is not allowed to go outside its range.
double& OpenSim::Coordinate::_defaultSpeedValue [protected] |
double& OpenSim::Coordinate::_defaultValue [protected] |
PropertyDbl OpenSim::Coordinate::_defaultValueProp [protected] |
double& OpenSim::Coordinate::_initialValue [protected] |
PropertyDbl OpenSim::Coordinate::_initialValueProp [protected] |
bool& OpenSim::Coordinate::_isPrescribed [protected] |
PropertyBool OpenSim::Coordinate::_isPrescribedProp [protected] |
Flag indicating whether the coordinate is prescribed or not.
Prescribed means the value will vary with time according to the Prescribed Function, which must be set first.
Joint const* OpenSim::Coordinate::_joint [protected] |
Simbody joint that owns this coordinate.
bool& OpenSim::Coordinate::_locked [protected] |
PropertyBool OpenSim::Coordinate::_lockedProp [protected] |
Flag indicating whether the coordinate is locked or not.
Locked means fixed at one value.
SimTK::Function* OpenSim::Coordinate::_lockFunction [protected] |
int OpenSim::Coordinate::_mobilityIndex [protected] |
Mobility index for this coordinate.
MotionType OpenSim::Coordinate::_motionType [protected] |
Motion type (translational, rotational or combination).
std::string& OpenSim::Coordinate::_motionTypeName [protected] |
PropertyStr OpenSim::Coordinate::_motionTypeNameProp [protected] |
OpenSim::Function*& OpenSim::Coordinate::_prescribedFunction [protected] |
Specify the desired prescribed motion as a function of time.
int OpenSim::Coordinate::_qIndex [protected] |
Array<double>& OpenSim::Coordinate::_range [protected] |
PropertyDblArray OpenSim::Coordinate::_rangeProp [protected] |