public class SpatialInertia extends Matrix6dBlock implements java.io.Serializable
[ f ] [ m I - m [c] ] [ dv ] [ ] = [ ] [ ] [ t ] [ m [c] J - m [c][c] ] [ dw ]The left-hand vector is a wrench describing the spatial force, composed of a translational force f and a moment m. The right-hand vector is a twist describing the spatial acceleration, composed of a translational acceleration dv and an angular acceleration dw. The components of the inertia matrix itself are the body mass m, the center of mass position c, and the rotational inertia J with respect to the center of mass. [c] denotes the 3 x 3 cross-product matrix formed from the components of c and I is the identity matrix.
An inertia is easy to invert given the inverse of J:
[ -1 -1 ] -1 [ 1/m I - [c] J [c] [c] J ] M = [ ] [ -1 -1 ] [ -J [c] J ]If the inertia's coordinate frame is located at the center of mass, then c = 0 and the M and it's inverse are both block diagonal.
This class will typically be used to compute the acceleration of a rigid body
in response to applied forces. In doing this, it is generally necessary to
consider the coriolis forces which arise as a result of the body's rotation.
Coriolis forces can be computed using either
coriolisForce
or
bodyCoriolisForce
, depending on whether the
body's velocity is stored in a fixed frame or in one which moves with the
body.
SpatialInertia M; // spatial inertia for the body RigidTransform Xbw; // transform from body to world coordinates Twist vw; // body velocity in world coordinates Twist vb; // body velocity in body coordinates Wrench fx; // external force (world coordinates) Wrench fc; // coriolis force (body coordinates) Wrench fb; // total applied force in body coordinates Twist acc; // spatial accelertion (body coodinates) double h; // time step for integrator vb.inverseTransform (Xbw.R, vw); // rotate vw to body coordinates fb.inverseTransform (Xbw.R, fx); // rotate fx to body coordinates M.coriolisForce (fc, vb); // compute fixed-frame coriolis force fb.add (fc); // add coriolis force to body force M.mulInverse (acc, fb); // solve fb = M acc // integrate using symplectic Euler step vb.scaledAdd (h, acc, vb); vw.transform (Xbw.R, vb); // rotate vb back to world coordinates vb.extrapolateTranform (Xbw, h); // use vb to update Xbw
SpatialInertia M; // spatial inertia for the body RigidTransform Xbw; // transform from body to world coordinates Twist vb; // body velocity in body coordinates Wrench fx; // external force (world coordinates) Wrench fc; // coriolis force (body coordinates) Wrench fb; // total applied force in body coordinates Twist acc; // spatial accelertion (body coodinates) double h; // time step for integrator fb.inverseTransform (Xbw.R, fx); // rotate fx to body coordinates M.bodyCoriolisForce (fc, vb); // compute body coriolis force fb.add (fc); // add coriolis force to body force M.mulInverse (acc, fb); // solve fb = M acc // integrate using symplectic Euler step vb.scaledAdd (h, acc, vb); vb.extrapolateTranform (Xbw, h); // use vb to update Xbw
The difference between this example and the previous one is quite subtle. In the first example, vb is first computed by rotating vw into body coordinates using the inverse of Xbw.R. It is then updated using the body acceleration, and then rotated back into vw using Xbw.R. After that happens, Xbw is then itself updated using vb. Now, at the beginning of the next step, when vb is recomputed from vw, we will be using a different (updated) value of Xbw.R, and so vb will be different from the value of vb that was computed at the end of the previous step. In otherwords, vb depends on Xbw.R, and so changes in Xbw.R cause vb to vary, even if vw is constant. In the body-frame example, we don't transform between vb and vw, but the variation still exists, and is instead accounted for varying the coriolis forces.
Matrix.Partition, Matrix.WriteFormat
Modifier and Type | Field and Description |
---|---|
static int |
MASS_INERTIA_STRING
Specifies a string representation of this spatial inertia consisting of a
mass, a center of mass point, and a 3 x 3 rotational inertia matrix with
respect to the center of mass.
|
static int |
MATRIX_STRING
Specifies a string representation of this spatial inertia as a 6 x 6
matrix.
|
static SpatialInertia |
UNIT |
static SpatialInertia |
ZERO |
m00, m01, m02, m03, m04, m05, m10, m11, m12, m13, m14, m15, m20, m21, m22, m23, m24, m25, m30, m31, m32, m33, m34, m35, m40, m41, m42, m43, m44, m45, m50, m51, m52, m53, m54, m55
INDEFINITE, POSITIVE_DEFINITE, SPD, SYMMETRIC
Constructor and Description |
---|
SpatialInertia()
Creates a new spatial inertia with a value of zero.
|
SpatialInertia(double m,
double Jxx,
double Jyy,
double Jzz)
Creates a new spatial inertia with a specific mass and a diagonal
rotational inertia with the indicated element values.
|
SpatialInertia(SpatialInertia inertia)
Creates a new spatial inertia with the same values as an existing one.
|
Modifier and Type | Method and Description |
---|---|
void |
add(SpatialInertia M1)
Adds this spatial inertia to M1 and places the result in this spatial
inertia.
|
void |
add(SpatialInertia M1,
SpatialInertia M2)
Adds spatial inertia M1 to M2 and places the result in this spatial
inertia.
|
void |
addLineSegmentInertia(double m,
Vector3d p0,
Vector3d p1)
Adds the inertia of a line segment to this inertia.
|
void |
addPointMass(double m,
Vector3d pos)
Adds a point mass at a specified point to this inertia.
|
static void |
addPointMass(Matrix M,
double m,
Vector3d pos)
Adds a point mass at a specified point to a 6x6 matrix representing a
spatial inertia.
|
static void |
addPointRotationalInertia(Matrix3dBase J,
double m,
Vector3d r)
Add to a rotational inertia the effect of a point mass at location r.
|
void |
addTriangleInertia(double m,
Vector3d p0,
Vector3d p1,
Vector3d p2)
Adds the inertia of a triangle to this inertia.
|
void |
bodyCoriolisForce(Wrench wr,
Twist tw)
Computes the coriolis forces induced by a given body-coordinate velocity
acting on this spatial inertia.
|
void |
coriolisForce(Wrench wr,
Twist tw)
Computes the coriolis forces induced by a given fixed-frame velocity
acting on this spatial inertia.
|
static SpatialInertia |
createBoxInertia(double m,
double wx,
double wy,
double wz)
Creates a new spatial inertia corresponding to the center of an
axis-aligned box of uniform density.
|
static SpatialInertia |
createCylinderInertia(double m,
double r,
double l)
Creates a new spatial inertia corresponding to the center of a cylinder of
uniform density aligned with the z axis.
|
static SpatialInertia |
createEllipsoidInertia(double m,
double a,
double b,
double c)
Creates a new spatial inertia corresponding to the center of an
axis-aligned ellispoid of uniform density.
|
static SpatialInertia |
createSphereInertia(double m,
double r)
Creates a new spatial inertia corresponding to the center of a sphere of
uniform density.
|
double |
directedMass(Wrench wr)
Computes the effective mass of this inertia along a specific twist
direction.
|
boolean |
equals(Matrix6dBase M1)
Returns true if the elements of this matrix exactly equal those of matrix
M1 . |
boolean |
fullEquals(SpatialInertia M)
For debugging: compares all the fields of M with the this
inertia, including the component fields that depend on the
matrix entries.
|
double |
get(int i,
int j)
Gets a single element of this matrix.
|
Point3d |
getCenterOfMass()
Gets the center of mass for this spatial inertia.
|
void |
getCenterOfMass(Vector3d com)
Gets the center of mass for this spatial inertia.
|
void |
getInverse(MatrixNd MI)
Computes the inverse of this spatial inertia matrix.
|
double |
getMass()
Gets the mass for this spatial inertia.
|
SymmetricMatrix3d |
getOffsetRotationalInertia()
Gets the rotational interia, offset by the center of mass, for this
spatial inertia.
|
void |
getRotated(Matrix6d M,
RotationMatrix3d R)
Transforms this inertia into a different frame and returns the rotated
value.
|
SymmetricMatrix3d |
getRotationalInertia()
Gets the rotational interia (with respect to the center of mass) for this
spatial inertia.
|
void |
getRotationalInertia(SymmetricMatrix3d J)
Gets the rotational inertia (with respect to the center of mass) for this
spatial inertia.
|
void |
invalidateComponents()
Invalidate the center of mass and inertia components of this spatial
inertia.
|
void |
inverseTransform(RigidTransform3d X)
Transforms this inertia into a new coordinate frame, given an inverse
spatial transformation matrix.
|
void |
inverseTransform(RotationMatrix3d R)
Rotates this inertia into a new coordinate frame, given by the inverse of
a rotation matrix.
|
static void |
invert(Matrix6d MI,
Matrix6d M)
Computes the inverse of a spatial inertia, stored in M, and
return the result in MI.
|
void |
mul(Wrench wrr,
Twist tw1)
Multiplies a twist by this spatial inertia and places the result in a
wrench:
|
void |
mulInverse(SpatialVector svr,
SpatialVector sv1)
Multiplies a spatial vector by the inverse of this spatial inertia and
places the result in another spatial vector.
|
void |
mulInverse(Twist twr,
Wrench wr1)
Multiplies a wrench by the inverse of this spatial inertia and places the
result in a twist.
|
void |
mulLeftFactor(SpatialVector svr,
SpatialVector sv1)
Multiplies a spatial vector by the left Cholesky factor of this spatial
inertia.
|
void |
mulLeftFactorInverse(SpatialVector svr,
SpatialVector sv1)
Multiplies a spatial vector by the inverse of the left Cholesky factor of
this spatial inertia.
|
void |
mulRightFactor(SpatialVector svr,
SpatialVector sv1)
Multiplies a spatial vector by the right Cholesky factor of this spatial
inertia.
|
void |
mulRightFactorInverse(SpatialVector svr,
SpatialVector sv1)
Multiplies a twist by the inverse of the right Cholesky factor of this
spatial inertia.
|
void |
scale(double s)
Scales this spatial inertia by
s in place. |
void |
scale(double s,
SpatialInertia M1)
Scales the spatial inertia M1 by
s and places the results
in this spatial inertia. |
void |
scaleDistance(double s)
Scale the distance units associated with this SpatialInertia.
|
void |
scaleMass(double s)
Scale the mass units associated with this SpatialInertia.
|
void |
scan(ReaderTokenizer rtok)
Reads the contents of this spatial inertia from a ReaderTokenizer.
|
void |
set(double[] vals)
Sets the elements of this matrix from an array of doubles.
|
void |
set(double m,
double Jxx,
double Jyy,
double Jzz)
Sets this spatial inertia to have a specific mass and a diagonal
rotational inertia with the indicated element values.
|
void |
set(double m,
SymmetricMatrix3d J)
Sets this spatial inertia to have a specific mass and rotational inertia.
|
void |
set(double m,
SymmetricMatrix3d J,
Point3d com)
Sets this spatial inertia to have a specific mass, rotational inertia, and
center of mass.
|
void |
set(int i,
int j,
double val)
Sets a single element of this spatial inertia.
|
void |
set(Matrix M)
Sets the size and values of this matrix to those of another matrix.
|
void |
set(Matrix6d M)
Sets this spatial inertia to be identical to be identical to another one.
|
void |
set(Matrix6dBase M)
Sets this spatial inertia to be identical to be identical to another one.
|
void |
set(SpatialInertia M)
Sets this spatial inertia to be identical to be identical to another one.
|
void |
setBox(double m,
double wx,
double wy,
double wz)
Sets this spatial inertia to correspond to the center of an axis-aligned
box of uniform density.
|
void |
setCenterOfMass(double x,
double y,
double z)
Sets the center of mass for this spatial inertia.
|
void |
setCenterOfMass(Point3d com)
Sets the center of mass for this spatial inertia.
|
void |
setCylinder(double m,
double r,
double l)
Sets this spatial inertia to correspond to the center of a cylinder of
uniform density aligned with the z axis.
|
void |
setEllipsoid(double m,
double a,
double b,
double c)
Sets this spatial inertia to correspond to the center of an axis-aligned
ellispoid of uniform density.
|
void |
setMass(double m)
Sets the mass for this spatial inertia.
|
void |
setPointMass(double m,
Point3d com)
Sets this spatial inertia to correspond to a point mass at a specific
point.
|
void |
setRandom()
Sets the components of this spatial inertia to uniformly distributed
random values in the range -0.5 (inclusive) to 0.5 (exclusive).
|
void |
setRandom(double lower,
double upper)
Sets the components of this spatial inertia to uniformly distributed
random values in a specified range.
|
void |
setRandom(double lower,
double upper,
java.util.Random generator)
Sets the components of this spatial inertia to uniformly distributed
random values in a specified range, using a supplied random number
generator.
|
void |
setRotationalInertia(double J00,
double J11,
double J22,
double J01,
double J02,
double J12)
Sets the rotational interia for this spatial inertia, given the diagonal
and upper off-diagonal elements
|
void |
setRotationalInertia(SymmetricMatrix3d J)
Sets the rotational interia for this spatial inertia.
|
void |
setSphere(double m,
double r)
Sets this spatial inertia to correspond to the center of a sphere of
uniform density.
|
void |
setZero()
Sets this spatial inertia to zero.
|
void |
sub(SpatialInertia M1)
Subtracts this spatial inertia from M1 and places the result in this
spatial inertia.
|
void |
sub(SpatialInertia M1,
SpatialInertia M2)
Subtracts spatial inertia M1 from M2 and places the result in this spatial
inertia.
|
java.lang.String |
toString()
Returns a string representation of this spatial inertia as a
MATRIX_STRING . |
java.lang.String |
toString(NumberFormat numberFmt,
int outputCode)
Returns a specified string representation of this spatial inertia, with
each number formatted according to the a supplied numeric format.
|
java.lang.String |
toString(java.lang.String numberFmtStr)
Returns a string representation of this spatial inertia as a
MATRIX_STRING , with each number formatted according to a
supplied numeric format. |
java.lang.String |
toString(java.lang.String numberFmtStr,
int outputCode)
Returns a specified string representation of this spatial inertia, with
each number formatted according to the a supplied numeric format.
|
java.lang.String |
toStringAll(java.lang.String fmt)
For debugging: creates a string showing this inertia and all its fields
|
void |
transform(RigidTransform3d X)
Transforms this inertia into a new coordinate frame, given a spatial
transformation matrix.
|
void |
transform(RotationMatrix3d R)
Rotates this inertia into a new coordinate frame given by a rotation
matrix.
|
void |
updateComponents() |
add, addNumNonZerosByCol, addNumNonZerosByRow, clone, createTranspose, down, getBlockCCSIndices, getBlockCCSValues, getBlockCol, getBlockCRSIndices, getBlockCRSValues, getBlockNumber, getBlockRow, mulAdd, mulTransposeAdd, next, scaledAdd, setBlockCol, setBlockNumber, setBlockRow, setDown, setNext, sub, valueIsNonZero
add, add, addObj, addSubMatrix00, addSubMatrix03, addSubMatrix30, addSubMatrix33, epsilonEquals, getSubMatrix00, getSubMatrix03, getSubMatrix30, getSubMatrix33, inverseTransform, invert, mul, mul, mulAdd, mulInverse, mulInverseBoth, mulInverseLeft, mulInverseRight, mulTranspose, mulTransposeBoth, mulTransposeLeft, mulTransposeLeftAdd, mulTransposeRight, mulTransposeRightAdd, negate, scale, scaledAddObj, scaleObj, setDiagonal, setDiagonal, setDiagonal, setLowerToUpper, setSubMatrix00, setSubMatrix03, setSubMatrix30, setSubMatrix33, sub, sub, transform, transpose
colSize, determinant, epsilonEquals, frobeniusNorm, get, get, getColumn, getColumn, getRow, getRow, infinityNorm, invert, mul, mul, mulInverse, mulInverse, mulInverseTranspose, mulInverseTranspose, mulTranspose, mulTranspose, negate, oneNorm, rowSize, scaledAdd, setColumn, setIdentity, setRow, transpose
add, checkConsistency, set, set, set, setCCSValues, setColumn, setCRSValues, setRow, setSubMatrix
containsNaN, epsilonEquals, equals, frobeniusNormSquared, get, getCCSIndices, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getCCSValues, getColumn, getCRSIndices, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getCRSValues, getDefaultFormat, getRow, getSize, getSubMatrix, hasNaN, idString, isFixedSize, isSymmetric, isWritable, maxNorm, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, scan, setCRSValues, setDefaultFormat, setSize, toString, trace, write, write, write, write, write, write, write, writeToFile
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
mulAdd, mulTransposeLeftAdd, mulTransposeRightAdd, negate
set, setColumn, setColumn, setRow, setRow, setSubMatrix
checkConsistency, colSize, determinant, epsilonEquals, equals, frobeniusNorm, frobeniusNormSquared, get, getCCSIndices, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getCCSValues, getColumn, getColumn, getColumn, getCRSIndices, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getCRSValues, getRow, getRow, getRow, getSize, getSubMatrix, infinityNorm, isFixedSize, isSymmetric, maxNorm, mul, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, oneNorm, rowSize, set, setCCSValues, setCRSValues, setSize, toString, trace, write, write, write
getThreeVectorValue
isWritable, scan, write
public static SpatialInertia ZERO
public static SpatialInertia UNIT
public static final int MASS_INERTIA_STRING
public static final int MATRIX_STRING
public SpatialInertia()
public SpatialInertia(SpatialInertia inertia)
inertia
- spatial inertia whose values are copiedpublic SpatialInertia(double m, double Jxx, double Jyy, double Jzz)
m
- massJxx
- rotational inertia about xJyy
- rotational inertia about yJzz
- rotational inertia about zpublic void set(int i, int j, double val)
set
in interface DenseMatrix
set
in class Matrix6dBase
i
- element row indexj
- element column indexval
- element valuepublic void set(double[] vals)
Matrix6dBase
(i,j)
is stored at location i*colSize()+j
.set
in interface DenseMatrix
set
in class Matrix6dBase
vals
- array from which values are copiedpublic void set(Matrix M)
Matrix6dBase
set
in interface Matrix
set
in class Matrix6dBase
M
- matrix whose size and values are copiedpublic void invalidateComponents()
public double get(int i, int j)
get
in interface Matrix
get
in class Matrix6dBase
i
- element row indexj
- element column indexpublic void updateComponents()
public void scan(ReaderTokenizer rtok) throws java.io.IOException
The first format is a set of 13 numbers giving, in order, the mass, center of mass, and rotational inertia (in row-major order).
The second format format is a set of 36 numbers giving all elements of the matrix. In interpreting these numbers, matrix structure is preserved, so that zero elements remain zero and the necessary symmetries are maintained.
scan
in interface Matrix
scan
in class MatrixBase
rtok
- ReaderTokenizer from which to read the inertia. Number parsing should be
enabled.java.io.IOException
- if an I/O error occured or if the inertia description is not consistent
with one of the above formats.public java.lang.String toString()
MATRIX_STRING
.toString
in class MatrixBase
MatrixBase.toString(String)
public java.lang.String toString(java.lang.String numberFmtStr)
MATRIX_STRING
, with each number formatted according to a
supplied numeric format.toString
in interface Matrix
toString
in class MatrixBase
numberFmtStr
- numeric format string (see NumberFormat
)NumberFormat
public java.lang.String toString(java.lang.String numberFmtStr, int outputCode)
numberFmtStr
- numeric format string (see NumberFormat
)outputCode
- desired representation, which should be either
MASS_INERTIA_STRING
or
MATRIX_STRING
public java.lang.String toString(NumberFormat numberFmt, int outputCode)
numberFmt
- numeric formatoutputCode
- desired representation, which should be either
MASS_INERTIA_STRING
or
MATRIX_STRING
public void getRotationalInertia(SymmetricMatrix3d J)
J
- returns the rotational inertiapublic SymmetricMatrix3d getRotationalInertia()
public SymmetricMatrix3d getOffsetRotationalInertia()
public void setRotationalInertia(SymmetricMatrix3d J)
J
- rotational inertia (with respect to the center of mass)public void setRotationalInertia(double J00, double J11, double J22, double J01, double J02, double J12)
J00
- element (0,0)J11
- element (1,1)J22
- element (2,2)J01
- element (0,1)J02
- element (0,2)J12
- element (1,2)public void getCenterOfMass(Vector3d com)
com
- returns the center of masspublic Point3d getCenterOfMass()
public void getRotated(Matrix6d M, RotationMatrix3d R)
M
- returns the rotated valueR
- rotation matrix describing the rotationpublic void setCenterOfMass(Point3d com)
com
- center of masspublic void setCenterOfMass(double x, double y, double z)
x
- center of mass x coordinatey
- center of mass y coordinatez
- center of mass z coordinatepublic double getMass()
public void setMass(double m)
m
- masspublic void set(Matrix6d M)
set
in interface VectorObject<Matrix6d>
set
in class Matrix6d
M
- spatial inertia to be copiedpublic void set(Matrix6dBase M)
set
in class Matrix6dBase
M
- spatial inertia to be copiedpublic void set(SpatialInertia M)
M
- spatial inertia to be copiedpublic void set(double m, SymmetricMatrix3d J)
m
- massJ
- rotational inertia (with respect to the center of mass)public void set(double m, SymmetricMatrix3d J, Point3d com)
m
- massJ
- rotational inertia (with respect to the center of mass)com
- center of masspublic void setPointMass(double m, Point3d com)
m
- masscom
- center of masspublic void set(double m, double Jxx, double Jyy, double Jzz)
m
- massJxx
- rotational inertia about xJyy
- rotational inertia about yJzz
- rotational inertia about zpublic void setSphere(double m, double r)
m
- massr
- sphere radiuspublic void setEllipsoid(double m, double a, double b, double c)
m
- massa
- semi-axis length in the x directionb
- semi-axis length in the y directionc
- semi-axis length in the z directionpublic void setBox(double m, double wx, double wy, double wz)
m
- masswx
- width along the x directionwy
- width along the y directionwz
- width along the z directionpublic void setCylinder(double m, double r, double l)
m
- massr
- radiusl
- lengthpublic void setZero()
setZero
in interface MatrixBlock
setZero
in interface VectorObject<Matrix6d>
setZero
in class Matrix6d
public void setRandom()
public void setRandom(double lower, double upper)
public void setRandom(double lower, double upper, java.util.Random generator)
public void add(SpatialInertia M1)
M1
- right-hand inertiapublic void add(SpatialInertia M1, SpatialInertia M2)
M1
- left-hand spatial inertiaM2
- right-hand spatial inertiapublic void addPointMass(double m, Vector3d pos)
m
- Mass of the point being addedpos
- Point position relative to this inertia's coordinate framepublic void addLineSegmentInertia(double m, Vector3d p0, Vector3d p1)
m
- line segment massp0
- first line segment pointp1
- second line segment pointpublic void addTriangleInertia(double m, Vector3d p0, Vector3d p1, Vector3d p2)
m
- triangle massp0
- first triangle pointp1
- second triangle pointp2
- third triangle pointpublic void sub(SpatialInertia M1)
M1
- right-hand inertiajava.lang.IllegalArgumentException
- if the resulting mass is negative or the rotational inertia is not
positive definite.public void sub(SpatialInertia M1, SpatialInertia M2)
M1
- left-hand spatial inertiaM2
- right-hand spatial inertiajava.lang.IllegalArgumentException
- if the resulting mass is negative or the rotational inertia is not
positive definite.public void scale(double s, SpatialInertia M1)
s
and places the results
in this spatial inertia.s
- scaling factorM1
- spatial inertia to be scaledjava.lang.IllegalArgumentException
- if s is negativepublic void scale(double s)
s
in place.scale
in interface MatrixBlock
scale
in class Matrix6d
s
- scaling factorjava.lang.IllegalArgumentException
- if s is negativepublic void getInverse(MatrixNd MI) throws ImproperSizeException
MI
- returns the inverse matrixImproperSizeException
- if M1 is not 6 x 6 and has a fixed sizepublic static void addPointMass(Matrix M, double m, Vector3d pos)
M
- Matrix containing the inertia. Must be a Matrix6d or a MatrixNd
with size at least 6x6.m
- Mass of the point being addedpos
- Point position relative to this inertia's coordinate framepublic static void invert(Matrix6d MI, Matrix6d M)
MI
- Matrix returning the spatial inertiaM
- Inertia to invertpublic void mul(Wrench wrr, Twist tw1)
wrr = M tw1
wrr
- result wrenchtw1
- twist to multiplypublic void mulInverse(Twist twr, Wrench wr1)
-1 twr = M wr1
twr
- result twistwr1
- wrench to multiplypublic void mulInverse(SpatialVector svr, SpatialVector sv1)
-1 svr = M sv1
svr
- resultsv1
- spatial vector to multiplypublic void mulRightFactor(SpatialVector svr, SpatialVector sv1)
svr
- resultsv1
- spatial vector to multiplypublic void mulRightFactorInverse(SpatialVector svr, SpatialVector sv1)
svr
- result twistsv1
- twist to multiplypublic void mulLeftFactor(SpatialVector svr, SpatialVector sv1)
svr
- resultsv1
- spatial vector to multiplypublic void mulLeftFactorInverse(SpatialVector svr, SpatialVector sv1)
svr
- resultsv1
- spatial vector to multiplypublic void coriolisForce(Wrench wr, Twist tw)
bodyCoriolisForce
instead.wr
- returns the coriolis forcestw
- velocity inducing the corioilis force.bodyCoriolisForce(maspack.spatialmotion.Wrench, maspack.spatialmotion.Twist)
public void bodyCoriolisForce(Wrench wr, Twist tw)
coriolisForce
instead.wr
- returns the coriolis forcestw
- velocity inducing the corioilis force.coriolisForce(maspack.spatialmotion.Wrench, maspack.spatialmotion.Twist)
public void transform(RigidTransform3d X)
X
- spatial transform from the current frame into the new framepublic void inverseTransform(RigidTransform3d X)
X
- spatial transform from the new frame into the current framepublic void transform(RotationMatrix3d R)
public void inverseTransform(RotationMatrix3d R)
inverseTransform
in class Matrix6d
R
- rotation transform from the new frame into the current framepublic void scaleDistance(double s)
s
- scaling factorpublic void scaleMass(double s)
s
- scaling factorpublic double directedMass(Wrench wr)
-1 T -1 m = ( tw M tw )where M is this spatial inertia and tw is the twist direction, which is treated as a row vector.
wr
- direction along which effective mass is to be computedpublic static SpatialInertia createSphereInertia(double m, double r)
m
- massr
- sphere radiuspublic static SpatialInertia createBoxInertia(double m, double wx, double wy, double wz)
m
- masswx
- width along the x directionwy
- width along the y directionwz
- width along the z directionpublic static SpatialInertia createCylinderInertia(double m, double r, double l)
m
- massr
- radiusl
- lengthpublic static SpatialInertia createEllipsoidInertia(double m, double a, double b, double c)
m
- massa
- semi-axis length in the x directionb
- semi-axis length in the y directionc
- semi-axis length in the z directionpublic static void addPointRotationalInertia(Matrix3dBase J, double m, Vector3d r)
public boolean equals(Matrix6dBase M1)
Matrix6dBase
M1
.equals
in class Matrix6dBase
M1
- matrix to compare withpublic boolean fullEquals(SpatialInertia M)
M
- inertia to compare withpublic java.lang.String toStringAll(java.lang.String fmt)
fmt
- numeric format