Skip to content
esc
Start typing to search the docs
Navigate Open

The experiment loop

Teleoperation over LiveKit

Teleoperate a remote robot over LiveKit and keep a complete recording of every episode.

This example drives a simulated quadruped over LiveKit. The robot logs, as normal, with the Rerun SDK. The stream is both saved as a complete recording and forwarded over a latency-optimized bridge to the remote operator's Rerun Viewer.

Introduction

Remote teleoperation often involves poor network connections, and the operator needs to see the robot with as little latency as possible.

A recording needs every message, in order, but if the network connection is not sufficient, a stream that enforces this falls behind the robot, leading to unacceptable latency.

In this example the rerun_livekit bridge forwards a copy of the stream to the operator through LiveKit, compressing and dropping data as needed to keep the latency low.

The robot is a Unitree Go2 quadruped, simulated in MuJoCo. It walks under a pretrained policy from MuJoCo Playground, and you steer it from a keyboard on the operator's side.

The example covers the four parts of collecting an episode:

  1. Record on the robot, to a file and to the bridge.
  2. Stream to the operator's Viewer, optimizing for low latency over fidelity.
  3. Drive with commands that go back through the same LiveKit room.
  4. Register both ends as two layers of one segment in a catalog.

Recording on the robot

The robot logs one stream to two sinks: an .rrd file with every message as it was logged, and a Rerun proxy (rerun --serve-grpc) that the bridge reads from.

Rerun's MJCF importer reads the same model file that MuJoCo simulates, so the robot in the Viewer is the robot in the simulation.

Streaming to the operator

On the robot, a Rerun recording stream runs inside your robot code and has two sinks: a file sink that saves the recording, and a gRPC sink to a Rerun proxy that the bridge reads from. Video and data go over WebRTC through a LiveKit room to the operator's side of the bridge, which feeds the Rerun Viewer over gRPC. Commands from the operator's input device travel back through the room to the bridge on the robot, which hands them to your robot code over UDP. On the robot, a Rerun recording stream runs inside your robot code and has two sinks: a file sink that saves the recording, and a gRPC sink to a Rerun proxy that the bridge reads from. Video and data go over WebRTC through a LiveKit room to the operator's side of the bridge, which feeds the Rerun Viewer over gRPC. Commands from the operator's input device travel back through the room to the bridge on the robot, which hands them to your robot code over UDP.

The bridge forwards the stream through a LiveKit room, over WebRTC. Images travel as video that adapts to the link, other data such as the lidar scans is sent on a lossy channel that skips old messages rather than waiting on them, and blueprints and static data are sent reliably. The operator's Viewer receives the same recording, with the same entity paths and timelines.

The video at the top shows the operator's Viewer, with the latency of what arrives plotted by the bridge (--plot-latency). From 14 s to 21 s in that plot the camera falls about half a second behind, while the other data keeps arriving within 20 ms, so the 3D view stays current.

Driving the robot

The robot logs each command it receives next to the velocity it measured, so an episode holds the actions and the observations on one timeline.

Two plots from the Viewer: the commanded forward velocity as a step with the measured velocity rippling around it, and the commanded turn rate as steps to the left and right with the measured turn rate following them

Both ends in one segment

The operator's end can record too: what reached it, with lossy video and without the frames that were dropped on the way. Both recordings keep the same recording ID, so they become two layers of one segment in a Rerun catalog. The robot layer is everything the robot logged. The operator layer adds the images that reached the operator and the latency of every frame.

One segment in the Viewer: the robot's sharp camera image next to the blurrier one that reached the operator, above the robot in 3D among its lidar points and plots of the latency and the forward velocity

Opening the segment shows the robot's camera next to the operator's view on one timeline, so you can check what the operator saw at any moment of an episode.

Run the code

This is an external example. Check the repository for more information.

The repository includes the simulated robot and a keyboard driver, so everything runs on one machine. Try it out walks through driving the robot, Record through recording on both ends, and Both ends in one segment through registering an episode in a local catalog.

To use the bridge with your own robot, the repository also covers:

The robot model comes from MuJoCo Menagerie and the policy from MuJoCo Playground.