Skip to content

novaphy.RigidBody

Rigid-body inertial parameters expressed in body-local coordinates. Holds mass, COM, inertia tensor, and per-body damping coefficients. Used by forward_kinematics / mass_matrix_crba / forward_dynamics, and by the legacy direct-add path in ModelBuilder.

Prefer the builder shape API for new code

For Newton-aligned scene construction, prefer

idx = builder.add_link(xform=t)
builder.add_shape_box(idx, hx=0.5, hy=0.5, hz=0.5,
                      cfg=novaphy.ShapeConfig(density=1000))

add_shape_* derives mass / inertia from geometry × density at finalize(). The RigidBody.from_* factories below are still supported for direct Featherstone APIs that consume RigidBody lists (forward_kinematics, mass_matrix_crba, …).

Constructors

Constructor Description
RigidBody() Default body with unit mass and identity inertia.
RigidBody.from_box(mass, half_extents) Body with solid-box inertia tensor.
RigidBody.from_sphere(mass, radius) Body with isotropic solid-sphere inertia.
RigidBody.from_cylinder(mass, radius, length, axis) Body with cylinder inertia along the requested axis.
RigidBody.make_static() Immovable body with non-positive mass; marks the body as static.

Properties

Property Description
mass Body mass [kg].
com Center of mass [m] in body-local frame.
inertia 3 × 3 inertia tensor about the COM in body-local coordinates [kg · m²].
linear_damping Linear-velocity damping coefficient applied during integration.
angular_damping Angular-velocity damping coefficient.

Methods

Method Description
inv_mass() Returns inverse mass [kg⁻¹]; 0 for static bodies.
inv_inertia() Returns the inverse inertia tensor; zero matrix for static bodies.
is_static() True when mass <= 0.

Example

import numpy as np
import novaphy

body = novaphy.RigidBody.from_box(2.0, np.array([0.5, 0.25, 0.5], dtype=np.float32))
body.linear_damping  = 0.05
body.angular_damping = 0.05

print("static:", body.is_static(), "inv_mass:", body.inv_mass())

See Also