Drake
RigidBody< T > Class Template Reference

Detailed Description

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

The term rigid body implies that the deformations of the body under consideration are so small that they have no significant effect on the overall motions of the body and therefore deformations can be neglected.

If deformations are neglected, the distance between any two points on the rigid body remains constant at all times. This invariance of the distance between two arbitrary points is often taken as the definition of a rigid body in classical treatments of multibody mechanics [Goldstein 2001]. It can be demonstrated that the unconstrained three-dimensional motions of a rigid body can be described by six coordinates and thus it is often said that a free body in space has six degrees of freedom. These degrees of freedom obey the Newton-Euler equations of motion. However, within a MultibodyTree, a RigidBody is not free in space; instead, it is assigned a limited number of degrees of freedom (0-6) with respect to its parent body in the multibody tree by its Mobilizer (also called a "tree joint" or "inboard joint"). Additional constraints on permissible motion can be added using Constraint objects to remove more degrees of freedom.

• [Goldstein 2001] H Goldstein, CP Poole, JL Safko, Classical Mechanics (3rd Edition), Addison-Wesley, 2001.
Template Parameters
 T The scalar type, which must be one of the default scalars.

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

Public Member Functions

RigidBody (const SpatialInertia< double > &M_BBo_B)
Constructs a RigidBody with the given default SpatialInertia. More...

RigidBody (const std::string &body_name, const SpatialInertia< double > &M_BBo_B)
Constructs a RigidBody named body_name with the given default SpatialInertia. More...

RigidBody (const std::string &body_name, ModelInstanceIndex model_instance, const SpatialInertia< double > &M_BBo_B)
Constructs a RigidBody named body_name with the given default SpatialInertia. More...

int get_num_flexible_positions () const final
There are no flexible degrees of freedom associated with a rigid body and therefore this method returns zero. More...

int get_num_flexible_velocities () const final
There are no flexible degrees of freedom associated with a rigid body and therefore this method returns zero. More...

double default_mass () const
Returns the default value of this body's mass. More...

const Vector3< double > & default_com () const
Returns the default value of this rigid body's center of mass as measured and expressed in this body's frame. More...

