Skip to content

novaphy.spatial_inertia_matrix

Build the 6 × 6 spatial inertia matrix from a body's mass, center of mass, and 3 × 3 inertia tensor. Convention: 6D motion vectors are stored as [linear(3); angular(3)].

def spatial_inertia_matrix(
    mass: float,
    com: np.ndarray,
    I_rot: np.ndarray,
) -> np.ndarray

Parameters

Parameter Description
mass Body mass [kg].
com Center of mass [m] expressed in the same frame as the inertia tensor.
I_rot 3 × 3 rotational inertia tensor about the COM [kg · m²].

Returns

A (6, 6) spatial inertia matrix M such that for a spatial motion vector v = [lin; ω], the kinetic-energy-like product v.T @ M @ v uses NovaPhy's linear-first convention.

Example

import numpy as np
import novaphy

mass    = 1.5
com     = np.array([0.0, 0.05, 0.0], dtype=np.float32)
I_rot   = np.diag([0.01, 0.005, 0.01]).astype(np.float32)

I_sp = novaphy.spatial_inertia_matrix(mass, com, I_rot)
print(I_sp.shape)   # (6, 6)

Notes

  • I_rot must be the rotational inertia about the COM. Pass a zero com only when the selected frame origin coincides with the COM. If the available tensor is about another origin, first undo that parallel-axis shift to recover the COM tensor.
  • Used internally by Featherstone kernels and eval_mass_matrix.

See Also