Drake
Drake C++ Documentation
RigidBodyFrame< T > Class Template Reference

Detailed Description

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

A RigidBodyFrame is a material Frame that serves as the unique reference frame for a RigidBody.

Each RigidBody B has a unique body frame for which we use the same symbol B (with meaning clear from context). We represent a body frame by a RigidBodyFrame object that is created whenever a RigidBody is constructed and is owned by the RigidBody. All properties of a RigidBody are defined with respect to its RigidBodyFrame, including its mass properties and attachment locations for joints, constraints, actuators, geometry and so on. Run time motion of the body is defined with respect to the motion of its body frame.

Note that the body frame associated with a rigid body does not necessarily need to be located at its center of mass nor does it need to be aligned with the body's principal axes, although, in practice, it frequently is.

A RigidBodyFrame and RigidBody are tightly coupled concepts; neither makes sense without the other. Therefore, a RigidBodyFrame instance is constructed in conjunction with its RigidBody and cannot be constructed anywhere else. However, you can still access the frame associated with a body, see RigidBody::body_frame(). This access is more than a convenience; you can use the RigidBodyFrame to define other frames on the body and to attach other multibody elements to it.

Template Parameters
TThe scalar type, which must be one of the default scalars.

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

Public Member Functions

math::RigidTransform< T > CalcPoseInBodyFrame (const systems::Context< T > &) const override
 Returns the pose X_BF of this frame F in the body frame B associated with this frame. More...
 
math::RotationMatrix< T > CalcRotationMatrixInBodyFrame (const systems::Context< T > &) const override
 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). More...
 
math::RigidTransform< T > CalcOffsetPoseInBody (const systems::Context< T > &, const math::RigidTransform< T > &X_FQ) const override
 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. More...
 
math::RotationMatrix< T > CalcOffsetRotationMatrixInBody (const systems::Context< T > &, const math::RotationMatrix< T > &R_FQ) const override
 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). More...
 
math::RigidTransform< T > GetFixedPoseInBodyFrame () const override
 Variant of CalcPoseInBodyFrame() that returns the fixed pose X_BF of this frame F in the body frame B associated with this frame. More...
 
math::RotationMatrix< T > GetFixedRotationMatrixInBodyFrame () const override
 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). More...
 
math::RigidTransform< T > GetFixedOffsetPoseInBody (const math::RigidTransform< T > &X_FQ) const override
 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. More...
 
math::RotationMatrix< T > GetFixedRotationMatrixInBody (const math::RotationMatrix< T > &R_FQ) const override
 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). More...
 
Does not allow copy, move, or assignment
 RigidBodyFrame (const RigidBodyFrame &)=delete
 
RigidBodyFrameoperator= (const RigidBodyFrame &)=delete
 
 RigidBodyFrame (RigidBodyFrame &&)=delete
 
RigidBodyFrameoperator= (RigidBodyFrame &&)=delete
 
- Public Member Functions inherited from Frame< T >
const RigidBody< T > & body () const
 Returns a const reference to the body associated to this Frame. More...
 
bool is_world_frame () const
 Returns true if this is the world frame. More...
 
bool is_body_frame () const
 Returns true if this is the body frame. More...
 
const std::string & name () const
 Returns the name of this frame. The name will never be empty. More...
 
ScopedName scoped_name () const
 Returns scoped name of this frame. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
SpatialVelocity< T > CalcSpatialVelocityInWorld (const systems::Context< T > &context) const
 Calculates this frame F's spatial velocity measured and expressed in the world frame W. More...
 
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. More...
 
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. More...
 
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. More...
 
SpatialAcceleration< T > CalcSpatialAccelerationInWorld (const systems::Context< T > &context) const
 Calculates this frame F's spatial acceleration measured and expressed in the world frame W. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
 Frame (const Frame &)=delete
 
Frameoperator= (const Frame &)=delete
 
 Frame (Frame &&)=delete
 