const UnitInertia< double > & default_unit_inertia () const
Returns the default value of this body B's unit inertia about Bo (body B's origin), expressed in B (this body's frame). More...

RotationalInertia< double > default_rotational_inertia () const
Gets the default value of this body B's rotational inertia about Bo (B's origin), expressed in B (this body's frame). More...

const SpatialInertia< double > & default_spatial_inertia () const
Gets the default value of this body B's spatial inertia about Bo (B's origin) and expressed in B (this body's frame). More...

const T & get_mass (const systems::Context< T > &context) const final
Gets the mass stored in context. More...

const Vector3< T > CalcCenterOfMassInBodyFrame (const systems::Context< T > &context) const final
Gets the center of mass stored in context. More...

Vector3< T > CalcCenterOfMassTranslationalVelocityInWorld (const systems::Context< T > &context) const override
Calculates Bcm's translational velocity in the world frame W. More...

SpatialInertia< T > CalcSpatialInertiaInBodyFrame (const systems::Context< T > &context) const override
Gets the spatial inertia stored in context. More...

void SetMass (systems::Context< T > *context, const T &mass) const
Sets the mass stored in context to mass. More...

void SetCenterOfMassInBodyFrame (systems::Context< T > *context, const Vector3< T > &com) const
Sets the center of mass stored in context to center_of_mass. More...

void SetSpatialInertiaInBodyFrame (systems::Context< T > *context, const SpatialInertia< T > &M_Bo_B) const
Sets the spatial inertia stored in context to M_Bo_B. More...

Does not allow copy, move, or assignment
RigidBody (const RigidBody &)=delete

RigidBodyoperator= (const RigidBody &)=delete

RigidBody (RigidBody &&)=delete

RigidBodyoperator= (RigidBody &&)=delete

Methods to access position kinematics quantities.

The input PositionKinematicsCache to these methods must be in sync with context.

These method's APIs will be deprecated when caching arrives.

const math::RigidTransform< T > & get_pose_in_world (const internal::PositionKinematicsCache< T > &pc) const
(Advanced) Extract this body's pose in world (from the position kinematics). More...

const math::RotationMatrix< T > get_rotation_matrix_in_world (const internal::PositionKinematicsCache< T > &pc) const
(Advanced) Extract the rotation matrix relating the world frame to this body's frame. More...

const Vector3< T > get_origin_position_in_world (const internal::PositionKinematicsCache< T > &pc) const
(Advanced) Extract the position vector from world origin to this body's origin, expressed in world. More...

Methods to access velocity kinematics quantities.

The input VelocityKinematicsCache to these methods must be in sync with context.

These method's APIs will be deprecated when caching arrives.

const SpatialVelocity< T > & get_spatial_velocity_in_world (const internal::VelocityKinematicsCache< T > &vc) const
(Advanced) Returns V_WB, this rigid body B's spatial velocity in the world frame W. More...

const Vector3< T > & get_angular_velocity_in_world (const internal::VelocityKinematicsCache< T > &vc) const
(Advanced) Extract this body angular velocity in world, expressed in world. More...

const Vector3< T > & get_origin_velocity_in_world (const internal::VelocityKinematicsCache< T > &vc) const
(Advanced) Extract the velocity of this body's origin in world, expressed in world. More...

Methods to access acceleration kinematics quantities.

The input AccelerationKinematicsCache to these methods must be in sync with context.

These method APIs will be deprecated when caching arrives.

const SpatialAcceleration< T > & get_spatial_acceleration_in_world (const internal::AccelerationKinematicsCache< T > &ac) const
(Advanced) Returns A_WB, this rigid body B's spatial acceleration in the world frame W. More...

const Vector3< T > & get_angular_acceleration_in_world (const internal::AccelerationKinematicsCache< T > &ac) const
(Advanced) Extract this body's angular acceleration in world, expressed in world. More...

const Vector3< T > & get_origin_acceleration_in_world (const internal::AccelerationKinematicsCache< T > &ac) const
(Advanced) Extract acceleration of this body's origin in world, expressed in world. More...

Public Member Functions inherited from Body< T >
Body (const std::string &name, ModelInstanceIndex model_instance, double default_mass)
Creates a Body named name in model instance model_instance with a given default_mass and a BodyFrame associated with it. More...

const std::string & name () const
Gets the name associated with this body. More...

const BodyFrame< T > & body_frame () const
Returns a const reference to the associated BodyFrame. More...

void Lock (systems::Context< T > *context) const
For a floating body, lock its implicit inboard joint. More...

void Unlock (systems::Context< T > *context) const
For a floating body, unlock its implicit inboard joint. More...

bool is_locked (const systems::Context< T > &context) const

internal::BodyNodeIndex node_index () const
(Advanced) Returns the index of the node in the underlying tree structure of the parent MultibodyTree to which this body belongs. More...

bool is_floating () const
(Advanced) Returns true if this body is granted 6-dofs by a Mobilizer. More...

bool has_quaternion_dofs () const
(Advanced) If true, this body is a floating body modeled with a quaternion floating mobilizer. More...

int floating_positions_start () const
(Advanced) For floating bodies (see is_floating()) this method returns the index of the first generalized position in the state vector for a MultibodyPlant model. More...

int floating_velocities_start () const
(Advanced) For floating bodies (see is_floating()) this method returns the index of the first generalized velocity in the state vector for a MultibodyPlant model. More...

double get_default_mass () const
Returns the default mass (not Context dependent) for this body. More...

const math::RigidTransform< T > & EvalPoseInWorld (const systems::Context< T > &context) const
Returns the pose X_WB of this body B in the world frame W as a function of the state of the model stored in context. More...

const SpatialVelocity< T > & EvalSpatialVelocityInWorld (const systems::Context< T > &context) const
Evaluates V_WB, this body B's spatial velocity in the world frame W. More...

const SpatialAcceleration< T > & EvalSpatialAccelerationInWorld (const systems::Context< T > &context) const
Evaluates A_WB, this body B's spatial acceleration in the world frame W. More...

const SpatialForce< T > & GetForceInWorld (const systems::Context< T > &, const MultibodyForces< T > &forces) const
Gets the sptatial force on this body B from forces as F_BBo_W: applied at body B's origin Bo and expressed in world frame W. More...

void AddInForceInWorld (const systems::Context< T > &, const SpatialForce< T > &F_Bo_W, MultibodyForces< T > *forces) const
Adds the spatial force on this body B, applied at body B's origin Bo and expressed in the world frame W into forces. More...

void AddInForce (const systems::Context< T > &context, const Vector3< T > &p_BP_E, const SpatialForce< T > &F_Bp_E, const Frame< T > &frame_E, MultibodyForces< T > *forces) const
Adds the spatial force on this body B, applied at point P and expressed in a frame E into forces. More...

template<typename ToScalar >
std::unique_ptr< Body< ToScalar > > CloneToScalar (const internal::MultibodyTree< ToScalar > &tree_clone) const
NVI (Non-Virtual Interface) to DoCloneToScalar() templated on the scalar type of the new clone to be created. More...

Body (const Body &)=delete

Bodyoperator= (const Body &)=delete

Body (Body &&)=delete

Bodyoperator= (Body &&)=delete

Public Member Functions inherited from MultibodyElement< Body, T, BodyIndex >
virtual ~MultibodyElement ()

BodyIndex index () const
Returns this element's unique index. More...

ModelInstanceIndex model_instance () const
Returns the ModelInstanceIndex of the model instance to which this element belongs. More...

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

MultibodyElement (const MultibodyElement &)=delete

MultibodyElement (MultibodyElement &&)=delete

MultibodyElementoperator= (const MultibodyElement &)=delete

MultibodyElementoperator= (MultibodyElement &&)=delete

Protected Member Functions

std::unique_ptr< Body< double > > DoCloneToScalar (const internal::MultibodyTree< double > &tree_clone) const final
Clones this Body (templated on T) to a body templated on double. More...

std::unique_ptr< Body< AutoDiffXd > > DoCloneToScalar (const internal::MultibodyTree< AutoDiffXd > &tree_clone) const final
Clones this Body (templated on T) to a body templated on AutoDiffXd. More...

std::unique_ptr< Body< symbolic::Expression > > DoCloneToScalar (const internal::MultibodyTree< symbolic::Expression > &tree_clone) const final
Clones this Body (templated on T) to a body templated on Expression. More...

void DoDeclareParameters (internal::MultibodyTreeSystem< T > *tree_system) override
Implementation of the NVI DeclareParameters(). More...

Methods to make a clone templated on different scalar types.

These methods are meant to be called by MultibodyTree::CloneToScalar() when making a clone of the entire tree or a new instance templated on a different scalar type.

The only const argument to these methods is the new MultibodyTree clone under construction. Specific Body subclasses might specify a number of prerequisites on the cloned tree and therefore require it to be at a given state of cloning (for instance requiring that the cloned tree already contains all the frames in the world as in the original tree.) See MultibodyTree::CloneToScalar() for a list of prerequisites that are guaranteed to be satisfied during the cloning process.

Protected Member Functions inherited from MultibodyElement< Body, T, BodyIndex >
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...

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

◆ RigidBody() [1/5]

 RigidBody ( const RigidBody< T > & )
delete

◆ RigidBody() [2/5]

 RigidBody ( RigidBody< T > && )
delete

◆ RigidBody() [3/5]

 RigidBody ( const SpatialInertia< double > & M_BBo_B )
explicit

Constructs a RigidBody with the given default SpatialInertia.

Parameters
 [in] M_BBo_B Spatial inertia of this body B about the frame's origin Bo and expressed in the body frame B.
Note
See Spatial Mass Matrix (Spatial Inertia) for details on the monogram notation used for spatial inertia quantities.

◆ RigidBody() [4/5]

 RigidBody ( const std::string & body_name, const SpatialInertia< double > & M_BBo_B )

Constructs a RigidBody named body_name with the given default SpatialInertia.

Parameters
 [in] body_name A name associated with this body. [in] M_BBo_B Spatial inertia of this body B about the frame's origin Bo and expressed in the body frame B.
Note
See Spatial Mass Matrix (Spatial Inertia) for details on the monogram notation used for spatial inertia quantities.

◆ RigidBody() [5/5]

 RigidBody ( const std::string & body_name, ModelInstanceIndex model_instance, const SpatialInertia< double > & M_BBo_B )

Constructs a RigidBody named body_name with the given default SpatialInertia.

Parameters
 [in] body_name A name associated with this body. [in] model_instance The model instance associated with this body. [in] M_BBo_B Spatial inertia of this body B about the frame's origin Bo and expressed in the body frame B.
Note
See Spatial Mass Matrix (Spatial Inertia) for details on the monogram notation used for spatial inertia quantities.

◆ CalcCenterOfMassInBodyFrame()

 const Vector3 CalcCenterOfMassInBodyFrame ( const systems::Context< T > & context ) const
finalvirtual

Gets the center of mass stored in context.

Exceptions
 std::exception if this RigidBody is not owned by a MultibodyPlant

Implements Body< T >.

◆ CalcCenterOfMassTranslationalVelocityInWorld()

 Vector3 CalcCenterOfMassTranslationalVelocityInWorld ( const systems::Context< T > & context ) const
overridevirtual

Calculates Bcm's translational velocity in the world frame W.

Parameters
 [in] context The context contains the state of the model.
Return values
 v_WBcm_W The translational velocity of Bcm (this rigid body's center of mass) in the world frame W, expressed in W.

Implements Body< T >.

◆ CalcSpatialInertiaInBodyFrame()

 SpatialInertia CalcSpatialInertiaInBodyFrame ( const systems::Context< T > & context ) const
overridevirtual

Gets the spatial inertia stored in context.

Exceptions
 std::exception if this RigidBody is not owned by a MultibodyPlant.

Implements Body< T >.

◆ default_com()

 const Vector3& default_com ( ) const

Returns the default value of this rigid body's center of mass as measured and expressed in this body's frame.

This value is initially supplied at construction when specifying this body's SpatialInertia.

Return values
 p_BoBcm_B The position of this rigid body B's center of mass Bcm measured from Bo (B's frame origin) and expressed in B (body B's frame).

◆ default_mass()

 double default_mass ( ) const

Returns the default value of this body's mass.

This value is initially supplied at construction when specifying this body's SpatialInertia.

Returns
This body's default mass.

◆ default_rotational_inertia()

 RotationalInertia default_rotational_inertia ( ) const

Gets the default value of this body B's rotational inertia about Bo (B's origin), expressed in B (this body's frame).

This value is calculated from the SpatialInertia supplied at construction of this body.

Return values
 I_BBo_B body B's rotational inertia about Bo, expressed in B.

◆ default_spatial_inertia()

 const SpatialInertia& default_spatial_inertia ( ) const

Gets the default value of this body B's spatial inertia about Bo (B's origin) and expressed in B (this body's frame).

Return values
 M_BBo_B body B's spatial inertia about Bo, expressed in B.

◆ default_unit_inertia()

 const UnitInertia& default_unit_inertia ( ) const

Returns the default value of this body B's unit inertia about Bo (body B's origin), expressed in B (this body's frame).

This value is initially supplied at construction when specifying this body's SpatialInertia.

Return values
 G_BBo_B rigid body B's unit inertia about Bo, expressed in B.

◆ DoCloneToScalar() [1/3]

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

Clones this Body (templated on T) to a body templated on double.

Implements Body< T >.

◆ DoCloneToScalar() [2/3]

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

Clones this Body (templated on T) to a body templated on AutoDiffXd.

Implements Body< T >.

◆ DoCloneToScalar() [3/3]

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

Clones this Body (templated on T) to a body templated on Expression.

Implements Body< T >.

◆ DoDeclareParameters()

 void DoDeclareParameters ( internal::MultibodyTreeSystem< T > * )
overrideprotectedvirtual

Implementation of the NVI DeclareParameters().

MultibodyElement-derived objects must override to declare their specific parameters. If an object is not a direct descendent of MultibodyElement, it must invoke its parent classes' DoDeclareParameters() before declaring its own parameters.

Reimplemented from Body< T >.

◆ get_angular_acceleration_in_world()

 const Vector3& get_angular_acceleration_in_world ( const internal::AccelerationKinematicsCache< T > & ac ) const

(Advanced) Extract this body's angular acceleration in world, expressed in world.

Parameters
 [in] ac velocity kinematics cache.
Return values
 alpha_WB_W B's angular acceleration in world W, expressed in W.

◆ get_angular_velocity_in_world()

 const Vector3& get_angular_velocity_in_world ( const internal::VelocityKinematicsCache< T > & vc ) const

(Advanced) Extract this body angular velocity in world, expressed in world.

Parameters
 [in] vc velocity kinematics cache.
Return values
 w_WB_W rigid body B's angular velocity in world W, expressed in W.

◆ get_mass()

 const T& get_mass ( const systems::Context< T > & context ) const
finalvirtual

Gets the mass stored in context.

Exceptions
 std::exception if this RigidBody is not owned by a MultibodyPlant

Implements Body< T >.

◆ get_num_flexible_positions()

 int get_num_flexible_positions ( ) const
finalvirtual

There are no flexible degrees of freedom associated with a rigid body and therefore this method returns zero.

By definition, a rigid body has no state associated with flexible deformations.

Implements Body< T >.

◆ get_num_flexible_velocities()

 int get_num_flexible_velocities ( ) const
finalvirtual

There are no flexible degrees of freedom associated with a rigid body and therefore this method returns zero.

By definition, a rigid body has no state associated with flexible deformations.

Implements Body< T >.

◆ get_origin_acceleration_in_world()

 const Vector3& get_origin_acceleration_in_world ( const internal::AccelerationKinematicsCache< T > & ac ) const

(Advanced) Extract acceleration of this body's origin in world, expressed in world.

Parameters
 [in] vc velocity kinematics cache.
Return values
 a_WBo_W acceleration of body origin Bo in world W, expressed in W.

◆ get_origin_position_in_world()

 const Vector3 get_origin_position_in_world ( const internal::PositionKinematicsCache< T > & pc ) const

(Advanced) Extract the position vector from world origin to this body's origin, expressed in world.

Parameters
 [in] pc position kinematics cache.
Return values
 p_WoBo_W position vector from Wo (world origin) to Bo (this body's origin) expressed in W (world).

◆ get_origin_velocity_in_world()

 const Vector3& get_origin_velocity_in_world ( const internal::VelocityKinematicsCache< T > & vc ) const

(Advanced) Extract the velocity of this body's origin in world, expressed in world.

Parameters
 [in] vc velocity kinematics cache.
Return values
 v_WBo_W velocity of Bo (body origin) in world W, expressed in W.

◆ get_pose_in_world()

 const math::RigidTransform& get_pose_in_world ( const internal::PositionKinematicsCache< T > & pc ) const

(Advanced) Extract this body's pose in world (from the position kinematics).

Parameters
 [in] pc position kinematics cache.
Return values
 X_WB pose of rigid body B in world frame W.

◆ get_rotation_matrix_in_world()

 const math::RotationMatrix get_rotation_matrix_in_world ( const internal::PositionKinematicsCache< T > & pc ) const

(Advanced) Extract the rotation matrix relating the world frame to this body's frame.

Parameters
 [in] pc position kinematics cache.
Return values
 R_WB rotation matrix relating rigid body B in world frame W.

◆ get_spatial_acceleration_in_world()

 const SpatialAcceleration& get_spatial_acceleration_in_world ( const internal::AccelerationKinematicsCache< T > & ac ) const

(Advanced) Returns A_WB, this rigid body B's spatial acceleration in the world frame W.

Parameters
 [in] ac acceleration kinematics cache.
Return values
 A_WB_W this rigid body B's spatial acceleration in the world frame W, expressed in W (for point Bo, the body frame's origin).

◆ get_spatial_velocity_in_world()

 const SpatialVelocity& get_spatial_velocity_in_world ( const internal::VelocityKinematicsCache< T > & vc ) const

(Advanced) Returns V_WB, this rigid body B's spatial velocity in the world frame W.

Parameters
 [in] vc velocity kinematics cache.
Return values
 V_WB_W this rigid body B's spatial velocity in the world frame W, expressed in W (for point Bo, the body frame's origin).

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ SetCenterOfMassInBodyFrame()

 void SetCenterOfMassInBodyFrame ( systems::Context< T > * context, const Vector3< T > & com ) const

Sets the center of mass stored in context to center_of_mass.

Exceptions
 std::exception if this RigidBody is not owned by a MultibodyPlant

◆ SetMass()

 void SetMass ( systems::Context< T > * context, const T & mass ) const

Sets the mass stored in context to mass.

Exceptions
 std::exception if this RigidBody is not owned by a MultibodyPlant

◆ SetSpatialInertiaInBodyFrame()

 void SetSpatialInertiaInBodyFrame ( systems::Context< T > * context, const SpatialInertia< T > & M_Bo_B ) const

Sets the spatial inertia stored in context to M_Bo_B.

Exceptions
 std::exception if this RigidBody is not owned by a MultibodyPlant

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