Drake
Drake C++ Documentation
Loading...
Searching...
No Matches
FixedOffsetFrame< T > Class Template Referencefinal

Detailed Description

template<typename T>
class drake::multibody::FixedOffsetFrame< T >

FixedOffsetFrame represents a material frame F whose pose is fixed with respect to a parent material frame P.

The pose offset is given by a spatial transform X_PF, which is constant after construction. For instance, we could rigidly attach a frame F to move with a rigid body B at a fixed pose X_BF, where B is the RigidBodyFrame associated with body B. Thus, the World frame pose X_WF of a FixedOffsetFrame F depends only on the World frame pose X_WP of its parent P, and the constant pose X_PF, with X_WF=X_WP*X_PF.

For more information about spatial transforms, see Spatial Pose and Transform.

@tparam T The scalar type, which must be one of the @ref default_scalars "default scalars". 

#include <drake/multibody/tree/fixed_offset_frame.h>

Public Member Functions

 FixedOffsetFrame (const std::string &name, const Frame< T > &P, const math::RigidTransform< double > &X_PF, std::optional< ModelInstanceIndex > model_instance={})
 Creates a material Frame F whose pose is fixed with respect to its parent material Frame P.
 FixedOffsetFrame (const std::string &name, const RigidBody< T > &bodyB, const math::RigidTransform< double > &X_BF)
 Creates a material Frame F whose pose is fixed with respect to the RigidBodyFrame B of the given RigidBody, which serves as F's parent frame.
 ~FixedOffsetFrame () override
void SetPoseInParentFrame (systems::Context< T > *context, const math::RigidTransform< T > &X_PF) const
 Sets the pose of this frame F in its parent frame P.
math::RigidTransform< T > GetPoseInParentFrame (const systems::Context< T > &context) const
 Returns the rigid transform X_PF that characterizes this frame F's pose in its parent frame P.
math::RigidTransform< T > GetFixedPoseInBodyFrame () const override
math::RotationMatrix< T > GetFixedRotationMatrixInBodyFrame () const override
const Frame< T > & parent_frame () const
Does not allow copy, move, or assignment
 FixedOffsetFrame (const FixedOffsetFrame &)=delete
FixedOffsetFrameoperator= (const FixedOffsetFrame &)=delete
 FixedOffsetFrame (FixedOffsetFrame &&)=delete
FixedOffsetFrameoperator= (FixedOffsetFrame &&)=delete
Public Member Functions inherited from Frame< T >
 ~Frame () override
FrameIndex index () const
 Returns this element's unique index.
const RigidBody< T > & body () const
 Returns a const reference to the body associated to this Frame.
bool is_world_frame () const
 Returns true if this is the world frame.
bool is_body_frame () const
 Returns true if this is the body frame.
const std::string & name () const
 Returns the name of this frame. The name will never be empty.
ScopedName scoped_name () const
 Returns scoped name of this frame.
const math::RigidTransform< T > & EvalPoseInBodyFrame (const systems::Context< T > &context) const
 Returns a reference to the body-relative pose X_BF giving the pose of this Frame with respect to its body's RigidBodyFrame.
math::RigidTransform< T > CalcPoseInBodyFrame (const systems::Context< T > &context) const
 Returns the pose X_BF of this frame F in the body frame B associated with this frame.
math::RotationMatrix< T > CalcRotationMatrixInBodyFrame (const systems::Context< T > &context) const
 Returns the rotation matrix R_BF that relates body frame B to this frame F (B is the body frame to which this frame F is attached).
math::RigidTransform< T > CalcOffsetPoseInBody (const systems::Context< T > &context, const math::RigidTransform< T > &X_FQ) const
 Given the offset pose X_FQ of a frame Q in this frame F, this method computes the pose X_BQ of frame Q in the body frame B to which this frame is attached.
math::RotationMatrix< T > CalcOffsetRotationMatrixInBody (const systems::Context< T > &context, const math::RotationMatrix< T > &R_FQ) const
 Calculates and returns the rotation matrix R_BQ that relates body frame B to frame Q via this intermediate frame F, i.e., R_BQ = R_BF * R_FQ (B is the body frame to which this frame F is attached).
