Skip to main content

Localization API

Endpoints for retrieving robot localization data including pose, laser scans, paths, and costmaps.

Get Robot Pose

GET /api/robots/{robotId}/localization/pose

Returns the robot's current position and orientation.

Response

{
"x": 12.5,
"y": 3.2,
"theta": 1.57,
"frameId": "map",
"ts": 1710000000000,
"mapId": "warehouse-floor-1",
"xPixels": 250,
"yPixels": 64,
"mapDataHash": "abc123def456"
}

Response Fields

FieldTypeDescription
xnumberX position in meters (map frame)
ynumberY position in meters (map frame)
thetanumberOrientation in radians
frameIdstringCoordinate frame ID
tsnumberPose timestamp (epoch milliseconds)
mapIdstringCurrent map identifier
xPixelsnumberX position in pixels — only present when the robot's current map is loaded and matches mapId
yPixelsnumberY position in pixels — same condition as xPixels
mapDataHashstringHash of the current map data — same condition as xPixels

Errors

StatusCondition
403User lacks view access to this robot
404Pose data does not exist for this robot

Example

curl -H "x-auth-api-key: YOUR_KEY" \
http://localhost:3000/api/robots/robot_abc123/localization/pose

Get Full Localization

GET /api/robots/{robotId}/localization/full

Returns comprehensive localization data including pose, laser scans, paths, and costmaps. You can selectively include specific data types.

Query Parameters

ParameterTypeDescription
includestring (repeatable)Data fields to include. If omitted, all fields are returned.

Valid include values

ValueDescription
poseRobot position and orientation
lasersLaser scan data
pathsRobot path data
costmapCostmap data

Response

{
"pose": {
"x": 12.5,
"y": 3.2,
"theta": 1.57,
"frameId": "map",
"ts": 1710000000000,
"mapId": "warehouse-floor-1"
},
"lasers": [
{
"id": "front_laser",
"runs": [10, 5, 8],
"values": [1.2, 3.4, 0.8],
"ts": 1710000000000
}
],
"paths": [
{
"id": "planned_path",
"points": [
{ "x": 12.5, "y": 3.2 },
{ "x": 14.0, "y": 5.1 }
],
"ts": 1710000000000
}
],
"costmap": { }
}

Sections that are unavailable for the robot — or not requested via include — are omitted from the response entirely rather than returned as empty objects. costmap is returned as stored (position, dimensions, resolution, timestamp, and base64 PNG data).

Examples

# Get all localization data
curl -H "x-auth-api-key: YOUR_KEY" \
http://localhost:3000/api/robots/robot_abc123/localization/full

# Get only pose and laser data
curl -H "x-auth-api-key: YOUR_KEY" \
"http://localhost:3000/api/robots/robot_abc123/localization/full?include=pose&include=lasers"

Errors

StatusCondition
400Invalid field in the include list
403User lacks view access to this robot