Frameoperator= (Frame &&)=delete
 
- Public Member Functions inherited from FrameBase< T >
FrameIndex index () const
 Returns this element's unique index. More...
 
- 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. More...
 
template<typename MultibodyPlantDeferred = MultibodyPlant<T>>
const MultibodyPlantDeferred & GetParentPlant () const
 Returns the MultibodyPlant that owns this MultibodyElement. More...
 
void DeclareParameters (internal::MultibodyTreeSystem< T > *tree_system)
 Declares MultibodyTreeSystem Parameters at MultibodyTreeSystem::Finalize() time. More...
 
void SetDefaultParameters (systems::Parameters< T > *parameters) const
 Sets default values of parameters belonging to each MultibodyElement in parameters at a call to MultibodyTreeSystem::SetDefaultParameters(). More...
 
 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
 Clones this Frame (templated on T) to a frame templated on double. More...
 
std::unique_ptr< Frame< AutoDiffXd > > DoCloneToScalar (const internal::MultibodyTree< AutoDiffXd > &tree_clone) const override
 Clones this Frame (templated on T) to a frame templated on AutoDiffXd. More...
 
std::unique_ptr< Frame< symbolic::Expression > > DoCloneToScalar (const internal::MultibodyTree< symbolic::Expression > &) const override
 
- Protected Member Functions inherited from Frame< T >
 Frame (const std::string &name, const RigidBody< T > &body, std::optional< ModelInstanceIndex > model_instance={})
 Only derived classes can use this constructor. More...
 
virtual void DoDeclareFrameParameters (internal::MultibodyTreeSystem< T > *)
 Called by DoDeclareParameters(). More...
 
virtual void DoSetDefaultFrameParameters (systems::Parameters< T > *) const
 Called by DoSetDefaultParameters(). More...
 
- Protected Member Functions inherited from FrameBase< T >
 FrameBase (ModelInstanceIndex model_instance)
 
- 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. More...
 
 MultibodyElement (ModelInstanceIndex model_instance)
 Constructor which allows specifying a model instance. More...
 
 MultibodyElement (ModelInstanceIndex model_instance, int64_t index)
 Both the model instance and element index are specified. More...
 
template<typename ElementIndexType >
ElementIndexType index_impl () const
 Returns this element's unique index. More...
 
const internal::MultibodyTree< T > & get_parent_tree () const
 Returns a constant reference to the parent MultibodyTree that owns this element. More...
 
const internal::MultibodyTreeSystem< T > & GetParentTreeSystem () const
 Returns a constant reference to the parent MultibodyTreeSystem that owns the parent MultibodyTree that owns this element. More...
 
void SetTopology (const internal::MultibodyTreeTopology &tree)
 Gives MultibodyElement-derived objects the opportunity to retrieve their topology after MultibodyTree::Finalize() is invoked. More...
 
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(). More...
 
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(). More...
 

Friends

class RigidBody< T >
 
template<typename >
class RigidBodyFrame
 

Constructor & Destructor Documentation

◆ RigidBodyFrame() [1/2]

RigidBodyFrame ( const RigidBodyFrame< T > &  )
delete

◆ RigidBodyFrame() [2/2]

RigidBodyFrame ( RigidBodyFrame< T > &&  )
delete

Member Function Documentation

◆ CalcOffsetPoseInBody()

math::RigidTransform<T> CalcOffsetPoseInBody ( const systems::Context< T > &  context,
const math::RigidTransform< T > &  X_FQ 
) const
overridevirtual

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.

