Skip to content
Design System
GitHub

Robot map

v0.24.1Beta

A site floor plan in metres, drawn in SVG with no map library: a ROS occupancy grid and costmap as the floor, laser scans, zones as outlines with icon and name, planned and travelled routes, robots as status shapes with heading and name, selection, pan and zoom by drag, wheel, pinch, buttons and keys, a scale bar and an optional north arrow; goal, waypoint and zone editing by pointer and keys; RobotMapList shows the same robots as text.

API reference

Generated from the types. Every part also takes className.

RobotMap

labelrequired
stringNames the map for screen readers: "Map of North site".
width
numberThe site's size in metres: the plan's width and height. With grid and no plan of its own, leave them out: the grid's size is the plan's.
height
number
floorplan
ReactNodeThe floor plan under everything: an image URL (stretched over width × height), or SVG drawn in metres.
grid
RobotMapGridA ROS occupancy grid drawn as the floor (under floorplan, when both are given): free cells are the map's surface, occupied ones a muted grey at their probability, unknown ones the no-data hatch. Drawn into an image once per new data array, so pass a new array for new cells and the same one otherwise.
costmap
RobotMapGridA ROS costmap (the same message) over the floor, in the accent's ramp from clear to strong, with a legend. It is drawn over floorplan and grid; with a grid and no floorplan, under the grid's obstacles, so walls stay grey over their lethal cost. (A floorplan covers the grid, obstacles and all, so with both the cost is over everything on the floor.)
scans
RobotMapScan[] = []Laser scans, one per robot, drawn as small dots from that robot's current position and heading. One path per scan, so 10 robots × 1080 beams stay smooth.
scanColor
"foreground" | "muted-foreground" | "map-point" | "chart-1" = "foreground"The dots' ink, from the tokens: the ink colour by default; never a status colour.
origin
{ x: number; y: number; }Where the plan's bottom-left corner is in the ROS map frame, in metres: places grid and costmap on it. Without it, the grid's origin (the grid is the plan).
zones
RobotMapZone[] = []
robots
RobotMapRobot[] = []
paths
RobotMapPath[] = []
selectedId
stringThe selected robot, controlled; null for none. Without it the map keeps its own selection.
onSelect
(id: string | null, robot?: RobotMapRobot) => voidCalled with the robot clicked, or null when the background is clicked or Esc pressed.
northDeg
numberWhere north is, in degrees clockwise from the top of the plan. Without it no north arrow is drawn.
loading
booleanBones in the frame while the map loads.
error
ReactNodeThe map could not be loaded: says so in the frame (true for the default words, or your own message).
onRetry
() => voidShows a button under the error that tries again.
fill
booleanFill the parent's height (a full-screen map) instead of keeping the site's proportions.
mode
"view" | "goal" | "waypoints" | "zone" = "view"What a click (or Enter at the keyboard crosshair) does. view (the default) selects robots. goal places a goal and a drag points it; waypoints adds, moves and removes waypoints; zone draws a zone corner by corner. In an edit mode the primary pointer edits and the right or middle button, or two fingers, pan; the wheel and the buttons still zoom.
goal
{ x: number; y: number; heading?: number }The goal to show, controlled: a target and the way to face, in plan metres.
onGoal
(goal: RobotMapPose) => voidGoal mode: the goal placed, on release (or Enter). heading is left out when the press did not drag.
waypoints
RobotMapPoint[] = []Waypoints to show, numbered in order, controlled.
onWaypointsChange
(waypoints: RobotMapPoint[]) => voidWaypoints mode: the new list after a waypoint is added, moved (while it moves) or removed. A move that is cancelled (Esc, a second finger, a cancelled pointer) sends the list again with the waypoint where it was.
waypointsPlanned
booleanThe waypoints are the route a robot is driving: the line between them turns the in-progress blue. Otherwise it is grey.
onZoneDraw
(points: RobotMapPoint[]) => voidZone mode: a new zone's corners, once it is closed. Ask for its name and kind and add it to zones.
editableZones
booleanZone mode: the corners of zones can be dragged (or picked up with Enter and moved with the arrows).
onZonesChange
(zones: RobotMapZone[]) => voidThe zones with a corner moved, while it moves; a cancelled move sends them again with the corner where it was.
snap
numberRounds every point placed or moved to this many metres. None by default.
labels
Partial<RobotMapLabels>

RobotMapList

Also takes every prop of Pick<RobotMapProps, "label" | "robots" | "zones" | "selectedId" | "onSelect" | "loading" | "error" | "onRetry" | "labels" | "className">.

labelrequired
stringNames the map for screen readers: "Map of North site".
onSelect
(id: string | null, robot?: RobotMapRobot) => voidCalled with the robot clicked, or null when the background is clicked or Esc pressed.
loading
booleanBones in the frame while the map loads.
error
ReactNodeThe map could not be loaded: says so in the frame (true for the default words, or your own message).
labels
Partial<RobotMapLabels>
robots
RobotMapRobot[] = []
zones
RobotMapZone[] = []
selectedId
stringThe selected robot, controlled; null for none. Without it the map keeps its own selection.
onRetry
() => voidShows a button under the error that tries again.