Fixing URDF inertia and collision meshes
A URDF can load fine and still simulate terribly. Nine times out of ten the culprit is the inertial block or the collision mesh. Here's how to get both right.
The inertial block
Every link needs an <inertial> block: a mass, a center-of-mass origin, and a 3×3 inertia tensor (given as six values — ixx ixy ixz iyy iyz izz). The simulator integrates the equations of motion from these numbers, so if they're wrong the robot behaves wrong — even though the XML is valid.
<inertial>
<origin xyz="0 0 0.05" rpy="0 0 0"/>
<mass value="1.2"/>
<inertia ixx="0.004" ixy="0" ixz="0"
iyy="0.004" iyz="0" izz="0.002"/>
</inertial>
Common inertia mistakes
- Placeholder values. Copy-pasted
ixx=iyy=izz=1(or tiny0.001) blocks are everywhere. They're almost never physically consistent with the link's mass and shape. - CoM at the origin. The center of mass is rarely at the link origin. Getting the
<origin>of the inertial block wrong shifts the dynamics. - Wrong frame. The tensor must be expressed about the center of mass in the link frame. Mixing frames gives a valid-looking but wrong tensor.
- Degenerate tensors. Zero or negative principal moments, or values that violate the triangle inequality, make solvers explode.
Computing it correctly
The right way is to compute the tensor from the actual geometry and material. For a mesh, Mirtich's algorithm gives the exact mass, center of mass and inertia tensor of a polyhedron in one pass. If you know the real measured mass, scale the density so the computed mass matches — that corrects for hollow parts and infill.
Collision meshes
A link's <visual> mesh is for looks; its <collision> mesh is for physics. Reusing the detailed visual mesh for collision is the second big mistake:
- Speed. Collision checking against thousands of triangles every timestep is slow.
- Concavity. Most collision engines treat meshes as convex or need explicit convex decomposition; a raw concave visual mesh collides incorrectly.
- Robustness. Thin or non-watertight visual meshes cause tunnelling and missed contacts.
The fix
Replace visual meshes with simplified collision geometry:
- Primitives (box, cylinder, sphere) where a link is roughly that shape — fastest and most stable.
- Convex hulls for irregular links.
- Convex decomposition (e.g. CoACD/V-HACD) for concave links that need it — a set of convex pieces approximating the shape.
Doing it automatically
Jointly computes the full inertia tensor from your CAD with Mirtich's method and generates convex collision meshes as part of the conversion — so the URDF it exports is already simulation-stable, not just syntactically valid.
Skip the manual work
Jointly does everything on this page automatically: drop in your CAD (STEP, mesh, SolidWorks or Onshape), and it infers joints, axes, inertia and collision, then exports a simulation-ready URDF, SDF, MJCF or USD. The first conversions are free.
Try Jointly free →Validate before you trust it
- Drop the robot in simulation with gravity and no actuation — it should settle, not jitter or launch.
- Compare total mass and CoM to the real hardware.
- Watch collision behaviour at joint extremes; look for interpenetration or ground clipping.