In other words, if the pose of this frame F in the body frame B is X_BF, this method computes the pose X_BQ of frame Q in the body frame B as X_BQ = X_BF * X_FQ. In particular, if this isthe body frame B, i.e.X_BFis the identity transformation, this method directly returnsX_FQ`. Specific frame subclasses can override this method to provide faster implementations if needed.

Reimplemented from Frame< T >.

◆ CalcOffsetRotationMatrixInBody()

math::RotationMatrix<T> CalcOffsetRotationMatrixInBody ( const systems::Context< T > &  context,
const math::RotationMatrix< T > &  R_FQ 
) const
overridevirtual

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).

Parameters
[in]R_FQrotation matrix that relates frame F to frame Q.

Reimplemented from Frame< T >.

◆ CalcPoseInBodyFrame()

math::RigidTransform<T> CalcPoseInBodyFrame ( const systems::Context< T > &  context) const
overridevirtual

Returns the pose X_BF of this frame F in the body frame B associated with this frame.

In particular, if this is the body frame B, this method directly returns the identity transformation.

Implements Frame< T >.

◆ CalcRotationMatrixInBodyFrame()

math::RotationMatrix<T> CalcRotationMatrixInBodyFrame ( const systems::Context< T > &  context) const
overridevirtual

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).

Note
If this is B, this method returns the identity RotationMatrix.

Implements Frame< T >.

◆ DoCloneToScalar() [1/3]

std::unique_ptr<Frame<double> > DoCloneToScalar ( const internal::MultibodyTree< double > &  tree_clone) const
overrideprotectedvirtual

Clones this Frame (templated on T) to a frame templated on double.

Implements Frame< T >.

◆ DoCloneToScalar() [2/3]

std::unique_ptr<Frame<AutoDiffXd> > DoCloneToScalar ( const internal::MultibodyTree< AutoDiffXd > &  tree_clone) const
overrideprotectedvirtual

Clones this Frame (templated on T) to a frame templated on AutoDiffXd.

Implements Frame< T >.

◆ DoCloneToScalar() [3/3]

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

Implements Frame< T >.

◆ GetFixedOffsetPoseInBody()

math::RigidTransform<T> GetFixedOffsetPoseInBody ( const math::RigidTransform< T > &  X_FQ) const
overridevirtual

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.

Exceptions
std::exceptionif called on a Frame that does not have a fixed offset in the body frame.

Reimplemented from Frame< T >.

◆ GetFixedPoseInBodyFrame()

math::RigidTransform<T> GetFixedPoseInBodyFrame ( ) const
overridevirtual

Variant of CalcPoseInBodyFrame() that returns the fixed pose X_BF of this frame F in the body frame B associated with this frame.

Exceptions
std::exceptionif called on a Frame that does not have a fixed offset in the body frame.

Reimplemented from Frame< T >.

◆ GetFixedRotationMatrixInBody()

math::RotationMatrix<T> GetFixedRotationMatrixInBody ( const math::RotationMatrix< T > &  R_FQ) const
overridevirtual

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).

Parameters
[in]R_FQrotation matrix that relates frame F to frame Q.
Exceptions
std::exceptionif this frame F is a Frame that does not have a fixed offset in the body frame B (i.e., R_BF is not constant).

Reimplemented from Frame< T >.

◆ GetFixedRotationMatrixInBodyFrame()

math::RotationMatrix<T> GetFixedRotationMatrixInBodyFrame ( ) const
overridevirtual

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).

Exceptions
std::exceptionif this frame F is a Frame that does not have a fixed offset in the body frame B (i.e., R_BF is not constant). Frame sub-classes that have a constant R_BF must override this method. An example of a frame sub-class not implementing this method would be that of a frame on a soft body, for which its pose in the body frame depends on the state of deformation of the body.

Reimplemented from Frame< T >.

◆ operator=() [1/2]

RigidBodyFrame& operator= ( const RigidBodyFrame< T > &  )
delete

◆ operator=() [2/2]

RigidBodyFrame& operator= ( RigidBodyFrame< T > &&  )
delete

Friends And Related Function Documentation

◆ RigidBody< T >

friend class RigidBody< T >
friend

◆ RigidBodyFrame

friend class RigidBodyFrame
friend

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