Simbody  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SimTK::MassProperties_< P > Class Template Reference

This class contains the mass, center of mass, and unit inertia matrix of a rigid body B. More...

Public Member Functions

 MassProperties_ ()
 Create a mass properties object in which the mass, mass center, and inertia are meaningless; you must assign values before using this. More...
 
 MassProperties_ (const RealP &m, const Vec3P &com, const InertiaP &inertia)
 Create a mass properties object from individually supplied mass, mass center, and inertia matrix. More...
 
 MassProperties_ (const RealP &m, const Vec3P &com, const UnitInertiaP &gyration)
 Create a mass properties object from individually supplied mass, mass center, and unit inertia (gyration) matrix. More...
 
MassProperties_setMassProperties (const RealP &m, const Vec3P &com, const InertiaP &inertia)
 Set mass, center of mass, and inertia. More...
 
MassProperties_setMassProperties (const RealP &m, const Vec3P &com, const UnitInertiaP &gyration)
 Set mass, center of mass, and unit inertia. More...
 
const RealP & getMass () const
 Return the mass currently stored in this MassProperties object. More...
 
const Vec3PgetMassCenter () const
 Return the mass center currently stored in this MassProperties object; this is expressed in an implicit frame we call "B", and measured from B's origin, but you have to know what that frame is in order to interpret the returned vector. More...
 
const UnitInertiaPgetUnitInertia () const
 Return the unit inertia currently stored in this MassProperties object; this is expressed in an implicit frame we call "B", and measured about B's origin, but you have to know what that frame is in order to interpret the returned value correctly. More...
 
const InertiaP calcInertia () const
 Return the inertia matrix for this MassProperties object; this is equal to the unit inertia times the mass and costs 6 flops. More...
 
const InertiaP getInertia () const
 OBSOLETE – this is just here for compatibility with 2.2; since the UnitInertia is stored now the full inertia must be calculated at a cost of 6 flops, hence the method name should be calcInertia() and that's what you should use unless you want getUnitInertia(). More...
 
InertiaP calcCentralInertia () const
 Return the inertia of this MassProperties object, but measured about the mass center rather than about the (implicit) B frame origin. More...
 
InertiaP calcShiftedInertia (const Vec3P &newOriginB) const
 Return the inertia of this MassProperties object, but with the "measured about" point shifted from the (implicit) B frame origin to a new point that is supplied in newOriginB which must be a vector measured from the B frame origin and expressed in B. More...
 
InertiaP calcTransformedInertia (const TransformP &X_BC) const
 Return the inertia of this MassProperties object, but transformed to from the implicit B frame to a new frame C whose pose relative to B is supplied. More...
 
MassProperties_ calcShiftedMassProps (const Vec3P &newOriginB) const
 Return a new MassProperties object that is the same as this one but with the origin point shifted from the (implicit) B frame origin to a new point that is supplied in newOriginB which must be a vector measured from the B frame origin and expressed in B. More...
 
MassProperties_ calcTransformedMassProps (const TransformP &X_BC) const
 Transform these mass properties from the current frame "B" to a new frame "C", given the pose of C in B. Caution: this shifts the point from which the mass properties are measured from the origin of B to the origin of C. More...
 
MassProperties_ reexpress (const RotationP &R_BC) const
 Re-express these mass properties from the current frame "B" to a new frame "C", given the orientation of C in B. Caution: this does not shift the point from which the mass properties are measured, it just uses a different frame to express that measurement. More...
 
bool isExactlyMassless () const
 Return true only if the mass stored here is exactly zero. If the mass resulted from a computation, you should use isNearlyMassless() instead. More...
 
bool isNearlyMassless (const RealP &tol=SignificantReal) const
 Return true if the mass stored here is zero to within a small tolerance. More...
 
bool isExactlyCentral () const
 Return true only if the mass center stored here is exactly zero. If the mass center resulted from a computation, you should use isNearlyCentral() instead. More...
 
bool isNearlyCentral (const RealP &tol=SignificantReal) const
 Return true if the mass center stored here is zero to within a small tolerance. More...
 
bool isNaN () const
 Return true if any element of this MassProperties object is NaN. More...
 
bool isInf () const
 Return true only if there are no NaN's in this MassProperties object, and at least one of the elements is Infinity. Ground's mass properties satisfy these conditions. More...
 
bool isFinite () const
 Return true if none of the elements of this MassProperties object are NaN or Infinity. Note that Ground's mass properties are not finite. More...
 
SpatialMatP toSpatialMat () const
 Convert this MassProperties object to a spatial inertia matrix and return it as a SpatialMat, which is a 2x2 matrix of 3x3 submatrices. More...
 
