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
TThe scalar type. Must be a valid Eigen scalar.

Instantiated templates for the following kinds of T's are provided:

They are already available to link against in the containing library. No other values for T are currently supported.

#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< doubledefault_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...
 
get_mass (const systems::Context< T > &) const final
 (Advanced) Returns the mass of this body stored in context. More...
 
const Vector3< T > CalcCenterOfMassInBodyFrame (const systems::Context< T > &) const final
 (Advanced) Computes the center of mass p_BoBcm_B (or p_Bcm for short) of this body measured from this body's frame origin Bo and expressed in the body frame B. More...
 
SpatialInertia< T > CalcSpatialInertiaInBodyFrame (const systems::Context< T > &) const override
 (Advanced) Computes the SpatialInertia I_BBo_B of this body about its frame origin Bo (not necessarily its center of mass) and expressed in its body frame 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 Matrix3< T > get_body_orientation_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) Extract this body spatial velocity in world, expressed in world. 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) Extract this body spatial acceleration in world, expressed in world. 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...
 
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
 Returns the spatial velocity V_WB of this body B in the world frame W as a function of the state of the model stored in context. 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 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
 

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

Constructor & Destructor Documentation

◆ 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_BSpatial 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_nameA name associated with this body.
[in]M_BBo_BSpatial 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_nameA name associated with this body.
[in]model_instanceThe model instance associated with this body.
[in]M_BBo_BSpatial 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.

Member Function Documentation

◆ CalcCenterOfMassInBodyFrame()

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

(Advanced) Computes the center of mass p_BoBcm_B (or p_Bcm for short) of this body measured from this body's frame origin Bo and expressed in the body frame B.

Implements Body< T >.

◆ CalcSpatialInertiaInBodyFrame()

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

(Advanced) Computes the SpatialInertia I_BBo_B of this body about its frame origin Bo (not necessarily its center of mass) and expressed in its body frame B.

In general, the spatial inertia of a body is a function of state. Consider for instance the case of a flexible body for which its spatial inertia in the body frame depends on the generalized coordinates describing its state of deformation. As a particular case, the spatial inertia of a RigidBody in its body frame is constant.

Implements Body< T >.

◆ default_com()

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.

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

Return values
p_BoBcm_BThe 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<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).

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

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

◆ default_spatial_inertia()

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

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

◆ default_unit_inertia()

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

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

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

◆ DoCloneToScalar() [1/3]

std::unique_ptr<Body<double> > 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<Body<AutoDiffXd> > 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<Body<symbolic::Expression> > DoCloneToScalar ( const internal::MultibodyTree< symbolic::Expression > &  ) const
finalprotectedvirtual

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

Implements Body< T >.

◆ get_angular_acceleration_in_world()

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.

Parameters
[in]acvelocity kinematics cache.
Return values
alpha_WB_WB's angular acceleration in world W, expressed in W.

◆ get_angular_velocity_in_world()

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.

Parameters
[in]vcvelocity kinematics cache.
Return values
w_WB_Wrigid body B's angular velocity in world W, expressed in W.

◆ get_body_orientation_in_world()

const Matrix3<T> get_body_orientation_in_world ( const internal::PositionKinematicsCache< T > &  pc) const

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

Parameters
[in]pcposition kinematics cache.
Return values
R_WBrotation matrix relating rigid body B in world frame W.

◆ get_mass()

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

(Advanced) Returns the mass of this body stored in context.

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

Parameters
[in]vcvelocity kinematics cache.
Return values
a_WBo_Wacceleration of body origin Bo in world W, expressed in W.

◆ get_origin_position_in_world()

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.

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

◆ get_origin_velocity_in_world()

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.

Parameters
[in]vcvelocity kinematics cache.
Return values
v_WBo_Wvelocity of Bo (body origin) in world W, expressed in W.

◆ get_pose_in_world()

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

Parameters
[in]pcposition kinematics cache.
Return values
X_WBpose of rigid body B in world frame W.

◆ get_spatial_acceleration_in_world()

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

(Advanced) Extract this body spatial acceleration in world, expressed in world.

Parameters
[in]acacceleration kinematics cache.
Return values
A_WB_Wbody B's spatial acceleration in world W, expressed in W.

◆ get_spatial_velocity_in_world()

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

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

Parameters
[in]vcvelocity kinematics cache.
Return values
V_WB_Wrigid body B's spatial velocity in world W, expressed in W.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

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