#include <MassProperties.h>
If that point is the center of mass of the body, then the measured inertia is called the "central inertia" of that body. To write down the inertia, we need to calculate the six scalars of the inertia tensor, which is a symmetric 3x3 matrix. These scalars must be expressed in an arbitrary but specified coordinate system. So an Inertia is meaningful only in conjunction with a particular set of axes, fixed to the body, whose origin is the point about which the inertia is being measured, and in whose coordinate system this measurement is being expressed. Note that changing the reference point results in a new physical quantity, but changing the reference axes only affects the measure numbers of that quantity. For any reference point, there is a unique set of reference axes in which the inertia tensor is diagonal; those are called the "principal axes" of the body at that point, and the resulting diagonal elements are the "principal moments of inertia". When we speak of an inertia being "in" a frame, we mean the physical quantity measured about the frame's origin and then expressed in the frame's axes.
This low-level Inertia class does not attempt to keep track of *which* frame it is in. It concentrates instead on providing construction and operations involving inertia which can proceed using only an implicit frame F. Clients of this class are responsible for keeping track of that frame. In particular, in order to shift the inertia's "measured-about" point one must know whether either the starting or final inertia is central, because we must always shift inertias by passing through the central inertia. So this class provides operations for doing the shifting, but expects to be told by the client where to find the center of mass.
Re-expressing an Inertia in a different coordinate system does not entail a change of physical meaning in the way that shifting it to a different point does. Note that because inertia is a tensor, there is a "left frame" and "right frame". For our purposes, these will always be the same so we'll only indicate the frame once, as in 'I_pt_frame'. This should be understood to mean 'frame_I_pt_frame' and re-expressing an Inertia requires both a left and right multiply by the rotation matrix. So I_OB_B is the inertia about body B's origin point OB, expressed in B, while I_OB_G is the same physical quantity but expressed in Ground (the latter is a component of the Spatial Inertia). Conversion is done like this: I_OB_G = R_GB * I_OB_B * R_BG (and recall that R_GB=~R_BG) The central inertia would be I_CB_B for body B.
A Inertia is a symmetric matrix and is positive definite for nonsingular bodies (that is, a body composed of at least three noncollinear point masses).
Public Member Functions | |
Inertia () | |
Default is a NaN-ed out mess to avoid accidents. | |
Inertia (const Real &r) | |
Create a principal inertia matrix with identical diagonal elements. | |
Inertia (const Vec3 &moments, const Vec3 &products=Vec3(0)) | |
Create an inertia matrix from a vector of the *moments* of inertia (the inertia matrix diagonal) and optionally a vector of the *products* of inertia (the off-diagonals). | |
Inertia (const Real &xx, const Real &yy, const Real &zz) | |
Create a principal inertia matrix (only non-zero on diagonal). | |
Inertia (const Real &xx, const Real &yy, const Real &zz, const Real &xy, const Real &xz, const Real &yz) | |
This is a general inertia matrix. | |
Inertia (const Vec3 &p, const Real &m) | |
Given a point mass located at a given point p in some frame F, construct I_OF_F, that is, the inertia of that point mass about F's origin, expressed in F (that is, in F's coordinate system). | |
Inertia (const Inertia &src) | |
We only look at the lower triangle, but fill in the whole matrix. | |
Inertia (const Mat33 &s) | |
Construct an Inertia from a 3x3 matrix. | |
Inertia & | operator= (const Inertia &src) |
Copy assignment: only look at the lower triangle, but fill in the whole matrix. | |
Inertia & | operator+= (const Inertia &src) |
Add in another inertia. | |
Inertia & | operator-= (const Inertia &src) |
Subtract off another inertia. | |
Inertia & | operator*= (const Real &r) |
Scale an Inertia. | |
Inertia & | operator/= (const Real &r) |
Scale an Inertia. | |
Inertia & | setInertia (const Real &xx, const Real &yy, const Real &zz) |
Set an inertia to have only principal moments (that is, it will be diagonal). | |
Inertia & | setInertia (const Vec3 &moments, const Vec3 &products=Vec3(0)) |
Set principal moments and optionally off-diagonal terms. | |
Inertia & | setInertia (const Real &xx, const Real &yy, const Real &zz, const Real &xy, const Real &xz, const Real &yz) |
Set this Inertia to a general inertia matrix. | |
Inertia | shiftToMassCenter (const Vec3 &CF, const Real &mtot) const |
Assume that the current inertia is about the F frame's origin OF, and expressed in F. | |
Inertia | shiftFromMassCenter (const Vec3 &p, const Real &mtot) const |
Assuming that the current inertia I is a central inertia (that is, it is inertia about the body center of mass CF), shift it to some other point p measured from the center of mass. | |
Inertia | reexpress (const Rotation &R_FB) const |
Re-express this inertia from frame F to frame B, given the orientation of B in F. | |
Real | trace () const |
Mat33 | toMat33 () const |
Vec3 | getMoments () const |
Vec3 | getProducts () const |
Static Public Member Functions | |
static Inertia | pointMass () |
static Inertia | pointMassAt (const Vec3 &p) |
static Inertia | sphere (const Real &r) |
static Inertia | cylinderAlongZ (const Real &r, const Real &hz) |
static Inertia | cylinderAlongY (const Real &r, const Real &hy) |
static Inertia | cylinderAlongX (const Real &r, const Real &hx) |
static Inertia | brick (const Real &hx, const Real &hy, const Real &hz) |
static Inertia | ellipsoid (const Real &hx, const Real &hy, const Real &hz) |
Friends | |
Vec3 | operator* (const Inertia &i, const Vec3 &w) |
Inertia | ( | ) | [inline] |
Inertia | ( | const Real & | r | ) | [inline, explicit] |
Create a principal inertia matrix with identical diagonal elements.
Most commonly we create Inertia(0) for initialization of an inertia calculation (that is also the inertia of a point mass located at the origin). This can also be used with a non-zero value as the inertia of a sphere centered at the origin.
Create an inertia matrix from a vector of the *moments* of inertia (the inertia matrix diagonal) and optionally a vector of the *products* of inertia (the off-diagonals).
Moments are in the order xx,yy,zz; products are xy,xz,yz.
References Inertia::setInertia().
Inertia | ( | const Real & | xx, | |
const Real & | yy, | |||
const Real & | zz | |||
) | [inline] |
Inertia | ( | const Real & | xx, | |
const Real & | yy, | |||
const Real & | zz, | |||
const Real & | xy, | |||
const Real & | xz, | |||
const Real & | yz | |||
) | [inline] |
This is a general inertia matrix.
Note the order of these arguments: moments of inertia first, then products of inertia.
References Inertia::setInertia().
Given a point mass located at a given point p in some frame F, construct I_OF_F, that is, the inertia of that point mass about F's origin, expressed in F (that is, in F's coordinate system).
For a collection of point masses, you can just add these together to produce a composite inertia as long as all the vectors are measured from the same point and expressed in the same frame.
We only look at the lower triangle, but fill in the whole matrix.
Construct an Inertia from a 3x3 matrix.
The matrix must be symmetric or very close to symmetric. TODO: there are other tests that should be performed here to check validity, such as the triangle inequality test.
Copy assignment: only look at the lower triangle, but fill in the whole matrix.
Add in another inertia.
Frames and reference point must be the same but we can't check. Only look at the lower triangle, but fill in the whole matrix.
Subtract off another inertia.
Frames and reference point must be the same but we can't check. Only look at the lower triangle, but fill in the whole matrix.
Inertia& setInertia | ( | const Real & | xx, | |
const Real & | yy, | |||
const Real & | zz | |||
) | [inline] |
Set an inertia to have only principal moments (that is, it will be diagonal).
TODO: should check validity.
Referenced by Inertia::Inertia().
Set principal moments and optionally off-diagonal terms.
Behaves like an assignment statement. TODO: should check validity.
Inertia& setInertia | ( | const Real & | xx, | |
const Real & | yy, | |||
const Real & | zz, | |||
const Real & | xy, | |||
const Real & | xz, | |||
const Real & | yz | |||
) | [inline] |
Set this Inertia to a general inertia matrix.
Note the order of these arguments: moments of inertia first, then products of inertia. Behaves like an assignment statement. TODO: should check validity.
Assume that the current inertia is about the F frame's origin OF, and expressed in F.
Given the vector from OF to the body center of mass CF, and the total mass of the body, we can shift the inertia to the center of mass. This produces a new Inertia I' whose (implicit) frame F' is aligned with F but has origin CF (an inertia like that is called a "central inertia". I' = I - Icom where Icom is the inertia of a fictitious point mass of mass mtot located at CF (measured in F) about OF.
Assuming that the current inertia I is a central inertia (that is, it is inertia about the body center of mass CF), shift it to some other point p measured from the center of mass.
This produces a new inertia I' about the point p given by I' = I + Ip where Ip is the inertia of a fictitious point mass of mass mtot (the total body mass) located at p, about CF.
Re-express this inertia from frame F to frame B, given the orientation of B in F.
This is a similarity transform since rotation matrices are orthogonal.
Referenced by MobilizedBody::calcBodyInertiaAboutAnotherBodyStation(), and MobilizedBody::calcBodyMomentumAboutBodyMassCenterInGround().
Real trace | ( | ) | const [inline] |
Mat33 toMat33 | ( | ) | const [inline] |
Vec3 getMoments | ( | ) | const [inline] |
Vec3 getProducts | ( | ) | const [inline] |
References Inertia::Inertia().
static Inertia pointMass | ( | ) | [inline, static] |
static Inertia sphere | ( | const Real & | r | ) | [inline, static] |
static Inertia cylinderAlongZ | ( | const Real & | r, | |
const Real & | hz | |||
) | [inline, static] |
static Inertia cylinderAlongY | ( | const Real & | r, | |
const Real & | hy | |||
) | [inline, static] |
static Inertia cylinderAlongX | ( | const Real & | r, | |
const Real & | hx | |||
) | [inline, static] |
static Inertia brick | ( | const Real & | hx, | |
const Real & | hy, | |||
const Real & | hz | |||
) | [inline, static] |
static Inertia ellipsoid | ( | const Real & | hx, | |
const Real & | hy, | |||
const Real & | hz | |||
) | [inline, static] |