Mat66P toMat66 () const
 Convert this MassProperties object to a spatial inertia matrix in the form of an ordinary 6x6 matrix, not a SpatialMat. More...
 

Related Functions

(Note that these are not member functions.)

template<class P >
static std::ostream & operator<< (std::ostream &o, const MassProperties_< P > &mp)
 Output a human-readable representation of a MassProperties object to the given output stream. More...
 

Detailed Description

template<class P>
class SimTK::MassProperties_< P >

This class contains the mass, center of mass, and unit inertia matrix of a rigid body B.

The center of mass is a vector from B's origin, expressed in the B frame. The inertia is taken about the B origin, and expressed in B. The frame B is implicit; only the measurements are stored here. The unit inertia can be multiplied by the mass to get the inertia matrix for the body.

Abbreviations

Typedefs exist for the most common invocations of MassProperties_<P>:

Constructor & Destructor Documentation

template<class P >
SimTK::MassProperties_< P >::MassProperties_ ( )
inline

Create a mass properties object in which the mass, mass center, and inertia are meaningless; you must assign values before using this.

template<class P >
SimTK::MassProperties_< P >::MassProperties_ ( const RealP &  m,
const Vec3P com,
const InertiaP inertia 
)
inline

Create a mass properties object from individually supplied mass, mass center, and inertia matrix.

The inertia matrix is divided by the mass to produce the unit inertia.

template<class P >
SimTK::MassProperties_< P >::MassProperties_ ( const RealP &  m,
const Vec3P com,
const UnitInertiaP gyration 
)
inline

Create a mass properties object from individually supplied mass, mass center, and unit inertia (gyration) matrix.

Member Function Documentation

template<class P >
MassProperties_& SimTK::MassProperties_< P >::setMassProperties ( const RealP &  m,
const Vec3P com,
const InertiaP inertia 
)
inline

Set mass, center of mass, and inertia.

The inertia is divided by the mass to produce the unit inertia. Behaves like an assignment in that a reference to the modified MassProperties object is returned.

template<class P >
MassProperties_& SimTK::MassProperties_< P >::setMassProperties ( const RealP &  m,
const Vec3P com,
const UnitInertiaP gyration 
)
inline

Set mass, center of mass, and unit inertia.

Behaves like an assignment in that a reference to the modified MassProperties object is returned.

template<class P >
const RealP& SimTK::MassProperties_< P >::getMass ( ) const
inline

Return the mass currently stored in this MassProperties object.

template<class P >
const Vec3P& SimTK::MassProperties_< P >::getMassCenter ( ) const
inline

Return the mass center currently stored in this MassProperties object; this is expressed in an implicit frame we call "B", and measured from B's origin, but you have to know what that frame is in order to interpret the returned vector.

template<class P >
const UnitInertiaP& SimTK::MassProperties_< P >::getUnitInertia ( ) const
inline

Return the unit inertia currently stored in this MassProperties object; this is expressed in an implicit frame we call "B", and measured about B's origin, but you have to know what that frame is in order to interpret the returned value correctly.

template<class P >
const InertiaP SimTK::MassProperties_< P >::calcInertia ( ) const
inline

Return the inertia matrix for this MassProperties object; this is equal to the unit inertia times the mass and costs 6 flops.

It is expressed in an implicit frame we call "B", and measured about B's origin, but you have to know what that frame is in order to interpret the returned value correctly.

template<class P >
const InertiaP SimTK::MassProperties_< P >::getInertia ( ) const
inline

OBSOLETE – this is just here for compatibility with 2.2; since the UnitInertia is stored now the full inertia must be calculated at a cost of 6 flops, hence the method name should be calcInertia() and that's what you should use unless you want getUnitInertia().

template<class P >
InertiaP SimTK::MassProperties_< P >::calcCentralInertia ( ) const
inline

Return the inertia of this MassProperties object, but measured about the mass center rather than about the (implicit) B frame origin.

The result is still expressed in B.

template<class P >
InertiaP SimTK::MassProperties_< P >::calcShiftedInertia ( const Vec3P newOriginB) const
inline

Return the inertia of this MassProperties object, but with the "measured about" point shifted from the (implicit) B frame origin to a new point that is supplied in newOriginB which must be a vector measured from the B frame origin and expressed in B.

The result is still expressed in B.

template<class P >
InertiaP SimTK::MassProperties_< P >::calcTransformedInertia ( const TransformP X_BC) const
inline

Return the inertia of this MassProperties object, but transformed to from the implicit B frame to a new frame C whose pose relative to B is supplied.

Note that this affects both the "measured about" point and the "expressed in" frame.

template<class P >
MassProperties_ SimTK::MassProperties_< P >::calcShiftedMassProps ( const Vec3P newOriginB) const
inline