virtual math::RigidTransform< T > GetFixedOffsetPoseInBody (const math::RigidTransform< T > &X_FQ) const
 Variant of CalcOffsetPoseInBody() that given the offset pose X_FQ of a frame Q in this frame F, returns the pose X_BQ of frame Q in the body frame B to which this frame is attached.
virtual math::RotationMatrix< T > GetFixedRotationMatrixInBody (const math::RotationMatrix< T > &R_FQ) const
 Calculates and returns the rotation matrix R_BQ that relates body frame B to frame Q via this intermediate frame F, i.e., R_BQ = R_BF * R_FQ (B is the body frame to which this frame F is attached).
math::RigidTransform< T > CalcPoseInWorld (const systems::Context< T > &context) const
 Computes and returns the pose X_WF of this frame F in the world frame W as a function of the state of the model stored in context.
math::RigidTransform< T > CalcPose (const systems::Context< T > &context, const Frame< T > &frame_M) const
 Computes and returns the pose X_MF of this frame F in measured in frame_M as a function of the state of the model stored in context.
math::RotationMatrix< T > CalcRotationMatrix (const systems::Context< T > &context, const Frame< T > &frame_M) const
 Calculates and returns the rotation matrix R_MF that relates frame_M and this frame F as a function of the state stored in context.
math::RotationMatrix< T > CalcRotationMatrixInWorld (const systems::Context< T > &context) const
 Calculates and returns the rotation matrix R_WF that relates the world frame W and this frame F as a function of the state stored in context.
const Vector3< T > & EvalAngularVelocityInWorld (const systems::Context< T > &context) const
 Evaluates this frame F's angular velocity measured and expressed in the world frame W.
Vector3< T > CalcAngularVelocity (const systems::Context< T > &context, const Frame< T > &measured_in_frame, const Frame< T > &expressed_in_frame) const
 Calculates this frame F's angular velocity measured in a frame M, expressed in a frame E.
SpatialVelocity< T > CalcSpatialVelocityInWorld (const systems::Context< T > &context) const
 Calculates this frame F's spatial velocity measured and expressed in the world frame W.
SpatialVelocity< T > CalcSpatialVelocity (const systems::Context< T > &context, const Frame< T > &frame_M, const Frame< T > &frame_E) const
 Calculates this frame F's spatial velocity measured in a frame M, expressed in a frame E.
SpatialVelocity< T > CalcRelativeSpatialVelocityInWorld (const systems::Context< T > &context, const Frame< T > &other_frame) const
 Calculates this frame C's spatial velocity relative to another frame B, measured and expressed in the world frame W.
SpatialVelocity< T > CalcRelativeSpatialVelocity (const systems::Context< T > &context, const Frame< T > &other_frame, const Frame< T > &measured_in_frame, const Frame< T > &expressed_in_frame) const
 Calculates this frame C's spatial velocity relative to another frame B, measured in a frame M, expressed in a frame E.
SpatialAcceleration< T > CalcSpatialAccelerationInWorld (const systems::Context< T > &context) const
 Calculates this frame F's spatial acceleration measured and expressed in the world frame W.
SpatialAcceleration< T > CalcSpatialAcceleration (const systems::Context< T > &context, const Frame< T > &measured_in_frame, const Frame< T > &expressed_in_frame) const
 Calculates this frame F's spatial acceleration measured in a frame M, expressed in a frame E.
SpatialAcceleration< T > CalcRelativeSpatialAccelerationInWorld (const systems::Context< T > &context, const Frame< T > &other_frame) const
 Calculates this frame C's spatial acceleration relative to another frame B, measured and expressed in the world frame W.
SpatialAcceleration< T > CalcRelativeSpatialAcceleration (const systems::Context< T > &context, const Frame< T > &other_frame, const Frame< T > &measured_in_frame, const Frame< T > &expressed_in_frame) const
 Calculates this frame C's spatial acceleration relative to another frame B, measured in a frame M, expressed in a frame E.
