Skip to main content

Module posestream

Module posestream 

Source
Expand description

Client-side pose streaming from a single Enpose tracker device.

A PoseStream delivers a live stream of MarkerPose updates from one device. Construct it from a DeviceInfo returned by crate::DeviceDiscovery or directly from an IpAddr, then poll it with PoseStream::receive_pose_updates to get the poses that have arrived since your last call.

The create_thread constructor argument selects between two modes:

  • Threaded (true) — a background thread continuously receives and buffers incoming poses, so none are missed regardless of how often you poll. PoseStream::receive_pose_updates returns the buffered poses. Use this when you cannot guarantee a regular polling cadence.

  • Single-threaded (false) — no thread is spawned; poses are collected when you call PoseStream::receive_pose_updates. Use this when you poll on your own regular cadence and want the stream to use only your thread. Poll often enough that updates are not missed between calls.

In either mode, PoseStream::receive_pose_updates takes a block flag: pass false to return whatever has arrived (possibly nothing) without waiting, or true to wait for at least one pose update. A blocking call waits at most 3 seconds, then returns an empty result if none arrived.

The connection is closed automatically when the PoseStream is dropped.

Structs§

PoseStream
A live pose stream from one Enpose tracker device.