Skip to content

Get Publisher Names and Types ​

SUMMARY

Pass name=... when constructing any Synapse robot and it automatically streams joint state, TCP pose, and link transforms over Zenoh using BabyROS - no manual publisher setup required. get_publisher_names_and_types reads back the topic names and message types that background publisher exposes, so a BabyROS subscriber knows exactly what to subscribe to.

The Skill ​

python
robot.get_publisher_names_and_types()

Topics Published ​

TopicContents
synapse/robots/<ClassName>/<name>/stateThe full state: joint positions, velocities and torques, TCP pose, speed and force, the target setpoints, and a timestamp.
synapse/robots/<ClassName>/<name>/tfNamespaced link transforms for the full kinematic tree.

See Subscribe to State and TF for the message contents and how to receive them.

<ClassName> is the robot's Python class name (e.g. UniversalRobotsUR10E) and <name> is the string passed to the constructor. get_publisher_names_and_types returns these topic names together with their message types.

The Code ​

A UR10e manipulator with its published BabyROS topics and message types listed beside the robot
python
"""
Logs the babyros topics published by a named robot and their message types.

Supports Universal Robots (UR), Epson, virtual, and Isaac Sim.

Usage:
    python get_publisher_names_and_types.py [--ip <ROBOT_IP>] [--prim_path <PRIM_PATH>]
    python get_publisher_names_and_types.py --save-rrd get_publisher_names_and_types.rrd
"""

import argparse

import rerun as rr
from loguru import logger

from telekinesis.synapse.robots.manipulators import universal_robots


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(ip: str | None, prim_path: str | None, save_rrd: str | None) -> None:
    """Log the babyros topics published by a named robot."""

    #===================== Start Rerun ==========================================
    recording = init_rerun("telekinesis_synapse_get_publisher_names_and_types", save_rrd)

    #===================== Create Robot ==========================================
    robot = universal_robots.UniversalRobotsUR10E(name='UR10e')

    try:
        #===================== Connect Robot ==========================================
        if ip:
            robot.connect(ip=ip)
        elif prim_path:
            robot.connect(simulation_prim_path=prim_path)

        # ==================== Run Skill ============================================
        names_and_types = robot.get_publisher_names_and_types()
        logger.success(f"publisher_names_and_types: {names_and_types}")

        # ==================== Visualization (Optional) =============================
        # The robot is drawn once, and each published topic is listed beside it with its type.
        robot.visualize_rerun(recording_stream=recording, live=False)
        labels = [f"{topic} ({message_type.__name__})" for topic, message_type in names_and_types]
        label_positions = [[-0.5, 0.0, 1.1 - 0.1 * i] for i in range(len(labels))]
        rr.log("/publisher_names_and_types", rr.Points3D(label_positions, labels=labels, radii=0.005))
    except (ConnectionError, OSError) as e:
        logger.error(f"Error occurred: {e}")
    finally:
        robot.disconnect()
        robot.shutdown()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Read publisher names and types Synapse example")
    parser.add_argument("--ip", type=str, default=None,
                         help="UR robot IP address for real hardware, e.g. 192.168.1.100")
    parser.add_argument("--prim_path", type=str, default=None,
                         help='Isaac Sim articulation prim path, e.g. "/World/ur10e"')
    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(ip=args.ip, prim_path=args.prim_path, save_rrd=args.save_rrd)

Rerun output ​

The viewer shows the UR10e and the two topics it publishes, the state topic and the TF topic, listed beside it, each with its message type. Pass --save-rrd get_publisher_names_and_types.rrd to save the recording instead of opening the viewer, and open it later with rerun get_publisher_names_and_types.rrd.

Running the Example ​

bash
python get_publisher_names_and_types.py
bash
python get_publisher_names_and_types.py --prim_path /World/ur10e
bash
python get_publisher_names_and_types.py --ip 192.168.1.100

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

bash
python get_publisher_names_and_types.py --save-rrd get_publisher_names_and_types.rrd

For all options:

bash
python get_publisher_names_and_types.py --help

Parameter Configuration ​

This skill takes no input parameters.

Returns ​

TypeDescription
list[tuple[str, type]](topic_name, message_type) pairs describing every topic the background publisher is currently emitting - the same state and tf topics listed above. Returns an empty list if the robot was constructed without a name (no publisher exists).

Where to Use the Skill ​

  • Dynamic subscriber setup - Build a BabyROS subscriber without hardcoding topic names or message types.
  • Remote monitoring - Discover what a robot is streaming before wiring up a dashboard or logging service.
  • Digital twin - Confirm the topics feeding a Rerun visualization match what you expect from a separate process.

When Not to Use the Skill ​