API  4.4
For C++ developers
OpenSim::OffsetFrame< C > Class Template Referenceabstract

An OffsetFrame is a Frame whose transform (translation and orientation) with respect to another (parent) Frame is constant in time. More...

+ Inheritance diagram for OpenSim::OffsetFrame< C >:

OpenSim Properties, Sockets, Outputs, Inputs

Properties (single-value)
SimTK::Vec3 translation
 "Translational offset (in meters) of this frame's origin from the parent " "frame's origin, expressed in the parent frame." More...
 
SimTK::Vec3 orientation
 "Orientation offset (in radians) of this frame in its parent frame, " "expressed as a frame-fixed x-y-z rotation sequence." More...
 
Sockets
parent
 "The parent frame to this frame." More...
 

Public Member Functions

 OffsetFrame ()
 By default, the frame is not connected to any parent frame, and its transform is an identity transform. More...
 
 OffsetFrame (const C &parent, const SimTK::Transform &offset)
 A convenience constructor that initializes the parent connection and offset Transform in the parent frame. More...
 
 OffsetFrame (const std::string &name, const C &parent, const SimTK::Transform &offset)
 A convenience constructor that initializes the parent connection by name and of the offset Transform in the parent frame. More...
 
 OffsetFrame (const std::string &name, const std::string &parentName, const SimTK::Transform &offset)
 A convenience constructor that initializes the parent connection by name and of the offset Transform in the parent frame. More...
 
void setParentFrame (const C &parent)
 Sets the parent reference frame. More...
 
const C & getParentFrame () const
 Get the parent reference frame. More...
 
const SimTK::Transform & getOffsetTransform () const
 Get the transform that describes the translational and rotational offset of this frame (F frame) relative to its parent frame (B frame). More...
 
void setOffsetTransform (const SimTK::Transform &offset)
 Sets the transform the translates and rotates this frame (F frame) from its parent frame (P frame). More...
 
void extendScale (const SimTK::State &s, const ScaleSet &scaleSet) override
 Scale the offset given scale factors for spatial (XYZ) dimensions. More...
 
Property-related functions
const SimTK::Vec3 & get_translation () const
 Get the value of the translation property. More...
 
SimTK::Vec3 & upd_translation ()
 Get a writable reference to the translation property. More...
 
void set_translation (const SimTK::Vec3 &value)
 Set the value of the translation property. More...
 
const SimTK::Vec3 & get_orientation () const
 Get the value of the orientation property. More...
 
SimTK::Vec3 & upd_orientation ()
 Get a writable reference to the orientation property. More...
 
void set_orientation (const SimTK::Vec3 &value)
 Set the value of the orientation property. More...
 
Socket-related functions
void connectSocket_parent (const Object &object)
 Connect the 'parent' Socket to an object of type C. More...
 

Public Types

typedef OffsetFrame 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

const FrameextendFindBaseFrame () const override final
 Extend how OffsetFrame determines its base Frame. More...
 
SimTK::Transform extendFindTransformInBaseFrame () const override final
 Extend how OffsetFrame determines its transform in its base Frame. More...
 
SimTK::Transform calcTransformInGround (const SimTK::State &state) const override final
 
SimTK::SpatialVec calcVelocityInGround (const SimTK::State &state) const override final
 
SimTK::SpatialVec calcAccelerationInGround (const SimTK::State &state) const override final
 
Component Interface

These methods adhere to the Component Interface

void extendFinalizeFromProperties () override
 
void extendConnectToModel (Model &model) override
 

Auto-generated functions

static OffsetFramesafeDownCast (OpenSim::Object *obj)
 For use in MATLAB and Python to access the concrete class. More...
 
static const std::string & getClassName ()
 This returns "OffsetFrame_<T>_". More...
 
void assign (Object &aObject) override
 This allows copy assignment in the Java GUI. More...
 
OffsetFrameclone () const override=0
 
const std::string & getConcreteClassName () const override=0
 

Detailed Description

template<class C = Frame>
class OpenSim::OffsetFrame< C >

An OffsetFrame is a Frame whose transform (translation and orientation) with respect to another (parent) Frame is constant in time.

It acts as an extension of the parent Frame type so that an OffsetFrame<PhysicalFrame>, for example, can be treated as a PhysicalFrame. This enables Frames to be filtered by their type (e.g. Physical or not), regardless of whether or not the Frame is also an OffsetFrame. (A class whose super class is a template parameter is called a mixin class.)

