URDF

An example of how to load and animate a URDF given some changing joint angles.

Logging and visualizing with Rerun logging-and-visualizing-with-rerun

This example demonstrates how to:

  1. Load and log a URDF file as a static resource
  2. Parse the URDF structure using UrdfTree
  3. Animate joints by logging dynamic transforms

The key steps are:

import rerun as rr
import rerun.urdf import UrdfTree

# Log the URDF file once, as a static resource
rec.log_file_from_path(urdf_path, static=True)

# Load the URDF tree structure into memory
urdf_tree = UrdfTree.from_file_path(urdf_path)

# Animate joints by logging transforms
for joint in urdf_tree.joints():
    if joint.joint_type == "revolute":
        # compute_transform gives you a complete transform that is ready to log,
        # calculated from joint origin and the current angle and with the frame names set.
        transform = joint.compute_transform(angle)
        rec.log("transforms", transform)