Return a new MassProperties object that is the same as this one but with the origin point shifted from the (implicit) B frame origin to a new point that is supplied in newOriginB which must be a vector measured from the B frame origin and expressed in B.

This affects both the mass center vector and the inertia. The result is still expressed in B.

template<class P >
MassProperties_ SimTK::MassProperties_< P >::calcTransformedMassProps ( const TransformP X_BC) const
inline

Transform these mass properties from the current frame "B" to a new frame "C", given the pose of C in B. Caution: this shifts the point from which the mass properties are measured from the origin of B to the origin of C.

See reexpress() to change only the measure numbers without moving the "measured from" point. Note that the frame in which a MassProperties object is expressed, and the point about which the mass properties are measured, are implicit; we don't actually have any way to verify that it is in B. Make sure you are certain about the current frame before using this method.

template<class P >
MassProperties_ SimTK::MassProperties_< P >::reexpress ( const RotationP R_BC) const
inline

Re-express these mass properties from the current frame "B" to a new frame "C", given the orientation of C in B. Caution: this does not shift the point from which the mass properties are measured, it just uses a different frame to express that measurement.

See calcTransformedMassProps() to perform a shift as well. Note that the frame in which a MassProperties object is expressed is implicit; we don't actually have any way to verify that it is in B. Make sure you are certain about the current frame before using this method.

template<class P >
bool SimTK::MassProperties_< P >::isExactlyMassless ( ) const
inline

Return true only if the mass stored here is exactly zero. If the mass resulted from a computation, you should use isNearlyMassless() instead.

See also
isNearlyMassless(), isExactlyCentral()
template<class P >
bool SimTK::MassProperties_< P >::isNearlyMassless ( const RealP &  tol = SignificantReal) const
inline

Return true if the mass stored here is zero to within a small tolerance.

By default we use SignificantReal (about 1e-14 in double precision) as the tolerance but you can override that. If you are just checking to see whether the mass was explicitly set to zero (rather than calculated) you can use isExactlyMassless() instead.

See also
isExactlyMassless(), isNearlyCentral()
template<class P >
bool SimTK::MassProperties_< P >::isExactlyCentral ( ) const
inline

Return true only if the mass center stored here is exactly zero. If the mass center resulted from a computation, you should use isNearlyCentral() instead.

See also
isNearlyCentral(), isExactlyMassless()
template<class P >
bool SimTK::MassProperties_< P >::isNearlyCentral ( const RealP &  tol = SignificantReal) const
inline

Return true if the mass center stored here is zero to within a small tolerance.

By default we use SignificantReal (about 1e-14 in double precision) as the tolerance but you can override that. If you are just checking to see whether the mass center was explicitly set to zero (rather than calculated) you can use isExactlyCentral() instead.

See also
isExactlyCentral(), isNearlyMassless()
template<class P >
bool SimTK::MassProperties_< P >::isNaN ( ) const
inline

Return true if any element of this MassProperties object is NaN.

See also
isInf(), isFinite()
template<class P >
bool SimTK::MassProperties_< P >::isInf ( ) const
inline

Return true only if there are no NaN's in this MassProperties object, and at least one of the elements is Infinity. Ground's mass properties satisfy these conditions.

See also
isNan(), isFinite()
template<class P >
bool SimTK::MassProperties_< P >::isFinite ( ) const
inline

Return true if none of the elements of this MassProperties object are NaN or Infinity. Note that Ground's mass properties are not finite.

See also
isNaN(), isInf()
template<class P >
SpatialMatP SimTK::MassProperties_< P >::toSpatialMat ( ) const
inline

Convert this MassProperties object to a spatial inertia matrix and return it as a SpatialMat, which is a 2x2 matrix of 3x3 submatrices.

See also
toMat66()
template<class P >
Mat66P SimTK::MassProperties_< P >::toMat66 ( ) const
inline

Convert this MassProperties object to a spatial inertia matrix in the form of an ordinary 6x6 matrix, not a SpatialMat.

Logically these are the same but the ordering of the elements in memory is different between a Mat66 and SpatialMat.

See also
toSpatialMat()

Friends And Related Function Documentation

template<class P >
static std::ostream & operator<< ( std::ostream &  o,
const MassProperties_< P > &  mp 
)
related

Output a human-readable representation of a MassProperties object to the given output stream.

This is assumed to be the mass properties of some body B. We'll show B's mass, center of mass as a vector from B's origin, expressed in B, and unit inertia, abbreviated Uxx, Uyy, and so on so that you won't accidentally think these are mass-scaled inertias normally designated Ixx, Iyy, etc. Note that I=mass*U in these terms. Also note that the unit inertia is taken about the body frame origin, not about the center of mass. And of course the unit inertia is expressed in B.


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