Skip to content

7. Protocols ​

7.1 The handheld: teleop UDP v1 ​

The X30 speaks the teleop protocol v1 of Pashupati: the same datagrams, so a handheld of either robot drives the other; the X30’s additions are ignored by a v1 handheld. One UDP port on the navigation host (9870); the handheld sends JSON, the robot answers JSON (control) and chunked binary datagrams (streams). The full reference is x30_bridge/PROTOCOL.md.

7.1.1 Session ​

  1. The handheld sends hello (again every second when idle). The robot answers welcome (its commands, the stick’s limits, the camera names) and the route, then streams state at 10 Hz.

  2. One driver at a time: another device’s hello is answered busy while the current one lives; after 2 s of silence the robot drops it and zeroes the stick.

  3. With a shared secret (X30_TELEOP_TOKEN) every message carries "k", compared in constant time; a hello without it is answered denied, anything else dropped.

  4. Discovery: a broadcast {"t": "discover"} is answered by every robot’s beacon (name, secured, in_use_by, mode, battery), without a token.

7.1.2 Messages ​

tFields
helloname, streamsregister, keep alive
joyvx, vy (m/s), wz (rad/s)the stick, 20–30 Hz; drives in remote only
cmdid, name, argsa command; resent every 200 ms until its ack; runs once per id
streamscamera, lidar, video, camera_fps, camera_namewhich streams
ackid, ok (null: pending), msg, dataa command’s answer; long ones (inspect, nav_start) answer pending first
statemode, e-stop, field, nav state, pose, battery, health, trip, speed, X30: camera, recorder, substationthe robot

Commands map one to one onto the stack’s services (Chapter 3): estop, set_mode, nav_start…, record_start, mark_stop, list_routes, load_route, localize, record_tags, dock, nav_speed, trip_reset, and the X30’s recorder_start, recorder_stop, inspect, plus the driver’s robot commands.

7.1.3 Binary streams ​

Each datagram starts with a 13-byte little-endian header: magic PSH1, u8 stream (1 camera, 2 LiDAR, 3 route), u32 frame, u16 chunk index, u16 chunk count; chunks of at most 1400 bytes. The camera is one JPEG per frame, the LiDAR N× (int16 x,y,z in cm, base_link), the route a JSON list of [x,y,dwell] in the map frame. The robot subscribes to a camera and the cloud only while a handheld wants them.

7.2 NETRA: robot API v1 ​

7.2.1 The WebSocket ​

/api/v1/robot/ws with Authorization: Bearer <token> and X-Robot-Id. The robot sends hello, telemetry (1 Hz), patrol_event (started, lap, finished), stop_event, alert (blocked, off the path, failed, the e-stop), ack and time_sync; events wait while NETRA is unreachable and the connection comes back with a backoff. NETRA sends commands, acknowledged with the service’s answer:

CommandThe stack
start_patrol {route_id, patrol_id}the route and its plan into the site, then navigation/load_path and navigation/start
stop_patrol, pause, resumenavigation/stop, pause, resume
localizelocalization/start
estop, estop_releasecontrol/estop_request at once, then control/estop/engage; release
dock, undockdocking/dock, undock
recorder_start, recorder_stoprecorder/start, stop
inspect_point {point}one NETRA point where the robot stands; refused while moving

7.2.2 Downloads and uploads ​

  • GET /api/v1/robot/routes/<id>/file the route CSV, into <site>/netra/.
  • GET /api/v1/robot/routes/<id>/inspection NETRA’s inspection points of the route, by stop: each stop a point netra_stop<k>, each NETRA point a target netra_<id> (its PTZ pose, its regions, its temperature limit).
  • POST /api/v1/robot/inspections one NETRA point’s result, always multipart: a meta part (JSON: uid <robot_id>.<report>.<point>, the time on NETRA’s clock, the patrol, the pose, the ambient, the readings) and the images thermal, visual, acoustic. The uid makes a retry idempotent.
  • POST /api/v1/robot/routes a route taught on the robot, for NETRA’s route database.

Uploads go through the spool (~/x30/spool): an item leaves the robot’s disk only once NETRA answered it, so nothing is lost offline or across restarts.