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
[angular(3); linear(3)].
Parameters¶
| Parameter | Description |
|---|---|
mass |
Body mass [kg]. |
com |
Center of mass [m] expressed in the same frame as the inertia tensor. |
inertia |
3 × 3 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 matches Featherstone's convention.
Example¶
import numpy as np
import novaphy
mass = 1.5
com = np.array([0.0, 0.05, 0.0], dtype=np.float32)
inertia = np.diag([0.01, 0.005, 0.01]).astype(np.float32)
I_sp = novaphy.spatial_inertia_matrix(mass, com, inertia)
print(I_sp.shape) # (6, 6)
Notes¶
- The COM offset shifts the inertia via the parallel-axis theorem; pass COM = origin if your inertia tensor is already centered at the origin.
- Used internally by forward_dynamics and mass_matrix_crba.