zendo-protocol 0.1.1

Wire-protocol constants and binary frame decoders for the Zendo motion-tracking WebSocket stream.
Documentation
  • Coverage
  • 23.65%
    48 out of 203 items documented1 out of 1 items with examples
  • Size
  • Source code size: 65.93 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.44 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • michele-akina

zendo-protocol

crates.io docs.rs

The wire-protocol definitions for the Zendo motion-tracking WebSocket stream: port range, message-type tags, the joint and landmark vocabularies, and the pure decode/encode routines.

This crate is the single source of truth for the protocol. It has no dependencies, performs no I/O, never allocates, and is no_std by disabling the default std feature. Most users want zendo-sdk (Rust) or the zendo-sdk PyPI package (Python), which build a connection on top of this crate. Depend on zendo-protocol directly only if you bring your own transport.

Frame layout

Every frame is one binary WebSocket message: byte 0 is the type tag, the rest is the payload. All numeric values are little-endian f64.

Message Tag Payload
Hello 0x01 protocol version (u16 LE)
Body quaternions 0x02 13 joints × (w, x, y, z)
Body landmarks 0x03 19 landmarks × (x, y, z, confidence)
Hand quaternions 0x04 1 side byte + 16 joints × (w, x, y, z)
Hand landmarks 0x05 1 side byte + 21 landmarks × (x, y, z, confidence)

The server sends the hello frame first on every connection, carrying PROTOCOL_VERSION; clients require an exact match. The side byte is 0 for the right hand and 1 for the left. Body messages stream in body-tracking mode; hand messages stream in hand-tracking mode; the two never appear in the same session.

Example

use zendo_protocol::{decode, Message};

fn handle(frame: &[u8]) {
    match decode(frame) {
        Ok(Message::BodyQuaternions(q)) => println!("hips: {:?}", q.hips),
        Ok(Message::BodyLandmarks(l)) => println!("nose: {:?}", l.nose),
        Ok(Message::HandQuaternions { side, frame }) => {
            println!("{} wrist: {:?}", side.as_str(), frame.wrist)
        }
        Ok(Message::HandLandmarks { side, frame }) => {
            println!("{} thumb tip: {:?}", side.as_str(), frame.thumb_tip)
        }
        Err(e) => eprintln!("bad frame: {e}"),
    }
}

License

Licensed under either of Apache-2.0 or MIT at your option.