OffsetFrames also have the property that if they form a chain or a tree, each OffsetFrame shares the same Base which is the parent of the first/root OffsetFrame in the tree. This allows Solvers and algorithms to work directly with the Base which can be more efficient.

OffsetFrame is an abstract class. Derive concrete subclasses in order to accommodate new Frame types that require their offsets to retain the same type as the parent. For example:

class PhysicalOffsetFrame : public OffsetFrame<PhysicalFrame>
See also
PhysicalOffsetFrame.
Template Parameters
CThe type of the parent frame, as well as the super class. Must be of type Frame.
Author
Matt DeMers
Ajay Seth

Member Typedef Documentation

◆ Self

template<class C = Frame>
typedef OffsetFrame OpenSim::OffsetFrame< C >::Self

This typedef might be useful within the member functions of this class.

This is generated by the OpenSim_DECLARE_*_OBJECT macros.

◆ Super

template<class C = Frame>
typedef C OpenSim::OffsetFrame< C >::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.

Constructor & Destructor Documentation

◆ OffsetFrame() [1/4]

template<class C >
OpenSim::OffsetFrame< C >::OffsetFrame ( )

By default, the frame is not connected to any parent frame, and its transform is an identity transform.

◆ OffsetFrame() [2/4]

template<class C>
OpenSim::OffsetFrame< C >::OffsetFrame ( const C &  parent,
const SimTK::Transform &  offset 
)

A convenience constructor that initializes the parent connection and offset Transform in the parent frame.

Parameters
[in]parentThe parent reference frame.
[in]offsetThe offset transform between this frame and its parent

◆ OffsetFrame() [3/4]

template<class C>
OpenSim::OffsetFrame< C >::OffsetFrame ( const std::string &  name,
const C &  parent,
const SimTK::Transform &  offset 
)

A convenience constructor that initializes the parent connection by name and of the offset Transform in the parent frame.

Parameters
[in]nameThe name of this OffsetFrame.
[in]parentThe parent reference frame.
[in]offsetThe offset Transform between this frame and its parent

◆ OffsetFrame() [4/4]

template<class C>
OpenSim::OffsetFrame< C >::OffsetFrame ( const std::string &  name,
const std::string &  parentName,
const SimTK::Transform &  offset 
)

A convenience constructor that initializes the parent connection by name and of the offset Transform in the parent frame.

Parameters
[in]nameThe name of this OffsetFrame.
[in]parentNameThe name of the parent reference Frame.
[in]offsetThe offset Transform between this frame and its parent

Member Function Documentation

◆ assign()

template<class C = Frame>
void OpenSim::OffsetFrame< C >::assign ( Object aObject)
inlineoverride

This allows copy assignment in the Java GUI.

Exceptions
Exceptionif the argument is not of type OffsetFrame.

◆ calcAccelerationInGround()

template<class C >
SimTK::SpatialVec OpenSim::OffsetFrame< C >::calcAccelerationInGround ( const SimTK::State &  state) const
finaloverrideprotected

◆ calcTransformInGround()

template<class C >
SimTK::Transform OpenSim::OffsetFrame< C >::calcTransformInGround ( const SimTK::State &  state) const
finaloverrideprotected

◆ calcVelocityInGround()

template<class C >
SimTK::SpatialVec OpenSim::OffsetFrame< C >::calcVelocityInGround ( const SimTK::State &  state) const
finaloverrideprotected

◆ clone()

template<class C = Frame>
OffsetFrame* OpenSim::OffsetFrame< C >::clone ( ) const
overridepure virtual

◆ connectSocket_parent()

template<class C = Frame>
void OpenSim::OffsetFrame< C >::connectSocket_parent ( const Object object)
inline

Connect the 'parent' Socket to an object of type C.

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.

◆ extendConnectToModel()

template<class C >
void OpenSim::OffsetFrame< C >::extendConnectToModel ( Model model)
overrideprotected

◆ extendFinalizeFromProperties()

template<class C >
void OpenSim::OffsetFrame< C >::extendFinalizeFromProperties ( )
overrideprotected

◆ extendFindBaseFrame()

template<class C >
const Frame & OpenSim::OffsetFrame< C >::extendFindBaseFrame ( ) const
finaloverrideprotected

Extend how OffsetFrame determines its base Frame.

◆ extendFindTransformInBaseFrame()

template<class C >
SimTK::Transform OpenSim::OffsetFrame< C >::extendFindTransformInBaseFrame ( ) const
finaloverrideprotected

Extend how OffsetFrame determines its transform in its base Frame.

