SpatialInertia_< P > Class Template Reference

A spatial inertia contains the mass, center of mass point, and inertia matrix for a rigid body. More...

#include <MassProperties.h>

List of all members.

Public Member Functions

 SpatialInertia_ ()
 The default constructor fills everything with NaN, even in Release mode.
 SpatialInertia_ (RealP mass, const Vec3P &com, const GyrationP &gyration)
SpatialInertia_setMass (RealP mass)
SpatialInertia_setMassCenter (const Vec3P &com)
SpatialInertia_setGyration (const GyrationP &gyration)
RealP getMass () const
const Vec3PgetMassCenter () const
const GyrationPgetGyration () const
Vec3P calcMassMoment () const
 Calculate the first mass moment (mass-weighted COM location) from the mass and COM vector.
InertiaP calcInertia () const
 Calculate the inertia matrix (second mass moment, mass-weighted gyration matrix) from the mass and gyration matrix.
SpatialInertia_operator+= (const SpatialInertia_ &src)
 Add in a compatible SpatialInertia.
SpatialInertia_operator-= (const SpatialInertia_ &src)
 Subtract off a compatible SpatialInertia.
SpatialInertia_operator*= (const RealP &s)
 Multiply a SpatialInertia by a scalar.
SpatialInertia_operator/= (const RealP &s)
 Divide a SpatialInertia by a scalar.
SpatialInertia_ reexpress (const Rotation_< P > &R_FB) const
 Return a new SpatialInertia object which is the same as this one except re-expressed in another coordinate frame.
SpatialInertia_ reexpress (const InverseRotation_< P > &R_FB) const
 Rexpress using an inverse rotation to avoid having to convert it.
SpatialInertia_reexpressInPlace (const Rotation_< P > &R_FB)
 Re-express this SpatialInertia in another frame, modifying the original object.
SpatialInertia_reexpressInPlace (const InverseRotation_< P > &R_FB)
 Rexpress using an inverse rotation to avoid having to convert it.
SpatialInertia_ shift (const Vec3P &S) const
 Return a new SpatialInertia object which is the same as this one except the origin ("taken about" point) has changed from OF to OF+S.
SpatialInertia_shiftInPlace (const Vec3P &S)
 Change origin from OF to OF+S, modifying the original object in place.
SpatialInertia_ transform (const Transform_< P > &X_FB) const
 Return a new SpatialInertia object which is the same as this one but measured about and expressed in a new frame.
SpatialInertia_ transform (const InverseTransform_< P > &X_FB) const
 Transform using an inverse transform to avoid having to convert it.
SpatialInertia_transformInPlace (const Transform_< P > &X_FB)
 Transform this SpatialInertia object so that it is measured about and expressed in a new frame, modifying the object in place.
SpatialInertia_transformInPlace (const InverseTransform_< P > &X_FB)
 Transform using an inverse transform to avoid having to convert it.

Detailed Description

template<class P>
class SimTK::SpatialInertia_< P >

A spatial inertia contains the mass, center of mass point, and inertia matrix for a rigid body.

This is 10 independent quantities altogether; however, inertia is mass-scaled making it linearly dependent on the mass. Here instead we represent inertia using a gyration matrix, which is equivalent to the inertia this body would have if it had unit mass. Then the actual inertia is given by mass*gyration. In this manner the mass, center of mass location, and gyration are completely independent so can be changed separately. That means if you double the mass, you'll also double the inertia as you would expect.

Spatial inertia may be usefully viewed as a symmetric spatial matrix, that is, a 6x6 symmetric matrix arranged as 2x2 blocks of 3x3 matrices. Although this class represents the spatial inertia in compact form, it supports methods and operators that allow it to behave as though it were a spatial matrix (except much faster to work with). In spatial matrix form, the matrix has the following interpretation:

               [  m*G   m*px ]
           M = [             ]
               [ -m*px  m*I  ]
 

Here m is mass, p is the vector from the body origin to the center of mass, G is the 3x3 symmetric gyration matrix, and I is a 3x3 identity matrix. "px" indicates the skew symmetric cross product matrix formed from the vector p, so -px=~px.


Constructor & Destructor Documentation

SpatialInertia_ (  )  [inline]

The default constructor fills everything with NaN, even in Release mode.

SpatialInertia_ ( RealP  mass,
const Vec3P com,
const GyrationP gyration 
) [inline]

Member Function Documentation

InertiaP calcInertia (  )  const [inline]

Calculate the inertia matrix (second mass moment, mass-weighted gyration matrix) from the mass and gyration matrix.

Cost is 6 inline flops.

Referenced by SpatialInertia_< P >::operator+=(), and SpatialInertia_< P >::operator-=().

Vec3P calcMassMoment (  )  const [inline]

Calculate the first mass moment (mass-weighted COM location) from the mass and COM vector.

Cost is 3 inline flops.

Referenced by SpatialInertia_< P >::operator+=(), and SpatialInertia_< P >::operator-=().

const GyrationP& getGyration (  )  const [inline]
RealP getMass (  )  const [inline]
const Vec3P& getMassCenter (  )  const [inline]
SpatialInertia_& operator*= ( const RealP &  s  )  [inline]