template<typename ToScalar>
std::unique_ptr< Frame< ToScalar > > CloneToScalar (const internal::MultibodyTree< ToScalar > &tree_clone) const
 (Advanced) NVI to DoCloneToScalar() templated on the scalar type of the new clone to be created.
std::unique_ptr< Frame< T > > ShallowClone () const
 (Internal use only) Returns a shallow clone (i.e., dependent elements such as bodies are aliased, not copied) that is not associated with any MbT (so the assigned index, if any, is discarded).
 Frame (const Frame &)=delete
Frameoperator= (const Frame &)=delete
 Frame (Frame &&)=delete
Frameoperator= (Frame &&)=delete
void set_body_pose_index_in_cache (int body_pose_index)
 (Internal use only) A Frame's pose-in-parent X_PF can be parameterized, the parent's pose may also be parameterized, and so on.
int get_body_pose_index_in_cache () const
 (Internal use only) Retrieve this Frame's body pose index in the cache.
const math::RigidTransform< T > & get_X_BF (const internal::FrameBodyPoseCache< T > &frame_body_poses) const
 (Internal use only) Given an already up-to-date frame body pose cache, extract X_BF for this Frame from it.
const math::RigidTransform< T > & get_X_FB (const internal::FrameBodyPoseCache< T > &frame_body_poses) const
 (Internal use only) Given an already up-to-date frame body pose cache, extract X_FB (=X_BF⁻¹) for this Frame from it.
bool is_X_BF_identity (const internal::FrameBodyPoseCache< T > &frame_body_poses) const
 (Internal use only) Given an already up-to-date frame body pose cache, returns whether X_BF (and thus X_FB) is exactly identity.
Public Member Functions inherited from MultibodyElement< T >
virtual ~MultibodyElement ()
ModelInstanceIndex model_instance () const
 Returns the ModelInstanceIndex of the model instance to which this element belongs.
template<typename = void>
const MultibodyPlant< T > & GetParentPlant () const
 Returns the MultibodyPlant that owns this MultibodyElement.
void DeclareParameters (internal::MultibodyTreeSystem< T > *tree_system)
 Declares MultibodyTreeSystem Parameters at MultibodyTreeSystem::Finalize() time.
void SetDefaultParameters (systems::Parameters< T > *parameters) const
 Sets default values of parameters belonging to each MultibodyElement in parameters at a call to MultibodyTreeSystem::SetDefaultParameters().
void DeclareDiscreteState (internal::MultibodyTreeSystem< T > *tree_system)
 Declares MultibodyTreeSystem discrete states.
void DeclareCacheEntries (internal::MultibodyTreeSystem< T > *tree_system)
 (Advanced) Declares all cache entries needed by this element.
bool is_ephemeral () const
 Returns true if this MultibodyElement was added during Finalize() rather than something a user added.
void set_is_ephemeral (bool is_ephemeral)
 (Internal use only) Sets the is_ephemeral flag to the indicated value.
 MultibodyElement (const MultibodyElement &)=delete
MultibodyElementoperator= (const MultibodyElement &)=delete
 MultibodyElement (MultibodyElement &&)=delete
MultibodyElementoperator= (MultibodyElement &&)=delete

Protected Member Functions

std::unique_ptr< Frame< double > > DoCloneToScalar (const internal::MultibodyTree< double > &tree_clone) const override
std::unique_ptr< Frame< AutoDiffXd > > DoCloneToScalar (const internal::MultibodyTree< AutoDiffXd > &tree_clone) const override
std::unique_ptr< Frame< symbolic::Expression > > DoCloneToScalar (const internal::MultibodyTree< symbolic::Expression > &) const override
std::unique_ptr< Frame< T > > DoShallowClone () const override
 NVI for ShallowClone().
math::RigidTransform< T > DoCalcPoseInBodyFrame (const systems::Parameters< T > &parameters) const override
math::RotationMatrix< T > DoCalcRotationMatrixInBodyFrame (const systems::Parameters< T > &parameters) const override
Protected Member Functions inherited from Frame< T >
virtual math::RigidTransform< T > DoCalcOffsetPoseInBody (const systems::Parameters< T > &parameters, const math::RigidTransform< T > &X_FQ) const
virtual math::RotationMatrix< T > DoCalcOffsetRotationMatrixInBody (const systems::Parameters< T > &parameters, const math::RotationMatrix< T > &R_FQ) const
 Frame (const std::string &name, const RigidBody< T > &body, std::optional< ModelInstanceIndex > model_instance={})
 Only derived classes can use this constructor.