◆ extendScale()

template<class C >
void OpenSim::OffsetFrame< C >::extendScale ( const SimTK::State &  s,
const ScaleSet scaleSet 
)
inlineoverride

Scale the offset given scale factors for spatial (XYZ) dimensions.

◆ get_orientation()

template<class C = Frame>
const SimTK::Vec3& OpenSim::OffsetFrame< C >::get_orientation ( ) const
inline

Get the value of the orientation property.

◆ get_translation()

template<class C = Frame>
const SimTK::Vec3& OpenSim::OffsetFrame< C >::get_translation ( ) const
inline

Get the value of the translation property.

◆ getClassName()

template<class C = Frame>
static const std::string& OpenSim::OffsetFrame< C >::getClassName ( )
inlinestatic

This returns "OffsetFrame_<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.

◆ getConcreteClassName()

template<class C = Frame>
const std::string& OpenSim::OffsetFrame< C >::getConcreteClassName ( ) const
overridepure virtual

◆ getOffsetTransform()

template<class C >
const SimTK::Transform & OpenSim::OffsetFrame< C >::getOffsetTransform ( ) const

Get the transform that describes the translational and rotational offset of this frame (F frame) relative to its parent frame (B frame).

This method returns the transform converting quantities expressed in F frame to quantities expressed in the B frame. This is mathematically stated as, vec_P = X_BF*vec_F , where X_BF is the transform returned by getTransform.

This transform is computed using the translation and orientation properties of this object.

Returns
offset The transform between this frame and its parent frame.

◆ getParentFrame()

template<class C >
const C & OpenSim::OffsetFrame< C >::getParentFrame ( ) const

Get the parent reference frame.

◆ safeDownCast()

template<class C = Frame>
static OffsetFrame* OpenSim::OffsetFrame< C >::safeDownCast ( OpenSim::Object obj)
inlinestatic

For use in MATLAB and Python to access the concrete class.

Example: cObj = OffsetFrame.safeDownCast(obj). This is equivalent to dynamic_cast<OffsetFrame*>(obj) in C++.

◆ set_orientation()

template<class C = Frame>
void OpenSim::OffsetFrame< C >::set_orientation ( const SimTK::Vec3 &  value)
inline

Set the value of the orientation property.

◆ set_translation()

template<class C = Frame>
void OpenSim::OffsetFrame< C >::set_translation ( const SimTK::Vec3 &  value)
inline

Set the value of the translation property.

◆ setOffsetTransform()

template<class C >
void OpenSim::OffsetFrame< C >::setOffsetTransform ( const SimTK::Transform &  offset)

Sets the transform the translates and rotates this frame (F frame) from its parent frame (P frame).

You should provide the transform X_PF such that vec_P = X_PF*vec_F.

This transform is stored via the translation and orientation properties of this object.

Parameters
offsetThe transform between this frame and its parent frame.

◆ setParentFrame()

template<class C>
void OpenSim::OffsetFrame< C >::setParentFrame ( const C &  parent)

Sets the parent reference frame.

◆ upd_orientation()

template<class C = Frame>
SimTK::Vec3& OpenSim::OffsetFrame< C >::upd_orientation ( )
inline

Get a writable reference to the orientation property.

◆ upd_translation()

template<class C = Frame>
SimTK::Vec3& OpenSim::OffsetFrame< C >::upd_translation ( )
inline

Get a writable reference to the translation property.

OpenSim Property, Socket, Output, Input Documentation

◆ orientation

template<class C = Frame>
SimTK::Vec3 OpenSim::OffsetFrame< C >::orientation

"Orientation offset (in radians) of this frame in its parent frame, " "expressed as a frame-fixed x-y-z rotation sequence."

This property appears in XML files under the tag <orientation>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_orientation(), upd_orientation(), set_orientation()

◆ parent

template<class C = Frame>
C OpenSim::OffsetFrame< C >::parent

"The parent frame to this frame."

In an XML file, you can set this Socket's connectee path via the <socket_parent > element. This socket was generated with the OpenSim_DECLARE_SOCKET macro; see AbstractSocket for more information.

See also
connectSocket_parent()

◆ translation

template<class C = Frame>
SimTK::Vec3 OpenSim::OffsetFrame< C >::translation

"Translational offset (in meters) of this frame's origin from the parent " "frame's origin, expressed in the parent frame."

This property appears in XML files under the tag <translation>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_translation(), upd_translation(), set_translation()

The documentation for this class was generated from the following file: