Simbody
3.7
|
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 P &m, const Vec< 3, P > &com, const Inertia_< P > &inertia) | |
Create a mass properties object from individually supplied mass, mass center, and inertia matrix. More... | |
MassProperties_ (const P &m, const Vec< 3, P > &com, const UnitInertia_< P > &gyration) | |
Create a mass properties object from individually supplied mass, mass center, and unit inertia (gyration) matrix. More... | |
MassProperties_ & | setMassProperties (const P &m, const Vec< 3, P > &com, const Inertia_< P > &inertia) |
Set mass, center of mass, and inertia. More... | |
MassProperties_ & | setMassProperties (const P &m, const Vec< 3, P > &com, const UnitInertia_< P > &gyration) |
Set mass, center of mass, and unit inertia. More... | |
const P & | getMass () const |
Return the mass currently stored in this MassProperties object. More... | |
const Vec< 3, P > & | getMassCenter () 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 UnitInertia_< P > & | getUnitInertia () 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 Inertia_< P > | 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 Inertia_< P > | 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... | |
Inertia_< P > | calcCentralInertia () const |
Return the inertia of this MassProperties object, but measured about the mass center rather than about the (implicit) B frame origin. More... | |
Inertia_< P > | calcShiftedInertia (const Vec< 3, P > &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... | |
Inertia_< P > | calcTransformedInertia (const Transform_< P > &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 Vec< 3, P > &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 Transform_< P > &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 Rotation_< P > &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 P &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 P &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... | |
Mat< 2, 2, Mat< 3, 3, P > > | 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... | |
Mat< 6, 6, P > | 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... | |
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.
Typedefs exist for the most common invocations of MassProperties_<P>:
|
inline |
Create a mass properties object in which the mass, mass center, and inertia are meaningless; you must assign values before using this.
|
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.
|
inline |
Create a mass properties object from individually supplied mass, mass center, and unit inertia (gyration) matrix.
|
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.
|
inline |
Set mass, center of mass, and unit inertia.
Behaves like an assignment in that a reference to the modified MassProperties object is returned.
|
inline |
Return the mass currently stored in this MassProperties object.
|
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.
|
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.
|
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.
|
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().
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
inline |
Return true only if the mass stored here is exactly zero. If the mass resulted from a computation, you should use isNearlyMassless() instead.
|
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.
|
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.
|
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.
|
inline |
Return true if any element of this MassProperties object is NaN.
|
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.
|
inline |
|
inline |
Convert this MassProperties object to a spatial inertia matrix and return it as a SpatialMat, which is a 2x2 matrix of 3x3 submatrices.
|
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.
|
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.