API
4.2
For C++ developers
|
TwoFrameLinker is a utility class to extend a Component such that it connects two Frames. More...
OpenSim Properties, Sockets, Outputs, Inputs | |
Properties (list) | |
Frames added to satisfy the sockets of this TwoFrameLinker Component | |
F | frames |
"Frames created/added to satisfy this component's connections." More... | |
Sockets | |
F | frame1 |
"The first frame participating in this linker." More... | |
F | frame2 |
"The second frame participating in this linker." More... | |
Public Member Functions | |
TwoFrameLinker () | |
By default, the TwoFrameLinker is not connected to any frames. More... | |
TwoFrameLinker (const std::string &name, const F &frame1, const F &frame2) | |
Convenience Constructor. More... | |
TwoFrameLinker (const std::string &name, const std::string &frame1Name, const std::string &frame2Name) | |
Convenience Constructor. More... | |
TwoFrameLinker (const std::string &name, const F &frame1, const SimTK::Transform &offsetOnFrame1, const F &frame2, const SimTK::Transform &offsetOnFrame2) | |
Convenience Constructor with two Frames Construct a TwoFrameLinker where the two frames are specified by name and offset transforms on the respective frames. More... | |
TwoFrameLinker (const std::string &name, const std::string &frame1Name, const SimTK::Transform &offsetOnFrame1, const std::string &frame2Name, const SimTK::Transform &offsetOnFrame2) | |
Convenience Constructor Construct a TwoFrameLinker where the two frames are specified by name and offset transforms on the respective frames. More... | |
TwoFrameLinker (const std::string &name, const PhysicalFrame &frame1, const SimTK::Vec3 &locationInFrame1, const SimTK::Vec3 &orientationInFrame1, const PhysicalFrame &frame2, const SimTK::Vec3 &locationInFrame2, const SimTK::Vec3 &orientationInFrame2) | |
Backwards compatible Convenience Constructor TwoFrameLinker with offsets specified in terms of the location and orientation in respective PhysicalFrames. More... | |
TwoFrameLinker (const std::string &name, const std::string &frame1Name, const SimTK::Vec3 &locationInFrame1, const SimTK::Vec3 &orientationInFrame1, const std::string &frame2Name, const SimTK::Vec3 &locationInFrame2, const SimTK::Vec3 &orientationInFrame2) | |
Backwards compatible Convenience Constructor TwoFrameLinker with offsets specified in terms of the location and orientation in respective PhysicalFrames. More... | |
const F & | getFrame1 () const |
Access the first frame the TwoFrameLinker component connects. More... | |
const F & | getFrame2 () const |
Access the second frame the TwoFrameLinker component connects. More... | |
SimTK::Transform | computeRelativeOffset (const SimTK::State &s) const |
Compute the relative offset Transform between the two frames linked by this TwoFrameLinker component at a given State, expressed in frame1. More... | |
SimTK::SpatialVec | computeRelativeVelocity (const SimTK::State &s) const |
Compute the relative spatial velocity between the two frames linked by this TwoFrameLinker component at a given State, expressed in frame1. More... | |
SimTK::Vec6 | computeDeflection (const SimTK::State &s) const |
Compute the deflection (spatial separation) of the two frames connected by the TwoFrameLinker. More... | |
SimTK::Vec6 | computeDeflectionRate (const SimTK::State &s) const |
Compute the deflection rate (dqdot) of the two frames connected by this TwoFrameLinker component. More... | |
Property-related functions | |
const F & | get_frames (int i) const |
Get the value of the i-th element of the frames property. More... | |
F & | upd_frames (int i) |
Get a writable reference to the i-th element of the frames property. More... | |
void | set_frames (int i, const F &value) |
Set the value of the i-th element of frames property. More... | |
int | append_frames (const F &value) |
Append an element to the frames property. More... | |
Socket-related functions | |
void | connectSocket_frame1 (const Object &object) |
Connect the 'frame1' Socket to an object of type F. More... | |
void | connectSocket_frame2 (const Object &object) |
Connect the 'frame2' Socket to an object of type F. More... | |
Public Types | |
typedef TwoFrameLinker | Self |
This typedef might be useful within the member functions of this class. More... | |
typedef C | Super |
Use this typedef to refer to the superclass of this class. More... | |
Protected Member Functions | |
void | convertInternalForceToForcesOnFrames (const SimTK::State &state, SimTK::Vec6 f, SimTK::SpatialVec &F1_G, SimTK::SpatialVec &F2_G) const |
Helper method to convert internal force expressed in the mobility basis between frame1 and frame2, dq, as individual spatial forces acting on each frame linked by this component. More... | |
void | addInPhysicalForcesFromInternal (const SimTK::State &state, SimTK::Vec6 f, SimTK::Vector_< SimTK::SpatialVec > &spatialForces) const |
Helper method to add in the equivalent system spatial forces given internal forces. More... | |
Component Interface | |
These methods adhere to the Component Interface | |
void | extendConnectToModel (Model &model) override |
void | updateFromXMLNode (SimTK::Xml::Element &aNode, int versionNumber) override |
Auto-generated functions | |
static TwoFrameLinker * | safeDownCast (OpenSim::Object *obj) |
For use in MATLAB and Python to access the concrete class. More... | |
static const std::string & | getClassName () |
This returns "TwoFrameLinker_<T>_". More... | |
void | assign (Object &aObject) override |
This allows copy assignment in the Java GUI. More... | |
TwoFrameLinker * | clone () const override=0 |
const std::string & | getConcreteClassName () const override=0 |
TwoFrameLinker is a utility class to extend a Component such that it connects two Frames.
For example, a WeldConstraint and BushingForces operate between two frames to restrict their motion. A TwoFrameLinker<Force, PhysicalFrame>, for example, is a Force that operates between two PhyscialFrames and it is the base class for BushingForces. (A class whose super class is a template parameter is called a mixin class.)
C | The base class. |
F | The type of frame that the class links together. |
typedef TwoFrameLinker OpenSim::TwoFrameLinker< C, F >::Self |
This typedef might be useful within the member functions of this class.
This is generated by the OpenSim_DECLARE_*_OBJECT
macros.
typedef C OpenSim::TwoFrameLinker< C, F >::Super |
Use this typedef to refer to the superclass of this class.
Avoid using the explicit type name of the superclass; this would introduce bugs if the superclass is changed.
This is generated by the OpenSim_DECLARE_*_OBJECT
macros.
OpenSim::TwoFrameLinker< C, F >::TwoFrameLinker | ( | ) |
By default, the TwoFrameLinker is not connected to any frames.
OpenSim::TwoFrameLinker< C, F >::TwoFrameLinker | ( | const std::string & | name, |
const F & | frame1, | ||
const F & | frame2 | ||
) |
Convenience Constructor.
Create a TwoFrameLinker Component between two Frames.
[in] | name | the name of this TwoFrameLinker component |
[in] | frame1 | the name of the first Frame being linked |
[in] | frame2 | the name of the second Frame being linked |
OpenSim::TwoFrameLinker< C, F >::TwoFrameLinker | ( | const std::string & | name, |
const std::string & | frame1Name, | ||
const std::string & | frame2Name | ||
) |
Convenience Constructor.
Create a TwoFrameLinker Component between two Frames identified by name.
[in] | name | the name of this TwoFrameLinker component |
[in] | frame1Name | the name of the first Frame being linked |
[in] | frame2Name | the name of the second Frame being linked |
OpenSim::TwoFrameLinker< C, F >::TwoFrameLinker | ( | const std::string & | name, |
const F & | frame1, | ||
const SimTK::Transform & | offsetOnFrame1, | ||
const F & | frame2, | ||
const SimTK::Transform & | offsetOnFrame2 | ||
) |
Convenience Constructor with two Frames Construct a TwoFrameLinker where the two frames are specified by name and offset transforms on the respective frames.
[in] | name | the name of this TwoFrameLinker component |
[in] | frame1 | the first Frame being linked |
[in] | offsetOnFrame1 | offset Transform on the first frame |
[in] | frame2 | the second Frame being linked |
[in] | offsetOnFrame2 | offset Transform on the second frame |
OpenSim::TwoFrameLinker< C, F >::TwoFrameLinker | ( | const std::string & | name, |
const std::string & | frame1Name, | ||
const SimTK::Transform & | offsetOnFrame1, | ||
const std::string & | frame2Name, | ||
const SimTK::Transform & | offsetOnFrame2 | ||
) |
Convenience Constructor Construct a TwoFrameLinker where the two frames are specified by name and offset transforms on the respective frames.
[in] | name | the name of this TwoFrameLinker component |
[in] | frame1Name | the name of the first Frame being linked |
[in] | offsetOnFrame1 | offset Transform on the first frame |
[in] | frame2Name | the name of the second Frame being linked |
[in] | offsetOnFrame2 | offset Transform on the second frame |
OpenSim::TwoFrameLinker< C, F >::TwoFrameLinker | ( | const std::string & | name, |
const PhysicalFrame & | frame1, | ||
const SimTK::Vec3 & | locationInFrame1, | ||
const SimTK::Vec3 & | orientationInFrame1, | ||
const PhysicalFrame & | frame2, | ||
const SimTK::Vec3 & | locationInFrame2, | ||
const SimTK::Vec3 & | orientationInFrame2 | ||
) |
Backwards compatible Convenience Constructor TwoFrameLinker with offsets specified in terms of the location and orientation in respective PhysicalFrames.
[in] | name | the name of this TwoFrameLinker component |
[in] | frame1 | the first Frame being linked |
[in] | locationInFrame1 | Vec3 of offset location on the first frame |
[in] | orientationInFrame1 | Vec3 of orientation offset expressed as XYZ body-fixed Euler angles w.r.t frame1. |
[in] | frame2 | the second Frame being linked |
[in] | locationInFrame2 | Vec3 of offset location on the second frame |
[in] | orientationInFrame2 | Vec3 of orientation offset expressed as XYZ body-fixed Euler angles w.r.t frame2. |
OpenSim::TwoFrameLinker< C, F >::TwoFrameLinker | ( | const std::string & | name, |
const std::string & | frame1Name, | ||
const SimTK::Vec3 & | locationInFrame1, | ||
const SimTK::Vec3 & | orientationInFrame1, | ||
const std::string & | frame2Name, | ||
const SimTK::Vec3 & | locationInFrame2, | ||
const SimTK::Vec3 & | orientationInFrame2 | ||
) |
Backwards compatible Convenience Constructor TwoFrameLinker with offsets specified in terms of the location and orientation in respective PhysicalFrames.
[in] | name | the name of this TwoFrameLinker component |
[in] | frame1Name | the name of the first Frame being linked |
[in] | locationInFrame1 | Vec3 of offset location on the first frame |
[in] | orientationInFrame1 | Vec3 of orientation offset expressed as XYZ body-fixed Euler angles w.r.t frame1. |
[in] | frame2Name | the name of the second Frame being linked |
[in] | locationInFrame2 | Vec3 of offset location on the second frame |
[in] | orientationInFrame2 | Vec3 of orientation offset expressed as XYZ body-fixed Euler angles w.r.t frame2. |
|
protected |
Helper method to add in the equivalent system spatial forces given internal forces.
Internal forces are expressed in the mobility basis as parameterized by the deflection between frame1 and frame2, dq, and its time derivative, dqdot. The intended usage is within a Force::computeForce() which is tasked with populating vectors of generalized forces and/or (mobilized body) spatial forces. This method will populate (add in) the spatialForces given the internal force.
state | const State of current system configuration | |
[in] | f | Vec6 of forces in the basis of the deflection |
[in,out] | spatialForces | Vector of SpatialVec's (torque, force) on each PhysicalFrame's base frame in the System. This is equivalent to each MobilizedBody. |
|
inline |
Append an element to the frames property.
|
inlineoverride |
This allows copy assignment in the Java GUI.
Exception | if the argument is not of type TwoFrameLinker. |
|
overridepure virtual |
SimTK::Vec6 OpenSim::TwoFrameLinker< C, F >::computeDeflection | ( | const SimTK::State & | s | ) | const |
Compute the deflection (spatial separation) of the two frames connected by the TwoFrameLinker.
Angular deflections expressed as XYZ body-fixed Euler angles of frame2 w.r.t frame1. NOTE: When using deflections to compute spatial forces, these forces may not be valid for large deflections, because Euler angles are unable to uniquely distinguish an X rotation angle of +/-180 degs, and subsequent rotations that are +/-90 degs. It is mainly useful for calculating errors for constraints and forces for computing restoration forces.
SimTK::Vec6 OpenSim::TwoFrameLinker< C, F >::computeDeflectionRate | ( | const SimTK::State & | s | ) | const |
Compute the deflection rate (dqdot) of the two frames connected by this TwoFrameLinker component.
Angular velocity is expressed as Euler (XYZ body-fixed) angle derivatives. Note that the derivatives become singular as the second Euler angle approaches 90 degs.
SimTK::Transform OpenSim::TwoFrameLinker< C, F >::computeRelativeOffset | ( | const SimTK::State & | s | ) | const |
Compute the relative offset Transform between the two frames linked by this TwoFrameLinker component at a given State, expressed in frame1.
SimTK::SpatialVec OpenSim::TwoFrameLinker< C, F >::computeRelativeVelocity | ( | const SimTK::State & | s | ) | const |
Compute the relative spatial velocity between the two frames linked by this TwoFrameLinker component at a given State, expressed in frame1.
|
inline |
Connect the 'frame1' Socket to an object of type F.
Call finalizeConnections() afterwards to update the socket's connectee path property. The reference to the connectee set here takes precedence over the connectee path property.
|
inline |
Connect the 'frame2' Socket to an object of type F.
Call finalizeConnections() afterwards to update the socket's connectee path property. The reference to the connectee set here takes precedence over the connectee path property.
|
protected |
Helper method to convert internal force expressed in the mobility basis between frame1 and frame2, dq, as individual spatial forces acting on each frame linked by this component.
The internal force, f, is directed onto frame2 from frame1. In computeDeflection(), frame2's pose in frame1 is decomposed in to 6 internal coordinates dq (similar to the q's of a free joint). Their derivatives, dqdot, form a internal coordinates "mobility" basis that can be used to express frame2's spatial velocity in frame1 or to apply internal (generalized) forces that apply equal and opposite spatial forces to the two frames.
|
overrideprotected |
|
inline |
Get the value of the i-th element of the frames property.
|
inlinestatic |
This returns "TwoFrameLinker_<T>_".
T is the template argument for this class. See getConcreteClassName() if you want the class name of the underlying concrete object instead.
This is generated by the OpenSim_DECLARE_*_OBJECT
macros.
|
overridepure virtual |
const F & OpenSim::TwoFrameLinker< C, F >::getFrame1 | ( | ) | const |
Access the first frame the TwoFrameLinker component connects.
Note, if an offset was introduced at construction, then this will be the offset frame.
const F & OpenSim::TwoFrameLinker< C, F >::getFrame2 | ( | ) | const |
Access the second frame the TwoFrameLinker component connects.
Note, if an offset was introduced at construction, then this will be the offset frame.
|
inlinestatic |
For use in MATLAB and Python to access the concrete class.
Example: cObj = TwoFrameLinker.safeDownCast(obj)
. This is equivalent to dynamic_cast<TwoFrameLinker*>(obj)
in C++.
|
inline |
Set the value of the i-th element of frames property.
|
inline |
Get a writable reference to the i-th element of the frames property.
|
overrideprotected |
F OpenSim::TwoFrameLinker< C, F >::frame1 |
"The first frame participating in this linker."
In an XML file, you can set this Socket's connectee path via the <socket_frame1 > element. This socket was generated with the OpenSim_DECLARE_SOCKET macro; see AbstractSocket for more information.
F OpenSim::TwoFrameLinker< C, F >::frame2 |
"The second frame participating in this linker."
In an XML file, you can set this Socket's connectee path via the <socket_frame2 > element. This socket was generated with the OpenSim_DECLARE_SOCKET macro; see AbstractSocket for more information.
F OpenSim::TwoFrameLinker< C, F >::frames |
"Frames created/added to satisfy this component's connections."
This property appears in XML files under the tag <frames>. This property holds a list of objects, and was generated with the OpenSim_DECLARE_LIST_PROPERTY macro; see Property to learn about the property system.