Multiply a SpatialInertia by a scalar.

Because we keep the mass factored out, this requires only a single multiply.

SpatialInertia_& operator+= ( const SpatialInertia_< P > &  src  )  [inline]

Add in a compatible SpatialInertia.

This is only valid if both SpatialInertias are expressed in the same frame and measured about the same point but there is no way for this method to check. Cost is about 40 flops.

References SpatialInertia_< P >::calcInertia(), SpatialInertia_< P >::calcMassMoment(), and SimTK_ERRCHK.

SpatialInertia_& operator-= ( const SpatialInertia_< P > &  src  )  [inline]

Subtract off a compatible SpatialInertia.

This is only valid if both SpatialInertias are expressed in the same frame and measured about the same point but there is no way for this method to check. Cost is about 40 flops.

References SpatialInertia_< P >::calcInertia(), SpatialInertia_< P >::calcMassMoment(), and SimTK_ERRCHK.

SpatialInertia_& operator/= ( const RealP &  s  )  [inline]

Divide a SpatialInertia by a scalar.

Because we keep the mass factored out, this requires only a single divide.

SpatialInertia_ reexpress ( const InverseRotation_< P > &  R_FB  )  const [inline]

Rexpress using an inverse rotation to avoid having to convert it.

See also:
rexpress(Rotation) for information

References SpatialInertia_< P >::reexpressInPlace().

SpatialInertia_ reexpress ( const Rotation_< P > &  R_FB  )  const [inline]

Return a new SpatialInertia object which is the same as this one except re-expressed in another coordinate frame.

We consider this object to be expressed in some frame F and we're given a rotation matrix R_FB we can use to re-express in a new frame B. Cost is 72 flops.

See also:
reexpressInPlace()

References SpatialInertia_< P >::reexpressInPlace().

SpatialInertia_& reexpressInPlace ( const InverseRotation_< P > &  R_FB  )  [inline]

Rexpress using an inverse rotation to avoid having to convert it.

See also:
rexpressInPlace(Rotation) for information

References SpatialInertia_< P >::reexpressInPlace().

SpatialInertia_& reexpressInPlace ( const Rotation_< P > &  R_FB  )  [inline]

Re-express this SpatialInertia in another frame, modifying the original object.

We return a reference to the object so that you can chain this operation in the manner of assignment operators. Cost is 72 flops.

See also:
reexpress() if you want to leave this object unmolested.

References SpatialInertia_< P >::reexpressInPlace().

Referenced by SpatialInertia_< P >::reexpress(), and SpatialInertia_< P >::reexpressInPlace().

SpatialInertia_& setGyration ( const GyrationP gyration  )  [inline]
SpatialInertia_& setMass ( RealP  mass  )  [inline]

References SimTK_ERRCHK1.

SpatialInertia_& setMassCenter ( const Vec3P com  )  [inline]
SpatialInertia_ shift ( const Vec3P S  )  const [inline]

Return a new SpatialInertia object which is the same as this one except the origin ("taken about" point) has changed from OF to OF+S.

Cost is 37 flops.

See also:
shiftInPlace()

References SpatialInertia_< P >::shiftInPlace().

SpatialInertia_& shiftInPlace ( const Vec3P S  )  [inline]

Change origin from OF to OF+S, modifying the original object in place.

Returns a reference to the modified object so that you can chain this operation in the manner of assignment operators. Cost is 37 flops.

See also:
shift() if you want to leave this object unmolested.

Referenced by SpatialInertia_< P >::shift().

SpatialInertia_ transform ( const InverseTransform_< P > &  X_FB  )  const [inline]

Transform using an inverse transform to avoid having to convert it.

See also:
transform(Transform) for information
SpatialInertia_ transform ( const Transform_< P > &  X_FB  )  const [inline]

Return a new SpatialInertia object which is the same as this one but measured about and expressed in a new frame.

We consider the current spatial inertia M to be measured (implicitly) in some frame F, that is, we have M=M_OF_F. We want M_OB_B for some new frame B, given the transform X_FB giving the location and orientation of B in F. This combines the reexpress() and shift() operations available separately. Cost is 109 flops.

See also:
transformInPlace()
SpatialInertia_& transformInPlace ( const InverseTransform_< P > &  X_FB  )  [inline]

Transform using an inverse transform to avoid having to convert it.

See also:
transformInPlace(Transform) for information

References InverseTransform_< P >::p(), and InverseTransform_< P >::R().

SpatialInertia_& transformInPlace ( const Transform_< P > &  X_FB  )  [inline]

Transform this SpatialInertia object so that it is measured about and expressed in a new frame, modifying the object in place.

We consider the current spatial inertia M to be measured (implicitly) in some frame F, that is, we have M=M_OF_F. We want to change it to M_OB_B for some new frame B, given the transform X_FB giving the location and orientation of B in F. This combines the reexpressInPlace() and shiftInPlace() operations available separately. Returns a reference to the modified object so that you can chain this operation in the manner of assignment operators. Cost is 109 flops.

See also:
tranform() if you want to leave this object unmolested.

References Transform_< P >::p(), and Transform_< P >::R().


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

Generated on Thu Aug 12 16:38:17 2010 for SimTKcore by  doxygen 1.6.1