|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmaspack.matrix.MatrixObject
maspack.spatialmotion.SpatialInertia
Field Summary | |
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. |
Constructor Summary | |
SpatialInertia()
Creates a new spatial inertia with a value of zero. |
|
SpatialInertia(SpatialInertia inertia)
Creates a new spatial inertia with the same values as an existing one. |
Method Summary | |
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. |
int |
colSize()
Returns the number of columns in this matrix (which is always 6). |
void |
coriolisForce(Wrench wr,
Twist tw)
Computes the coriolis forces induced by a given velocity acting on this spatial inertia. |
double |
get(int i,
int j)
Gets a single element of this matrix. |
void |
getCenterOfMass(Point3d 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. |
void |
getRotationalInertia(SymmetricMatrix3d J)
Gets the rotational interia for this spatial inertia. |
void |
inverseTransform(RigidTransform3d X)
Transforms this inertia into a new coordinate frame, given an inverse spatial transformation matrix. |
void |
mul(Wrench wrr,
Twist tw1)
Multiplies a twist by this spatial inertia and places the result in a wrench. |
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(Wrench wrr,
Wrench wr1)
Multiplies a wrench by the left Cholesky factor of this spatial inertia. |
void |
mulLeftFactorInverse(Wrench wrr,
Wrench wr1)
Multiplies a wrench by the inverse of the left Cholesky factor of this spatial inertia. |
void |
mulRightFactor(Twist twr,
Twist tw1)
Multiplies a twist by the right Cholesky factor of this spatial inertia. |
void |
mulRightFactorInverse(Twist twr,
Twist tw1)
Multiplies a twist by the inverse of the right Cholesky factor of this spatial inertia. |
int |
rowSize()
Returns the number of rows in this matrix (which is always 6). |
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 |
scan(java.io.StreamTokenizer stok)
Reads the contents of this spatial inertia from a StreamTokenizer. |
void |
set(double m,
double Jx,
double Jy,
double Jz)
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(SpatialInertia M)
Sets this spatial inertia to be identical to be identical to another one. |
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 |
setMass(double m)
Sets the mass for this spatial inertia. |
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 |
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 6 x 6 matrix. |
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 6 x 6 matrix, 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. |
void |
transform(RigidTransform3d X)
Transforms this inertia into a new coordinate frame, given a spatial transformation matrix. |
Methods inherited from class maspack.matrix.MatrixObject |
determinant, epsilonEquals, equals, equals, frobeniusNorm, get, get, getColumn, getColumn, getRow, getRow, infinityNorm, isFixedSize, oneNorm, set, set, set, setColumn, setColumn, setRow, setRow, setSize, toString |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int MASS_INERTIA_STRING
public static final int MATRIX_STRING
Constructor Detail |
public SpatialInertia()
public SpatialInertia(SpatialInertia inertia)
inertia
- spatial inertia whose values are copiedMethod Detail |
public int colSize()
colSize
in class MatrixObject
public int rowSize()
rowSize
in class MatrixObject
public void set(int i, int j, double val)
set
in class MatrixObject
i
- element row indexj
- element column indexval
- element valuepublic double get(int i, int j)
get
in class MatrixObject
i
- element row indexj
- element column index
public void scan(java.io.StreamTokenizer stok) 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.
Note:This method disables numeric parsing in the StreamTokenizer. This is because the method does its own numeric parsing, in order to handle exponents.
scan
in class MatrixObject
stok
- StreamTokenizer from which to read the inertia
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()
toString
in class MatrixObject
public java.lang.String toString(java.lang.String numberFmtStr)
toString
in class MatrixObject
numberFmtStr
- numeric format string (see
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 inertia (with respect
to the center of mass)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(Point3d com)
com
- returns the center of masspublic 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(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 set(double m, double Jx, double Jy, double Jz)
m
- massJx
- rotational inertia about xJy
- rotational inertia about xJz
- rotational inertia about xpublic void setZero()
public void setRandom()
public void setRandom(double lower, double upper)
lower
- lower random value (inclusive)upper
- upper random value (exclusive)public void setRandom(double lower, double upper, java.util.Random generator)
lower
- lower random value (inclusive)upper
- upper random value (exclusive)generator
- random number generatorpublic void add(SpatialInertia M1)
M1
- right-hand inertiapublic void add(SpatialInertia M1, SpatialInertia M2)
M1
- left-hand spatial inertiaM2
- right-hand spatial inertiapublic void sub(SpatialInertia M1)
M1
- right-hand inertia
java.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 inertia
java.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 scaled
java.lang.IllegalArgumentException
- if s is negativepublic void scale(double s)
s
in place.
s
- scaling factor
java.lang.IllegalArgumentException
- if s is negativepublic void getInverse(MatrixNd MI) throws ImproperSizeException
MI
- returns the inverse matrix
ImproperSizeException
- if M1 is not 6 x 6 and has a fixed
sizepublic void mul(Wrench wrr, Twist tw1)
wrr
- result wrenchtw1
- twist to multiplypublic void mulInverse(Twist twr, Wrench wr1)
twr
- result twistwr1
- wrench to multiplypublic void mulRightFactor(Twist twr, Twist tw1)
twr
- result twisttw1
- twist to multiplypublic void mulRightFactorInverse(Twist twr, Twist tw1)
twr
- result twisttw1
- twist to multiplypublic void mulLeftFactor(Wrench wrr, Wrench wr1)
wrr
- result wrenchwr1
- wrench to multiplypublic void mulLeftFactorInverse(Wrench wrr, Wrench wr1)
wrr
- result wrenchwr1
- wrench to multiplypublic void coriolisForce(Wrench wr, Twist tw)
wr
- returns the coriolis forcestw
- velocity inducing the corioilis force.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 frame
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |