Expand description
Wire protocol shared by the Enpose API and the on-device daemon.
All packets are exactly PACKET_SIZE bytes laid out big-endian on
the wire so a packet capture shows the literal magic bytes EnpR
regardless of host byte order.
Packet layout:
offset size field
0 4 MAGIC ("EnpR")
4 2 PROTOCOL_VERSION
6 4 serial number
10 1 has_extrinsics flag (0 or 1)
11 1 packet type (PKT_TYPE_*)Structs§
- Parsed
Packet - Decoded contents of a packet that passed the magic-bytes check.
Constants§
- BROADCAST_
PORT - UDP port the Enpose role-negotiation and discovery protocol uses.
- MAGIC
- Magic prefix of every packet — the ASCII bytes
EnpRinterpreted as a big-endianu32. Distinguishes Enpose traffic from any other UDP datagram that happens to land onBROADCAST_PORT. - PACKET_
SIZE - Fixed packet size across all packet types, so receivers can use a
single
recv_frombuffer. - PKT_
TYPE_ DISCOVERY_ REQUEST - Packet type: a client asks any reachable primary to identify
itself. Only the cluster’s elected primary replies, with a
PKT_TYPE_PEER_INFOpacket sent unicast to the requester. - PKT_
TYPE_ PEER_ INFO - Packet type: a device announces its own identity (serial, extrinsics-calibration state). Sent both as the 1 Hz cluster broadcast and as the unicast reply to a discovery request.
- PKT_
TYPE_ POSE_ DATA - Packet type: a pose-data datagram. The fixed
PACKET_SIZEheader is followed by a MessagePack-encodedVec<MarkerPose>starting at offsetPACKET_SIZE. One datagram carries all markers localized from a single camera frame. Sent device → client onPOSE_PORT. - PKT_
TYPE_ POSE_ SUBSCRIBE - Packet type: a client subscribes to the pose stream. The same packet
doubles as the keep-alive — a client resends it at 1 Hz, and the
device drops a client it has not heard from within
POSE_KEEPALIVE_TIMEOUT_SECS. Sent client → device onPOSE_PORT. - PKT_
TYPE_ POSE_ UNSUBSCRIBE - Packet type: a client unsubscribes from the pose stream. Lets the
device drop the client immediately instead of waiting for the
keep-alive timeout. Sent client → device on
POSE_PORT. - POSE_
KEEPALIVE_ INTERVAL_ SECS - Interval at which a pose-stream client should resend its subscribe/keep-alive packet to stay connected.
- POSE_
KEEPALIVE_ TIMEOUT_ SECS - How long the device keeps a pose-stream client without hearing a subscribe/keep-alive packet from it before dropping the connection.
- POSE_
PORT - UDP port the pose-streaming protocol uses. Clients send subscribe /
keep-alive packets to this port on the device’s primary, and the
device unicasts
PKT_TYPE_POSE_DATApackets back to each subscribed client. Separate fromBROADCAST_PORTso discovery and streaming traffic never share a socket. - PROTOCOL_
VERSION - Wire-protocol version this API was built against.
Functions§
- encode_
discovery_ request - Build a discovery-request packet. Carries
serial = 0because the requester is anonymous — the replying device fills its own serial into the response. - encode_
peer_ info - Build a peer-info packet using this API’s current
PROTOCOL_VERSION. - encode_
pose_ data_ header - Build the fixed header of a
PKT_TYPE_POSE_DATApacket. The caller appends the MessagePack-encoded pose payload after this header; the receiver decodes the payload from offsetPACKET_SIZE.serialis the sending device’s factory serial. - encode_
pose_ subscribe - Build a pose-stream subscribe / keep-alive packet. Carries
serial = 0because the client is anonymous; the device identifies the client by its source address. - encode_
pose_ unsubscribe - Build a pose-stream unsubscribe packet.
- parse_
packet - Decode a packet.