Simbody
3.3
|
A spatial inertia contains the mass, center of mass point, and inertia matrix for a rigid body. More...
#include <MassProperties.h>
Public Member Functions | |
SpatialInertia_ () | |
The default constructor fills everything with NaN, even in Release mode. More... | |
SpatialInertia_ (RealP mass, const Vec3P &com, const UnitInertiaP &gyration) | |
SpatialInertia_ & | setMass (RealP mass) |
SpatialInertia_ & | setMassCenter (const Vec3P &com) |
SpatialInertia_ & | setUnitInertia (const UnitInertiaP &gyration) |
RealP | getMass () const |
const Vec3P & | getMassCenter () const |
const UnitInertiaP & | getUnitInertia () const |
Vec3P | calcMassMoment () const |
Calculate the first mass moment (mass-weighted COM location) from the mass and COM vector. More... | |
InertiaP | calcInertia () const |
Calculate the inertia matrix (second mass moment, mass-weighted gyration matrix) from the mass and unit inertia matrix. More... | |
SpatialInertia_ & | operator+= (const SpatialInertia_ &src) |
Add in a compatible SpatialInertia. More... | |
SpatialInertia_ & | operator-= (const SpatialInertia_ &src) |
Subtract off a compatible SpatialInertia. More... | |
SpatialInertia_ & | operator*= (const RealP &s) |
Multiply a SpatialInertia by a scalar. More... | |
SpatialInertia_ & | operator/= (const RealP &s) |
Divide a SpatialInertia by a scalar. More... | |
SpatialVecP | operator* (const SpatialVecP &v) const |
Multiply a SpatialInertia by a SpatialVec to produce a SpatialVec result; 45 flops. More... | |
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. More... | |
SpatialInertia_ | reexpress (const InverseRotation_< P > &R_FB) const |
Rexpress using an inverse rotation to avoid having to convert it. More... | |
SpatialInertia_ & | reexpressInPlace (const Rotation_< P > &R_FB) |
Re-express this SpatialInertia in another frame, modifying the original object. More... | |
SpatialInertia_ & | reexpressInPlace (const InverseRotation_< P > &R_FB) |
Rexpress using an inverse rotation to avoid having to convert it. More... | |
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. More... | |
SpatialInertia_ & | shiftInPlace (const Vec3P &S) |
Change origin from OF to OF+S, modifying the original object in place. More... | |
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. More... | |
SpatialInertia_ | transform (const InverseTransform_< P > &X_FB) const |
Transform using an inverse transform to avoid having to convert it. More... | |
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. More... | |
SpatialInertia_ & | transformInPlace (const InverseTransform_< P > &X_FB) |
Transform using an inverse transform to avoid having to convert it. More... | |
const SpatialMatP | toSpatialMat () const |
Related Functions | |
(Note that these are not member functions.) | |
template<class P > | |
SpatialInertia_< P > | operator+ (const SpatialInertia_< P > &l, const SpatialInertia_< P > &r) |
Add two compatible spatial inertias. More... | |
template<class P > | |
SpatialInertia_< P > | operator- (const SpatialInertia_< P > &l, const SpatialInertia_< P > &r) |
Subtract one compatible spatial inertia from another. More... | |
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 unit inertia matrix, which is equivalent to the inertia this body would have if it had unit mass. Then the actual inertia is given by mass*unitInertia. In this manner the mass, center of mass location, and inertia 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 unit inertia (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.
Typedefs exist for the most common invocations of SpatialInertia_<P>:
|
inline |
The default constructor fills everything with NaN, even in Release mode.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Calculate the first mass moment (mass-weighted COM location) from the mass and COM vector.
Cost is 3 inline flops.
|
inline |
Calculate the inertia matrix (second mass moment, mass-weighted gyration matrix) from the mass and unit inertia matrix.
Cost is 6 inline flops.
|
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.
|
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.
|
inline |
Multiply a SpatialInertia by a scalar.
Because we keep the mass factored out, this requires only a single multiply.
|
inline |
Divide a SpatialInertia by a scalar.
Because we keep the mass factored out, this requires only a single divide.
|
inline |
Multiply a SpatialInertia by a SpatialVec to produce a SpatialVec result; 45 flops.
|
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.
|
inline |
Rexpress using an inverse rotation to avoid having to convert it.
|
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.
|
inline |
Rexpress using an inverse rotation to avoid having to convert it.
|
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.
|
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.
|
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.
|
inline |
Transform using an inverse transform to avoid having to convert it.
|
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.
|
inline |
Transform using an inverse transform to avoid having to convert it.
|
inline |
|
related |
Add two compatible spatial inertias.
Cost is about 40 flops.
|
related |
Subtract one compatible spatial inertia from another.
Cost is about 40 flops.