Skip to main content
stub — This page will be curated before publishing. Content below reflects the current implementation.

Wire frame layout

Every sample on the Cyberwave data bus (Zenoh or filesystem) uses one framing:
FieldTypeSize
header_lenu32, LE4 bytes
tsf64, LE8 bytes
seqi64, LE8 bytes
header JSONUTF-8variable
payloadbytesvariable
  • header_len — 4-byte LE uint32 covering ts + seq + JSON.
  • ts — 8-byte LE float64, acquisition timestamp (Unix epoch seconds). Binary-packed for O(1) read.
  • seq — 8-byte LE int64, per-channel sequence number for drop detection.
  • Header JSON — compact UTF-8 JSON with at least content_type and channel-specific metadata.
  • Payload — raw bytes (numpy buffer) or UTF-8 JSON.
The HeaderTemplate class pre-encodes the JSON once and splices only ts/seq per sample (<500 ns overhead).

Key expression pattern

cw/{twin_uuid}/data/{channel}/{sensor_name}
SegmentDescription
cwPrefix (configurable via BackendConfig.key_prefix).
twin_uuidUUID-4 of the digital twin.
dataFixed literal.
channelChannel name (frames, joint_states, etc.).
sensor_nameOptional qualifier (default, wrist, left_arm).

Usage

Encoding / decoding with HeaderTemplate (hot path)

from cyberwave.data import HeaderTemplate, decode

tmpl = HeaderTemplate("numpy/ndarray", shape=(480, 640, 3), dtype="uint8")
wire = tmpl.pack(frame_bytes, ts=time.time())  # <500ns header overhead

header, payload = decode(wire)

One-shot encode / decode

from cyberwave.data import HeaderMeta, encode, decode

hdr = HeaderMeta(content_type="application/json", ts=time.time())
wire = encode(hdr, b'{"x": 1.0}')
header, payload = decode(wire)

Building and parsing key expressions

from cyberwave.data import build_key, parse_key, is_valid_key

key = build_key("550e8400-e29b-41d4-a716-446655440000", "frames", "default")
# → "cw/550e8400-e29b-41d4-a716-446655440000/data/frames/default"

ke = parse_key(key)
assert ke.channel == "frames"
assert ke.is_stream is True

assert is_valid_key(key)

Well-known channels

ChannelPatternEncoding
framesStreambinary
depthStreambinary
audioStreambinary
pointcloudStreambinary
imuStreamJSON
force_torqueStreamJSON
joint_statesLatest valueJSON
positionLatest valueJSON
attitudeLatest valueJSON
gpsLatest valueJSON
end_effector_poseLatest valueJSON
gripper_stateLatest valueJSON
mapLatest valuebinary
batteryLatest valueJSON
temperatureLatest valueJSON
telemetryLatest valueJSON