Gateway API¶
The Gateway API is the locked unary gRPC/protobuf contract through which operator laptop tools use the robot gateway. It carries bounded control requests and normalized status, preserving the gateway as the sole external boundary to the private ROS 2 graph. Preview video remains outside this API on SRT and is documented separately in Preview streaming.
Implementation¶
The implemented API uses:
- gRPC for control and state
- protocol buffers for the external contract
- SRT for preview video transport outside the gRPC service
The locked proto lives at
ros_ws/src/robot_diag_control/robot_diag_control/api/robot_gateway.proto.
Generated Python code is packaged with robot_diag_control, and generated C++
code is linked into robot_diag_control_cpp.
The C++ server implementation contains:
- one synchronous unary gRPC server
- one
RobotGatewayService - one cache-backed
GatewayStateStore - a ROS-backed node that feeds
/vision/perf, filtered odometry, detections, and battery state into the store - a platform sampler for compute, Wi-Fi, LiPo, and onboard battery diagnostics
- a parameter-driven preview subprocess manager behind
SetPreviewMode; it selects either softwarex264encor Rockchipmpph264enc, with real-hardware bringup defaulting to the Rockchip encoder - a bounded teleop manager behind
SetTeleopEnabledandSendTeleopCommand
The Python host tools currently exercise the same contract through:
- a CLI client
- a preview helper that consumes SRT with
gst-launch-1.0 - an overlay viewer that combines SRT video with gateway overlay snapshots
- a monitor shell
- a Tk monitor GUI
Contract¶
The service contract is omniseer.gateway.v1.RobotGateway:
service RobotGateway {
rpc GetSystemStatus(GetSystemStatusRequest) returns (SystemStatus);
rpc SetPreviewMode(SetPreviewModeRequest) returns (SetPreviewModeResponse);
rpc SetTeleopEnabled(SetTeleopEnabledRequest) returns (SetTeleopEnabledResponse);
rpc SendTeleopCommand(SendTeleopCommandRequest) returns (SendTeleopCommandResponse);
rpc GetOverlaySnapshot(GetOverlaySnapshotRequest) returns (OverlaySnapshot);
}
Versioning rules:
- evolve additively
- do not repurpose field numbers
- keep ROS resource names out of the protobuf contract
- use bounded enums for operator-facing modes and states
GetSystemStatus returns the latest cached SystemStatus snapshot. The
gateway does not perform a ROS round trip per status request.
SystemStatus contains:
- gateway name and version
PreviewStatusVisionStatusRobotHealthTeleopStatusEffectiveCommandPlatformStatus
PreviewStatus contains:
- preview state
- preview profile
- last gateway-reported preview error
Preview states:
PREVIEW_STATE_UNSPECIFIEDPREVIEW_DISABLEDPREVIEW_RUNNING
Preview profiles:
PREVIEW_PROFILE_UNSPECIFIEDPREVIEW_PROFILE_LOW_BWPREVIEW_PROFILE_BALANCEDPREVIEW_PROFILE_HIGH_QUALITY
SetPreviewMode accepts:
enabledprofile
When enabled=false, the profile field is ignored. The response includes an
accepted flag, concise message, and post-request PreviewStatus.
SetTeleopEnabled accepts:
enabled
Disabling teleop commands a stop on the internal command path. The response
includes an accepted flag, concise message, and post-request TeleopStatus.
SendTeleopCommand accepts one bounded velocity command:
linear_x_mpslinear_y_mpsangular_z_rad_s
The gateway rejects commands when teleop is disabled or when any command value is outside configured bounds.
TeleopStatus.last_command_* describes the last request accepted through the
gateway, not the current robot command. It includes availability and freshness;
requests older than the keyboard mux's 0.5 s timeout are stale.
EffectiveCommand describes the latest TwistStamped emitted by twist_mux
to the drive-controller reference path. It includes vx, vy, wz, age, and
freshness. Its source is reported as keyboard, autonomy, or navigation
only when the gateway can confirm the freshest configured mux input matches the
emitted command; otherwise it is unknown.
GetOverlaySnapshot returns:
- current
SystemStatus - latest detection overlay snapshot from
/yolo/detections - source-image detection geometry for laptop-side scaling over decoded preview video
- gateway-local detection freshness
- a capped recent operator event list
PlatformStatus contains:
ComputeStatus: CPU utilization, optional CPU temperature, optional thermal throttling, RAM usage, and optional disk usageNetworkStatus: selected Wi-Fi interface, connection state, optional RSSI, and optional link qualityPowerStatus: LiPo battery from/batteryand onboard battery from Linuxpower_supplydata when present
Platform sub-statuses carry available, stale, and age_ms fields so the
operator can distinguish missing instrumentation from fresh healthy values.
Error handling contract:
- gRPC status codes report transport-level and request-level failures
- structured response fields report accepted runtime state
- invalid preview profiles are rejected
- starting an already-running preview profile returns idempotent success
- preview worker start failures are reported in the response message and preview status
The API boundary excludes:
- generic ROS graph browsing
- topic tunneling
- raw video transport over gRPC
- full robot command surfaces beyond bounded teleop
- browser-specific signaling flows
- RunBundle recording and review
Verification Boundary¶
Supported local verification:
scripts/omni test ros
Focused tests cover:
- protobuf-to-store service behavior
- synchronous gRPC server behavior
- gateway state snapshots and freshness flags
- preview command generation
- preview subprocess lifecycle behavior
- bounded teleop validation and stop behavior
- Python client formatting and request helpers
- preview, overlay, shell, and Tk monitor host tooling
The current host-side preview helper and monitor tooling have been smoke-tested locally against the live C++ gateway and software x264/SRT preview worker.
Limitations¶
- The API is unary only; there are no streaming RPCs.
- Multi-client ownership semantics are undefined.
- Stream endpoint metadata is not published by the protobuf API.
- The preview viewer uses configured endpoint data outside the gateway API.
- Platform diagnostics are operator diagnostics and do not currently change
RobotHealth.ready. - The API does not expose robot mode, mission state, wheel-level diagnostics, motor-controller diagnostics, build environment labels, or preview transport parameters.
- The gateway has no authn/authz layer.