types

Pure-value types returned by the perception service.

#include <types.hpp>

Structs

struct Pose2D

2D robot pose (x, y in metres; yaw in radians, 0 = forward at power-on).

FieldTypeDescription
x float x position in metres
y float y position in metres
yaw float heading in radians; 0 = forward at power-on

struct DistanceScan

A horizontal distance sweep from a LiDAR or LiDAR-like sensor.

Conventions: - `angles_deg` in degrees, 0° = straight ahead, negative = left, positive = right. - `distances_m` in metres. A value of `max_range_m` means "no return" (open space / out-of-range).

Returned by DistanceDetector::GetLatestScan(). An empty scan (`ray_count() == 0`) means "no sensor data available yet" — callers should treat that the same as no obstacles known.

FieldTypeDescription
angles_deg std::vector<float> bearing of each ray in degrees; 0 = straight ahead
distances_m std::vector<float> range of each ray in metres
min_distance_m float shortest return in this scan, in metres
min_distance_angle float bearing of the shortest return, in degrees
max_distance_m float longest valid return in this scan, in metres
max_distance_angle float bearing of the longest valid return, in degrees
max_range_m float sensor's rated maximum range; rays at this value indicate no return
timestamp_s double time this scan was produced, in seconds since epoch
source_sensor_id std::string sensor that produced this scan; empty if unknown

struct PointCloud

A 3D point cloud snapshot (LiDAR, depth camera, or stereo).

Points are stored as a flat `[x1,y1,z1, x2,y2,z2, ...]` vector in metres, in the sensor's local frame.

`frame_id` indicates the reference frame: - "base_link" — robot body frame (moves with robot) - "odom" — odometry frame (fixed at power-on position) - "map" — SLAM-corrected global frame

FieldTypeDescription
points std::vector<float> flat [x,y,z, x,y,z, ...] array in metres
point_count int number of points (size of `points` / 3)
frame_id std::string reference frame: "base_link", "odom", or "map"
timestamp_s double time this cloud was captured, in seconds since epoch
point_count bool empty() const { return

struct OccupancyGrid

2D occupancy grid for navigation and display.

Each cell value: - -1 unknown (not yet observed) - 0 free (confirmed empty) - 100 occupied (obstacle detected)

Grid is row-major. Cell `(row, col)` maps to world position: `world_x = origin.x + col * resolution_m` `world_y = origin.y + row * resolution_m`

FieldTypeDescription
data std::vector<int8_t> row-major cell values: -1 unknown, 0 free, 100 occupied
width int grid width in cells
height int grid height in cells
resolution_m float size of one cell in metres
origin Pose2D world-frame pose of the grid's (0,0) corner
width bool empty() const { return data.empty() ||

struct DetectedObject

A single detected object in a camera frame.

- `label` — class name from the detector vocabulary (e.g. "person", "chair", "door", ...). - `bearing_deg` — horizontal angle from frame centre. Negative = left, positive = right. - `distance_m` — estimated distance in metres; -1 if unknown. - `confidence` — detector confidence in [0, 1]. - `width_pct` — how much of frame width the object spans (0 - 100). Useful as a coarse proximity hint when `distance_m` is unavailable.

FieldTypeDescription
label std::string class name from the detector vocabulary (e.g. "person", "chair")
bearing_deg float horizontal angle from frame centre; negative = left, positive = right
distance_m float estimated distance in metres; -1 if unknown
confidence float detector confidence in [0, 1]
width_pct float fraction of frame width the object spans (0–100); coarse proximity hint

struct Scene

A symbolic description of what a single camera frame contains.

This is the perception-service equivalent of a "scene" — the output of running an object-detection pipeline once over an image.

`free_left`, `free_center`, `free_right` give coarse estimated free space (in metres) in each third of the frame; -1 means "unknown". Useful for navigation heuristics when distance sensors aren't fused in yet.

FieldTypeDescription
objects std::vector<DetectedObject> detected objects in this frame
free_left float estimated free space in metres, left third of frame; -1 if unknown
free_center float estimated free space in metres, centre of frame; -1 if unknown
free_right float estimated free space in metres, right third of frame; -1 if unknown
room_type std::string coarse scene classification label
timestamp_s double time this scene was produced, in seconds since epoch