A class implementing an OpenSim Joint. More...
#include <Joint.h>
Public Member Functions | |
Joint () | |
Default constructor. | |
Joint (const std::string &name, Body &parent, SimTK::Vec3 locationInParent, SimTK::Vec3 orientationInParent, Body &body, SimTK::Vec3 locationInBody, SimTK::Vec3 orientationInBody, bool reverse=false) | |
API constructor. | |
Joint (const Joint &aJoint) | |
Copy constructor. | |
virtual | ~Joint () |
Destructor. | |
virtual void | setup (Model &aModel) |
Perform some set up functions that happen after the object has been deserialized or copied. | |
Joint & | operator= (const Joint &aJoint) |
Assignment operator. | |
void | copyData (const Joint &aJoint) |
Copy data members from one Joint to another. | |
virtual Object * | copy () const =0 |
Construct and return a copy of this object. | |
virtual void | setBody (OpenSim::Body &aBody) |
Set the body to which this joint belongs. | |
virtual OpenSim::Body & | getBody () const |
Get the body to which this joint belongs. | |
virtual void | setLocation (const SimTK::Vec3 &aLocation) |
Set the location of this joint in its body. | |
virtual void | getLocation (SimTK::Vec3 &rLocation) const |
Get the location of this joint in its child body. | |
virtual void | setOrientation (const SimTK::Vec3 &aOrientation) |
Set the orientation of this joint in its body. | |
virtual void | getOrientation (SimTK::Vec3 &rOrientation) const |
Get the orientation of this joint in its body. | |
void | setParentName (const std::string &aName) |
std::string | getParentName () const |
Get the name of the joint's parent body. | |
virtual void | setParentBody (OpenSim::Body &aBody) |
Set the parent body to which this joint attaches. | |
virtual OpenSim::Body & | getParentBody () const |
Get the parent body to which this joint attaches. | |
virtual void | setLocationInParent (const SimTK::Vec3 &aLocation) |
Set the location of this joint in its parent body. | |
virtual void | getLocationInParent (SimTK::Vec3 &rLocation) const |
Get the location of this joint in its parent body. | |
virtual void | setOrientationInParent (const SimTK::Vec3 &aOrientation) |
Set the orientation of this joint in its parent body. | |
virtual void | getOrientationInParent (SimTK::Vec3 &rOrientation) const |
Get the orientation of this joint in its parent body. | |
virtual void | getOrientationInChild (double rOrientation[]) const |
virtual void | getOrientationInParent (double rOrientation[]) const |
virtual void | getLocationInChild (double rLocation[]) const |
virtual void | getLocationInParent (double rLocation[]) const |
virtual void | setLocationInChild (const SimTK::Vec3 &aLocation) |
virtual void | getLocationInChild (SimTK::Vec3 &rLocation) const |
const double & | getLocationInParent (int aXYZ) const |
const double & | getLocationInChild (int aXYZ) const |
virtual CoordinateSet & | getCoordinateSet () const |
virtual bool | getReverse () const |
virtual int | numCoordinates () const =0 |
virtual void | checkParentBody () |
Verify that the parent specified by this joint is in the underlying Simbody model/system. | |
virtual bool | isCoordinateUsed (Coordinate &aCoordinate) const |
Check if a coordinate is used by the Joint. | |
virtual void | scale (const ScaleSet &aScaleSet) |
Scale a joint based on XYZ scale factors for the bodies. | |
OPENSIM_DECLARE_DERIVED (Joint, Object) | |
void | updateName (const std::string &aName) |
Protected Member Functions | |
void | constructCoordinates () |
Construct coordinates according to the mobilities of the Joint. | |
SimTK::MobilizedBodyIndex | getMobilizedBodyIndex (Body *aBody) const |
void | setMobilizedBodyIndex (Body *aBody, SimTK::MobilizedBodyIndex index) const |
void | setCoordinateMobilizedBodyIndex (Coordinate *aCoord, SimTK::MobilizedBodyIndex index) const |
void | setCoordinateMobilityIndex (Coordinate *aCoord, int index) const |
void | setCoordinateModel (Coordinate *aCoord, Model *aModel) const |
void | createSystem (SimTK::MultibodySystem &system) const |
This is called when a SimTK System is being created for the Model. | |
void | initState (SimTK::State &s) const |
This is called after a SimTK System and State have been created for the Model. | |
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 | _parentNameProp |
Name of the parent body to which this joint connects its owner body. | |
std::string & | _parentName |
PropertyDblVec3 | _locationInParentProp |
Location of the joint in the parent body specified in the parent reference frame. | |
SimTK::Vec3 & | _locationInParent |
PropertyDblVec3 | _orientationInParentProp |
Orientation of the joint in the parent body specified in the parent reference frame. | |
SimTK::Vec3 & | _orientationInParent |
PropertyDblVec3 | _locationProp |
Location of the joint in the child body specified in the child reference frame. | |
SimTK::Vec3 & | _location |
PropertyDblVec3 | _orientationProp |
Orientation of the joint in the owing body specified in the owning body reference frame. | |
SimTK::Vec3 & | _orientation |
PropertyObj | _coordinateSetProp |
Set holding the generalized coordinates (q's) that parmeterize this joint. | |
CoordinateSet & | _coordinateSet |
PropertyBool | _reverseProp |
Whether the joint transform defines parent->child or child->parent. | |
bool & | _reverse |
SimTK::MobilizedBodyIndex | _bodyId |
Simbody ID of the body to which this joint belongs. | |
Body * | _body |
Body to which this joint belongs. | |
Body * | _parentBody |
Body to which this body is attached. | |
Friends | |
class | JointSet |
A class implementing an OpenSim Joint.
Joint::Joint | ( | ) |
Default constructor.
Joint::Joint | ( | const std::string & | name, | |
Body & | parent, | |||
SimTK::Vec3 | locationInParent, | |||
SimTK::Vec3 | orientationInParent, | |||
Body & | body, | |||
SimTK::Vec3 | locationInBody, | |||
SimTK::Vec3 | orientationInBody, | |||
bool | reverse = false | |||
) |
API constructor.
Joint::~Joint | ( | ) | [virtual] |
Destructor.
void Joint::checkParentBody | ( | ) | [virtual] |
Verify that the parent specified by this joint is in the underlying Simbody model/system.
Verify that parent for this Joint is valid.
If the parent is not connected (does not have a valid MobilzedBodyIndex) then throw an exception. It is up to the assembly routine to make sure it is connecting in a valid sequence - not the joint.
void Joint::constructCoordinates | ( | ) | [protected] |
Construct coordinates according to the mobilities of the Joint.
Reimplemented in OpenSim::CustomJoint.
virtual Object* OpenSim::Joint::copy | ( | ) | const [pure virtual] |
Construct and return a copy of this object.
The object is allocated using the new operator, so the caller is responsible for deleting the returned object.
Reimplemented from OpenSim::Object.
Implemented in OpenSim::BallJoint, OpenSim::CustomJoint, OpenSim::EllipsoidJoint, OpenSim::FreeJoint, OpenSim::PinJoint, OpenSim::SliderJoint, and OpenSim::WeldJoint.
void Joint::copyData | ( | const Joint & | aJoint | ) |
Copy data members from one Joint to another.
aJoint | Joint to be copied. |
Reimplemented in OpenSim::BallJoint, OpenSim::CustomJoint, OpenSim::EllipsoidJoint, OpenSim::FreeJoint, OpenSim::PinJoint, OpenSim::SliderJoint, and OpenSim::WeldJoint.
void Joint::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.
Reimplemented in OpenSim::BallJoint, OpenSim::CustomJoint, OpenSim::EllipsoidJoint, OpenSim::FreeJoint, OpenSim::PinJoint, OpenSim::SliderJoint, and OpenSim::WeldJoint.
OpenSim::Body & Joint::getBody | ( | ) | const [virtual] |
Get the body to which this joint belongs.
virtual CoordinateSet& OpenSim::Joint::getCoordinateSet | ( | ) | const [inline, virtual] |
void Joint::getLocation | ( | SimTK::Vec3 & | rLocation | ) | const [virtual] |
Get the location of this joint in its child body.
rLocation | Current location expressed in the local body frame. |
const double& OpenSim::Joint::getLocationInChild | ( | int | aXYZ | ) | const [inline] |
virtual void OpenSim::Joint::getLocationInChild | ( | SimTK::Vec3 & | rLocation | ) | const [inline, virtual] |
virtual void OpenSim::Joint::getLocationInChild | ( | double | rLocation[] | ) | const [inline, virtual] |
const double& OpenSim::Joint::getLocationInParent | ( | int | aXYZ | ) | const [inline] |
virtual void OpenSim::Joint::getLocationInParent | ( | double | rLocation[] | ) | const [inline, virtual] |
void Joint::getLocationInParent | ( | SimTK::Vec3 & | rLocation | ) | const [virtual] |
Get the location of this joint in its parent body.
rLocation | Currnt location expressed in the parent body frame. |
SimTK::MobilizedBodyIndex OpenSim::Joint::getMobilizedBodyIndex | ( | Body * | aBody | ) | const [inline, protected] |
virtual int OpenSim::Joint::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.
void Joint::getOrientation | ( | SimTK::Vec3 & | rOrientation | ) | const [virtual] |
Get the orientation of this joint in its body.
rOrientation | Current orientation of the joint expressed in the local body frame in body-fixed X-Y-Z Euler angles. |
virtual void OpenSim::Joint::getOrientationInChild | ( | double | rOrientation[] | ) | const [inline, virtual] |
virtual void OpenSim::Joint::getOrientationInParent | ( | double | rOrientation[] | ) | const [inline, virtual] |
void Joint::getOrientationInParent | ( | SimTK::Vec3 & | rOrientation | ) | const [virtual] |
Get the orientation of this joint in its parent body.
rOrientation | Current orientation expressed in the parent body frame in body-fixed X-Y-Z Euler angles. |
OpenSim::Body & Joint::getParentBody | ( | ) | const [virtual] |
Get the parent body to which this joint attaches.
string Joint::getParentName | ( | ) | const |
Get the name of the joint's parent body.
virtual bool OpenSim::Joint::getReverse | ( | ) | const [inline, virtual] |
void Joint::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.
Reimplemented in OpenSim::BallJoint, OpenSim::EllipsoidJoint, and OpenSim::FreeJoint.
bool Joint::isCoordinateUsed | ( | Coordinate & | aCoordinate | ) | const [virtual] |
Check if a coordinate is used by the Joint.
aCoordinate | Coordinate to look for in joint. |
virtual int OpenSim::Joint::numCoordinates | ( | ) | const [pure virtual] |
Assignment operator.
Reimplemented from OpenSim::ModelComponent.
Reimplemented in OpenSim::BallJoint, OpenSim::CustomJoint, OpenSim::EllipsoidJoint, OpenSim::FreeJoint, OpenSim::PinJoint, OpenSim::SliderJoint, and OpenSim::WeldJoint.
void Joint::scale | ( | const ScaleSet & | aScaleSet | ) | [virtual] |
Scale a joint based on XYZ scale factors for the bodies.
Generic behavior is to scale the locations on parent and on the body according to scale factors of the bodies upon which they are located.
Joint subclasses should invoke this method before scaling joint specific properties
aScaleSet | Set of XYZ scale factors for the bodies. |
Reimplemented in OpenSim::BallJoint, OpenSim::CustomJoint, OpenSim::EllipsoidJoint, OpenSim::FreeJoint, OpenSim::PinJoint, OpenSim::SliderJoint, and OpenSim::WeldJoint.
void Joint::setBody | ( | OpenSim::Body & | aBody | ) | [virtual] |
void OpenSim::Joint::setCoordinateMobilityIndex | ( | Coordinate * | aCoord, | |
int | index | |||
) | const [inline, protected] |
void OpenSim::Joint::setCoordinateMobilizedBodyIndex | ( | Coordinate * | aCoord, | |
SimTK::MobilizedBodyIndex | index | |||
) | const [inline, protected] |
void OpenSim::Joint::setCoordinateModel | ( | Coordinate * | aCoord, | |
Model * | aModel | |||
) | const [inline, protected] |
void Joint::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.
Reimplemented in OpenSim::BallJoint, OpenSim::EllipsoidJoint, and OpenSim::FreeJoint.
void Joint::setLocation | ( | const SimTK::Vec3 & | aLocation | ) | [virtual] |
Set the location of this joint in its body.
aLocation | New location expressed in the local body frame. |
virtual void OpenSim::Joint::setLocationInChild | ( | const SimTK::Vec3 & | aLocation | ) | [inline, virtual] |
void Joint::setLocationInParent | ( | const SimTK::Vec3 & | aLocation | ) | [virtual] |
Set the location of this joint in its parent body.
aLocation | New location expressed in the parent body frame. |
void OpenSim::Joint::setMobilizedBodyIndex | ( | Body * | aBody, | |
SimTK::MobilizedBodyIndex | index | |||
) | const [inline, protected] |
void Joint::setOrientation | ( | const SimTK::Vec3 & | aOrientation | ) | [virtual] |
Set the orientation of this joint in its body.
aOrientation | New orientation expressed in the local body frame in body-fixed X-Y-Z Euler angles. |
void Joint::setOrientationInParent | ( | const SimTK::Vec3 & | aOrientation | ) | [virtual] |
Set the orientation of this joint in its parent body.
aOrientation | New orientation expressed in the parent body frame in body-fixed X-Y-Z Euler angles. |
void Joint::setParentBody | ( | OpenSim::Body & | aBody | ) | [virtual] |
Set the parent body to which this joint attaches.
aParentBody | Parent body to which this joint attaches. |
void OpenSim::Joint::setParentName | ( | const std::string & | aName | ) |
void Joint::setup | ( | Model & | aModel | ) | [virtual] |
Perform some set up functions that happen after the object has been deserialized or copied.
aModel | OpenSim model containing this Joint. |
Reimplemented from OpenSim::ModelComponent.
Reimplemented in OpenSim::BallJoint, OpenSim::CustomJoint, OpenSim::EllipsoidJoint, OpenSim::FreeJoint, OpenSim::PinJoint, OpenSim::SliderJoint, and OpenSim::WeldJoint.
void Joint::updateName | ( | const std::string & | aName | ) |
friend class JointSet [friend] |
Body* OpenSim::Joint::_body [protected] |
Body to which this joint belongs.
SimTK::MobilizedBodyIndex OpenSim::Joint::_bodyId [protected] |
Simbody ID of the body to which this joint belongs.
CoordinateSet& OpenSim::Joint::_coordinateSet [protected] |
PropertyObj OpenSim::Joint::_coordinateSetProp [protected] |
Set holding the generalized coordinates (q's) that parmeterize this joint.
SimTK::Vec3& OpenSim::Joint::_location [protected] |
SimTK::Vec3& OpenSim::Joint::_locationInParent [protected] |
PropertyDblVec3 OpenSim::Joint::_locationInParentProp [protected] |
Location of the joint in the parent body specified in the parent reference frame.
PropertyDblVec3 OpenSim::Joint::_locationProp [protected] |
Location of the joint in the child body specified in the child reference frame.
For SIMM models, this vector is always the zero vector (i.e., the body reference frame coincides with the joint).
SimTK::Vec3& OpenSim::Joint::_orientation [protected] |
SimTK::Vec3& OpenSim::Joint::_orientationInParent [protected] |
Orientation of the joint in the parent body specified in the parent reference frame.
Euler XYZ body-fixed rotation angles are used to express the orientation.
PropertyDblVec3 OpenSim::Joint::_orientationProp [protected] |
Orientation of the joint in the owing body specified in the owning body reference frame.
Euler XYZ body-fixed rotation angles are used to express the orientation.
Body* OpenSim::Joint::_parentBody [protected] |
Body to which this body is attached.
std::string& OpenSim::Joint::_parentName [protected] |
PropertyStr OpenSim::Joint::_parentNameProp [protected] |
Name of the parent body to which this joint connects its owner body.
bool& OpenSim::Joint::_reverse [protected] |
PropertyBool OpenSim::Joint::_reverseProp [protected] |
Whether the joint transform defines parent->child or child->parent.