Inertia

class urdfgenpy.InertiaMatrix(ixx, ixy, ixz, iyy, iyz, izz)[source]

Bases: object

Symmetric 3x3 inertia tensor stored as its six unique components.

Parameters:
  • ixx (float) – Moment of inertia about the X axis (kg·m²).

  • ixy (float) – Product of inertia XY (kg·m²).

  • ixz (float) – Product of inertia XZ (kg·m²).

  • iyy (float) – Moment of inertia about the Y axis (kg·m²).

  • iyz (float) – Product of inertia YZ (kg·m²).

  • izz (float) – Moment of inertia about the Z axis (kg·m²).

ixx: float
ixy: float
ixz: float
iyy: float
iyz: float
izz: float
to_xml(indent='    ')[source]

Return the ‘<inertia>’ XML element string.

Parameters:

indent (str) – Leading whitespace prepended to the element.

Return type:

str

Returns:

A single-line ‘<inertia … />’ XML string.

urdfgenpy.box_inertia(m, length, w, h, inertia_multiply=1.0)[source]

Compute the inertia tensor for a solid box about its centre of mass.

Parameters:
  • m (float) – Mass in kg.

  • length (float) – Dimension along the X axis (metres).

  • w (float) – Dimension along the Y axis (metres).

  • h (float) – Dimension along the Z axis (metres).

  • inertia_multiply (float) – Scalar multiplier applied to all components (default 1.0).

Return type:

InertiaMatrix

Returns:

An – class:’InertiaMatrix’ for the box.

urdfgenpy.sphere_inertia(m, r, inertia_multiply=1.0)[source]

Compute the inertia tensor for a solid sphere about its centre of mass.

Parameters:
  • m (float) – Mass in kg.

  • r (float) – Radius in metres.

  • inertia_multiply (float) – Scalar multiplier applied to all components (default 1.0).

Return type:

InertiaMatrix

Returns:

An – class:’InertiaMatrix’ for the sphere.

urdfgenpy.cylinder_inertia(m, r, h, inertia_multiply=1.0)[source]

Compute the inertia tensor for a solid cylinder about its centre of mass.

The symmetry axis is aligned with Z.

Parameters:
  • m (float) – Mass in kg.

  • r (float) – Radius in metres.

  • h (float) – Height (length along Z) in metres.

  • inertia_multiply (float) – Scalar multiplier applied to all components (default 1.0).

Return type:

InertiaMatrix

Returns:

An – class:’InertiaMatrix’ for the cylinder.