Spatial inertia
- class SpatialInertia(m=None, r=None, I=None)[source]
Bases:
spatialmath.baseposelist.BasePoseList
Spatial inertia class
Spatial inertia of a body in 3D space.
Operator
Operation
+
addition of spatial inertias of joined bodies
*
acceleration x inertia is force
- Seealso
SpatialM6()
,SpatialF6()
,SpatialVelocity()
,SpatialAcceleration()
,SpatialForce()
,SpatialMomentum()
.
- classmethod Alloc(n=1)
Construct an instance with N default values (BasePoseList superclass method)
- Parameters
n (int, optional) – Number of values, defaults to 1
- Return type
Self
- Returns
pose instance with
n
default values
X.Alloc(N)
creates an instance of the pose classX
withN
default values, ie.len(X)
will beN
.X
can be considered a vector of pose objects, and those elements can be referencedX[i]
or assigned toX[i] = ...
.Note
The default value depends on the pose class and is the result of the empty constructor. For
SO2
,SE2
,SO3
,SE3
it is an identity matrix, for a twist classTwist2
orTwist3
it is a zero vector, for aUnitQuaternion
orQuaternion
it is a zero vector.Example:
>>> x = X.Alloc(10) >>> len(x) 10
where
X
is any of the SMTB classes.
- classmethod Empty()
Construct an empty instance (BasePoseList superclass method)
- Return type
Self
- Returns
pose instance with zero values
Example:
>>> x = X.Empty() >>> len(x) 0
where
X
is any of the SMTB classes.
- __add__(right)[source]
Spatial inertia addition :param left: :param right: :return: :raises TypeError: attempting to add invalid type to SpatialInertia
SI1 + SI2
is the SpatialInertia of a composite body when bodies withSpatialInertia
SI1
andSI2
are connected.
- __init__(m=None, r=None, I=None)[source]
Create a new spatial inertia
- Parameters
m (float) – mass
r (3-element array_like) – centre of mass relative to link frame
I (numpy.array, shape=(6,6)) – inertia about the centre of mass, axes aligned with link frame
SpatialInertia(m, r, I)
is a spatial inertia object for a rigid-body with massm
, centre of mass atr
relative to the link frame, and an inertia matrixI
(3x3) about the centre of mass.SpatialInertia(I)
is a spatial inertia object with a value equal toI
(6x6).
- SymPy
supported
- __mul__(right)[source]
Overloaded
*
operator (superclass method)- Parameters
other (SpatialAcceleration instance) – spatial acceleration vector
- Returns
force
- Return type
SpatialForce instance if
other
is SpatialAcceleration instance- Return type
SpatialMomentum instance if
other
is SpatialVelocity instance
I * a
is the SpatialForce required for a body with SpatialInertiaI
to accelerate with the SpatialAccelerationa
.I * v
is the SpatialMomemtum of a body with SpatialInertiaI
and SpatialVelocityv
.
- __rmul__(left)[source]
Overloaded
*
operator (superclass method)- Parameters
other (SpatialAcceleration instance) – spatial acceleration vector
- Returns
force
- Return type
SpatialForce instance if
other
is SpatialAcceleration instance- Return type
SpatialMomentum instance if
other
is SpatialVelocity instance
a * I
is the SpatialForce required for a body with SpatialInertiaI
to accelerate with the SpatialAccelerationa
.v * I
is the SpatialMomemtum of a body with SpatialInertiaI
and SpatialVelocityv
.
- append(item)
Append a value to an instance (BasePoseList superclass method)
- Parameters
x (Quaternion or UnitQuaternion instance) – the value to append
- Raises
ValueError – incorrect type of appended object
Appends the argument to the object’s internal list of values.
Example:
>>> x = X.Alloc(10) >>> len(x) 10 >>> x.append(X()) # append to the list >>> len(x) 11
where
X
is any of the SMTB classes.- Return type
None
- clear() None -- remove all items from S
- extend(iterable)
Extend sequence of values in an instance (BasePoseList superclass method)
- Parameters
x (instance of same type) – the value to extend
- Raises
ValueError – incorrect type of appended object
Appends the argument’s values to the object’s internal list of values.
Example:
>>> x = X.Alloc(10) >>> len(x) 10 >>> x.append(X.Alloc(5)) # extend the list >>> len(x) 15
where
X
is any of the SMTB classes.- Return type
None
- insert(i, item)
Insert a value to an instance (BasePoseList superclass method)
- Parameters
i (int) – element to insert value before
item (instance of same type) – the value to insert
- Raises
ValueError – incorrect type of inserted value
Inserts the argument into the object’s internal list of values.
Example:
>>> x = X.Alloc(10) >>> len(x) 10 >>> x.insert(0, X()) # insert at start of list >>> len(x) 11 >>> x.insert(10, X()) # append to the list >>> len(x) 11
where
X
is any of the SMTB classes.Note
If
i
is beyond the end of the list, the item is appended to the list- Return type
None
- isvalid(x, check)[source]
Test if matrix is valid spatial inertia
- Parameters
x (numpy.ndarray) – matrix to test
check (bool) – ignored
- Returns
True if the matrix has shape (6,6).
- Return type
bool
- pop(i=- 1)
Pop value from an instance (BasePoseList superclass method)
- Parameters
i (int) – item in the list to pop, default is last
- Returns
the popped value
- Return type
instance of same type
- Raises
IndexError – if there are no values to pop
Removes a value from the value list and returns it. The original instance is modified.
Example:
>>> x = X.Alloc(10) >>> len(x) 10 >>> y = x.pop() # pop the last value x[9] >>> len(x) 9 >>> y = x.pop(0) # pop the first value x[0] >>> len(x) 8
where
X
is any of the SMTB classes.
- reverse()
S.reverse() – reverse IN PLACE
- property A: Union[List[numpy.ndarray[Any, numpy.dtype[numpy.typing._generic_alias.ScalarType]]], numpy.ndarray[Any, numpy.dtype[numpy.typing._generic_alias.ScalarType]]]
Array value of an instance (BasePoseList superclass method)
- Returns
NumPy array value of this instance
- Return type
ndarray
X.A
is a NumPy array that represents the value of this instance, and has a shape given byX.shape
.
Note
This assumes that
len(X)
== 1, ie. it is a single-valued instance.
- property shape
Shape of the object’s interal matrix representation
- Returns
(6,6)
- Return type
tuple