Protected Member Functions inherited from MultibodyElement< T >
 MultibodyElement ()
 Default constructor made protected so that sub-classes can still declare their default constructors if they need to.
 MultibodyElement (ModelInstanceIndex model_instance)
 Constructor which allows specifying a model instance.
 MultibodyElement (ModelInstanceIndex model_instance, int64_t index)
 Both the model instance and element index are specified.
template<typename ElementIndexType>
ElementIndexType index_impl () const
 Returns this element's unique index.
template<typename ElementOrdinalType = int64_t>
ElementOrdinalType ordinal_impl () const
 Returns this element's unique ordinal.
const internal::MultibodyTree< T > & get_parent_tree () const
 Returns a constant reference to the parent MultibodyTree that owns this element.
const internal::MultibodyTreeSystem< T > & GetParentTreeSystem () const
 Returns a constant reference to the parent MultibodyTreeSystem that owns the parent MultibodyTree that owns this element.
void SetTopology ()
 (Internal use only) Gives MultibodyElement-derived objects the opportunity to set data members that depend on topology and coordinate assignments having been finalized.
virtual void DoDeclareDiscreteState (internal::MultibodyTreeSystem< T > *)
 Implementation of the NVI DeclareDiscreteState().
virtual void DoDeclareCacheEntries (internal::MultibodyTreeSystem< T > *)
 Derived classes must override this method to declare cache entries needed by this element.
systems::NumericParameterIndex DeclareNumericParameter (internal::MultibodyTreeSystem< T > *tree_system, const systems::BasicVector< T > &model_vector)
 To be used by MultibodyElement-derived objects when declaring parameters in their implementation of DoDeclareParameters().
systems::AbstractParameterIndex DeclareAbstractParameter (internal::MultibodyTreeSystem< T > *tree_system, const AbstractValue &model_value)
 To be used by MultibodyElement-derived objects when declaring parameters in their implementation of DoDeclareParameters().
systems::DiscreteStateIndex DeclareDiscreteState (internal::MultibodyTreeSystem< T > *tree_system, const VectorX< T > &model_value)
 To be used by MultibodyElement-derived objects when declaring discrete states in their implementation of DoDeclareDiscreteStates().
systems::CacheEntryDeclareCacheEntry (internal::MultibodyTreeSystem< T > *tree_system, std::string description, systems::ValueProducer value_producer, std::set< systems::DependencyTicket > prerequisites_of_calc)
 To be used by MultibodyElement-derived objects when declaring cache entries in their implementation of DoDeclareCacheEntries().
bool has_parent_tree () const
 Returns true if this multibody element has a parent tree, otherwise false.

Constructor & Destructor Documentation

◆ FixedOffsetFrame() [1/4]

template<typename T>
FixedOffsetFrame ( const FixedOffsetFrame< T > & )
delete

◆ FixedOffsetFrame() [2/4]

template<typename T>
FixedOffsetFrame ( FixedOffsetFrame< T > && )
delete

◆ FixedOffsetFrame() [3/4]

template<typename T>
FixedOffsetFrame ( const std::string & name,
const Frame< T > & P,
const math::RigidTransform< double > & X_PF,
std::optional< ModelInstanceIndex > model_instance = {} )

Creates a material Frame F whose pose is fixed with respect to its parent material Frame P.

The pose is given by a spatial transform X_PF; see class documentation for more information.

Parameters
[in]nameThe name of this frame. Cannot be empty.
[in]PThe frame to which this frame is attached with a fixed pose.
[in]X_PFThe default transform giving the pose of F in P, therefore only the value (as a RigidTransform<double>) is provided.
[in]model_instanceThe model instance to which this frame belongs to. If unspecified, will use P.model_instance().

