Skip to content

Gripper Visualize Rerun ​

SUMMARY

Visualize Rerun draws the gripper in Rerun from its URDF, or from its companion GLB/glTF for USD tools. Static geometry is uploaded once.

UNITS

tcp_transform is a 4x4 homogeneous matrix (world_T_tool_base).

The Skill ​

python
gripper.visualize_rerun(tcp_transform=None, recording_stream=None)

The Code ​

A Piab suction gripper drawn in Rerun
python
"""
Demonstrates how to visualize the meshes of a suction gripper kinematics model
in Rerun for the Synapse SDK.

Supports Piab grippers.

Usage:
    python visualize_rerun.py
    python visualize_rerun.py --save-rrd visualize_rerun.rrd
"""

import argparse

import rerun as rr

from telekinesis.synapse.tools.suction_grippers import piab


def init_rerun(app_id: str, save_rrd: str | None) -> "rr.RecordingStream":
    """Start a Rerun recording, live in the viewer or saved to an .rrd file."""
    rr.init(app_id, spawn=save_rrd is None)
    recording = rr.get_global_data_recording()
    if save_rrd:
        recording.save(save_rrd)
    return recording


def main(save_rrd: str | None = None) -> None:
    """Visualizes a Piab gripper in Rerun while translating it along +X."""

    #===================== Create Gripper ======================================
    gripper = piab.PiabPiCobotElectric()

    # =================== Visualization (Optional) ==============================
    # The first call uploads the static meshes; subsequent calls only update
    # the transforms.
    recording = init_rerun("telekinesis_synapse_visualize_rerun", save_rrd)
    gripper.visualize_rerun(recording_stream=recording)
    recording.flush()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Gripper visualization Synapse example")
    parser.add_argument("--save-rrd", type=str, default=None,
                        help="Save the Rerun recording to this .rrd file instead of opening the viewer")
    args = parser.parse_args()

    main(save_rrd=args.save_rrd)

Rerun output ​

The viewer shows a Piab PiCobot Electric suction gripper at the world origin. The static meshes are uploaded once, because the gripper does not move. Pass --save-rrd visualize_rerun.rrd to save the recording instead of opening the viewer, and open it later with rerun visualize_rerun.rrd.

Running the Example ​

bash
python visualize_rerun.py

To save the Rerun recording to a file instead of opening the viewer:

bash
python visualize_rerun.py --save-rrd visualize_rerun.rrd

For all options:

bash
python visualize_rerun.py --help

Parameter Configuration ​

ParameterTypeDefaultDescription
tcp_transformnp.ndarray | NoneNone4x4 pose of the tool base in the world. Typically robot.get_link_transforms()[robot.active_tcp]. None places the tool at the origin.
recording_streamrr.RecordingStream | NoneNoneAn existing Rerun recording to log into. None starts a new one and spawns a viewer.

Returns ​

TypeDescription
NoneThe gripper is logged to Rerun. If the tool has no model, nothing happens.

How to Tune the Parameters ​

Pass the same recording_stream the robot uses so the gripper and arm share one viewer, and update tcp_transform each frame to follow the flange.

Where to Use the Skill ​

  • Checking models - Confirm a gripper model before using it.
  • Cell visualization - Show the gripper attached to a moving arm.

When Not to Use the Skill ​