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 class X with N default values, ie. len(X) will be N.

X can be considered a vector of pose objects, and those elements can be referenced X[i] or assigned to X[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 class Twist2 or Twist3 it is a zero vector, for a UnitQuaternion or Quaternion 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 with

    SpatialInertia SI1 and SI2 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 mass m, centre of mass at r relative to the link frame, and an inertia matrix I (3x3) about the centre of mass.

  • SpatialInertia(I) is a spatial inertia object with a value equal to I (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 SpatialInertia I to accelerate with the SpatialAcceleration a.

  • I * v is the SpatialMomemtum of a body with SpatialInertia I and SpatialVelocity v.

__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 SpatialInertia I to accelerate with the SpatialAcceleration a.

  • v * I is the SpatialMomemtum of a body with SpatialInertia I and SpatialVelocity v.

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
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 by X.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