Rome
All guides
Beginner15 min

Your first teleop loop

Drive a simulated robot from the browser and stream its telemetry back. The foundation every autonomous behavior is built on.

Before a robot can be autonomous, it needs a reliable loop: send a command, the robot acts, telemetry comes back. In this guide you'll stand that loop up end to end against a simulated robot — no hardware required.

Prerequisites

  • Node.js 20.9 or newer
  • The Rome CLI (npm i -g @rome/cli)
  • Five minutes

1. Start a simulated robot

Spin up a sim robot. This gives you a virtual differential-drive base with a camera and wheel encoders:

rome sim start --robot diffbot

You'll get a local endpoint and a robot ID. Keep this terminal running.

2. Connect and send a command

Create a small script that connects to the robot and drives it forward for one second:

import { connect } from "@rome/sdk";

const robot = await connect(process.env.ROBOT_ID!);

await robot.drive({ linear: 0.4, angular: 0 }); // m/s
await new Promise((r) => setTimeout(r, 1000));
await robot.stop();

Run it. In the sim viewer, the robot should roll forward and stop. That's your command path.

3. Stream telemetry back

Now close the loop by subscribing to telemetry:

robot.on("odometry", (pose) => {
  console.log(`x=${pose.x.toFixed(2)} y=${pose.y.toFixed(2)}`);
});

You should see pose updates streaming as the robot moves. Command out, telemetry in — that's the whole loop.

What you built

You now have the exact structure every autonomous behavior extends:

  1. A command channel to the robot.
  2. A telemetry channel back.
  3. A place to put logic in between.

Next, we'll make that telemetry trustworthy by calibrating the sensors.