Loading URDF models

Rerun features a built-in data-loader for URDF files.

A robot model loaded from an URDF file visualized in Rerun.

Overview overview

Using a URDF in Rerun only requires you to load the file with the logging API. This will automatically invoke the data-loader, which will take care of:

  • resolving paths to meshes
  • loading meshes and shapes as Rerun entities
  • loading the joint transforms and associated frame IDs of links

Once that is done, the joints can be updated by sending Transform3Ds, where you have to set the parent_frame and child_frame fields explicitly to each joint's specific frame IDs.

⚠️ Note: previous versions (< 0.28) required you to send transforms with implicit frame IDs, i.e. having to send each joint transform on a specific entity path. This was dropped in favor of named frame IDs, which is more in line with ROS and allows you to send all transform updates on one entity (e.g. a transforms entity like in the example below).

Example example

Here is an example that demonstrates how to load and update a URDF with the Python SDK:

from pathlib import Path

import rerun as rr
from rerun import RecordingStream

with RecordingStream("rerun_example_load_urdf") as rec:
    rec.spawn()

    # `log_file_from_path` automatically uses the built-in URDF data-loader.
    urdf_path = Path(__file__).parent / "minimal.urdf"
    rec.log_file_from_path(urdf_path, static=True)
    # Ensure the URDF is fully processed for testing consistency.
    rec.flush()

    # Later, in your logging code, you'll update the joints using transforms.
    # A minimal example for updating a revolute joint that connects two links:
    joint_axis = [0, 0, 1]  # comes from URDF
    joint_angle = 1.216  # radians
    origin_xyz = [0, 0, 0.1]  # comes from URDF
    # Make sure that `parent_frame` and `child_frame` match the joint's frame IDs in the URDF file.
    rec.log(
        "transforms",
        rr.Transform3D(
            rotation=rr.RotationAxisAngle(axis=joint_axis, angle=joint_angle),
            translation=origin_xyz,
            parent_frame="base_link",
            child_frame="child_link",
        ),
    )

For similar code in Rust, we have a full example here.

Load URDF into an existing recording load-urdf-into-an-existing-recording

If you already have a recording with transforms loaded in Rerun and want to add an URDF to it, you can do so via drag-and-drop or the menu ("Import into current recording").

For example in this video, we have loaded an ROS 2 .mcap file with TF messages that automatically get translated into Rerun Transform3D. We can then simply drag the corresponding URDF models into the viewer:

References references