◆ FixedOffsetFrame() [4/4]

template<typename T>
FixedOffsetFrame ( const std::string & name,
const RigidBody< T > & bodyB,
const math::RigidTransform< double > & X_BF )

Creates a material Frame F whose pose is fixed with respect to the RigidBodyFrame B of the given RigidBody, which serves as F's parent frame.

The pose is given by a RigidTransform X_BF; see class documentation for more information.

Parameters
[in]nameThe name of this frame. Cannot be empty.
[in]bodyBThe body whose RigidBodyFrame B is to be F's parent frame.
[in]X_BFThe transform giving the pose of F in B.

◆ ~FixedOffsetFrame()

template<typename T>
~FixedOffsetFrame ( )
override

Member Function Documentation

◆ DoCalcPoseInBodyFrame()

template<typename T>
math::RigidTransform< T > DoCalcPoseInBodyFrame ( const systems::Parameters< T > & parameters) const
overrideprotectedvirtual

Implements Frame< T >.

◆ DoCalcRotationMatrixInBodyFrame()

template<typename T>
math::RotationMatrix< T > DoCalcRotationMatrixInBodyFrame ( const systems::Parameters< T > & parameters) const
overrideprotectedvirtual

Implements Frame< T >.

◆ DoCloneToScalar() [1/3]

template<typename T>
std::unique_ptr< Frame< AutoDiffXd > > DoCloneToScalar ( const internal::MultibodyTree< AutoDiffXd > & tree_clone) const
overrideprotectedvirtual
Precondition
The parent frame to this frame already has a clone in tree_clone.

Implements Frame< T >.

◆ DoCloneToScalar() [2/3]

template<typename T>
std::unique_ptr< Frame< double > > DoCloneToScalar ( const internal::MultibodyTree< double > & tree_clone) const
overrideprotectedvirtual
Precondition
The parent frame to this frame already has a clone in tree_clone.

Implements Frame< T >.

◆ DoCloneToScalar() [3/3]

template<typename T>
std::unique_ptr< Frame< symbolic::Expression > > DoCloneToScalar ( const internal::MultibodyTree< symbolic::Expression > & ) const
overrideprotectedvirtual

Implements Frame< T >.

◆ DoShallowClone()

template<typename T>
std::unique_ptr< Frame< T > > DoShallowClone ( ) const
overrideprotectedvirtual

NVI for ShallowClone().

Reimplemented from Frame< T >.

◆ GetFixedPoseInBodyFrame()

template<typename T>
math::RigidTransform< T > GetFixedPoseInBodyFrame ( ) const
overridevirtual
Returns
The default fixed pose in the body frame.

Reimplemented from Frame< T >.

◆ GetFixedRotationMatrixInBodyFrame()

template<typename T>
math::RotationMatrix< T > GetFixedRotationMatrixInBodyFrame ( ) const
overridevirtual
Returns
The default rotation matrix of this fixed pose in the body frame.

Reimplemented from Frame< T >.

◆ GetPoseInParentFrame()

template<typename T>
math::RigidTransform< T > GetPoseInParentFrame ( const systems::Context< T > & context) const

Returns the rigid transform X_PF that characterizes this frame F's pose in its parent frame P.

Parameters
[in]contextof the multibody plant associated with this frame.

◆ operator=() [1/2]

template<typename T>
FixedOffsetFrame & operator= ( const FixedOffsetFrame< T > & )
delete

◆ operator=() [2/2]

template<typename T>
FixedOffsetFrame & operator= ( FixedOffsetFrame< T > && )
delete

◆ parent_frame()

template<typename T>
const Frame< T > & parent_frame ( ) const
Returns
The parent frame to which this frame is attached.

◆ SetPoseInParentFrame()

template<typename T>
void SetPoseInParentFrame ( systems::Context< T > * context,
const math::RigidTransform< T > & X_PF ) const

Sets the pose of this frame F in its parent frame P.

Parameters
[in,out]contextof the multibody plant associated with this frame.
[in]X_PFRigid transform that characterizes this frame F's pose (orientation and position) in its parent frame P.

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