Skip to content
Design System
GitHub

React hooks over the ros client: RosProvider, useRosStatus, useRosTopic (the latest message, through useSyncExternalStore), useRosPublisher (a stable publish function; a zero Twist on unmount, hidden page and dropped link for cmd_vel) and useRosService (a call with a timeout).

Disconnectedws://robot.local:9090

Loading the map

Loading the map

Hold to drive. Release to stop. Arrow keys or W A S D drive while held. Space stops.

Hold to drive

Arm · UR10e

Loading joint states…

Use ros console

Install
npx shadcn add @syncrobotic/use-ros

Also installs: @syncrobotic/ros

Overview

ROS and ROS 2 data in React over rosbridge, with no ROS library: RosProvider holds one connection, useRosTopic returns a topic's latest message, useRosPublisher a stable publish function (a zero Twist when a drive stops), useRosService a call with a timeout, and useRosStatus the connection's state in words.

When to use

  • A robot's page or console fed live from its robot: the map, the pose, the scan, the joints.
  • Driving by hand: Teleop pad publishing /cmd_vel.
  • Calling a robot's services (dock, reset localisation) from a button.

Use something else

  • A fleet seen through your own backend (REST, GraphQL, MQTT): pass the backend's data to the components; this connects a browser to one robot's rosbridge.
  • The converters alone, outside React (a worker, a server, another bridge): ROS.
  • Video: Camera feed over WebRTC or a stream URL; rosbridge is not for frames.

Usage rules

  • One RosProvider per rosbridge server, high in the tree; the hooks share its one connection. The whole wiring, with the safety notes, is on the Connect to ROS page (/docs/ros).
  • Show the connection's state in words and shape wherever the robot is driven or watched: Connected, Connecting (the blue spinner), Connection lost with Reconnect. A view that keeps the last message while the link is down must say so.
  • Convert a message once per message (useMemo keyed on it): robot-map draws the grid again for every new array.
  • Drive commands go through useRosPublisher on a Twist topic: it sends a zero Twist on unmount, on a hidden page and on a dropped link, and refuses a drive held through a drop until the stick is let go. rosbridge has no watchdog: the robot must stop by itself when commands stop arriving.
  • Throttle what people read (throttleMs: 200 for a scan, 1000 for a battery); never throttle what someone is steering by.

Changelog

  • 0.27.02026-11-21First release.

How to upgrade