Data channels & read methods
How pose, IMU, Skeleton and output are read, and how to feed an external input source.
Data channels & read methods
pose() returns optional payload.hand / payload.wrist components. Select IMU sensors by id / location within payload.imus. pressure() provides raw readings and kPa estimates; emf() provides raw I/Q paired with hand pose. Obtaining the emf() channel selects paired acquisition, which subsequent latest() / subscribe() reads retain. See Reading raw data for fields, units and device requirements.
Wired-glove start() directly enables telemetry and supported IMUs and returns after command acknowledgement. Device streams do not depend on subscriptions; existing APIs receive data when the first frame arrives. An unavailable IMU degrades gracefully and does not block pose data.
Wireless gloves use the same device.imu() call and need matched combined-frame firmware; see Wireless IMU.
The two data families
The SDK publishes two families of data: raw values produced by the device, and values the SDK computes. They are read the same way; only how the data is produced differs:
| Raw data | SDK-processed data | |
|---|---|---|
| Typical API | pose(), imu(), pressure(), emf(), status() | skeleton(), output() |
| Algorithm package | Not required | Required for dexterous hand output, see Algorithm package configuration; Skeleton is provided by the SDK and needs none |
| Run mode | Not required | Required, see Runtime modes |
Raw data is covered in Reading raw data; SDK-processed data (retargeting) in Reading retargeting data.
Data read methods
The read methods deliver the same Sample<T>. Callback subscription is the recommended default: each sample is handled as it is produced, with no polling; use latest() when you only need the current value, and see Runtime modes for blocking waits and coroutines.
Pose, IMU, Skeleton, dexterous hand output, status, and calibration progress all use the same read methods: receive continuously through a callback, read the latest value with latest(), block for the next item with next(), or await it with coro::next.
Register callbacks with subscribe() before or after startup; registering before start() is recommended to receive from the first frame. Subscribing only registers a software callback; device streams are enabled by start(). The executor, stop token and cancellation rules of the blocking and coroutine paths
are in Runtime modes and
C++20 coroutines.
Each read returns Sample<T>; for the fields, types and the constraints on the two timestamps, see Sample<T>.
Callback subscriptions
subscribe() invokes the callback each time new data arrives:
auto subscription = device.status().subscribe(
[](const qnbot::Sample<qnbot::GloveStatus>& sample) {
std::cout << sample.value.connected << '\n';
});Callbacks of the same subscription execute in order and never concurrently. Callbacks should stay
short; an exception thrown inside one does not terminate the subscription. The application must
keep the returned Subscription; call subscription.unsubscribe() when that callback needs to be
stopped early. Do not synchronously cancel or destroy a subscription from inside its own callback.
Callback or sample-decoder exceptions in subscribe() do not propagate to the registering thread. See Diagnostics & errors for error reporting and application recovery. Callers using next() receive decoder errors through get().
Configuring subscription delivery
Subscriptions keep only the newest pending value by default. To cap callback delivery rate or retain a bounded ordered queue, create a configured channel view:
auto latest_30_hz = device.pose().with_config(
qnbot::SubscriptionConfig::latest(30.0));
auto fifo = device.pose().with_config(
qnbot::SubscriptionConfig::fifo(128, 30.0));
auto subscription = latest_30_hz.subscribe(on_pose);latest() delivery coalesces pending values. fifo() preserves order up to capacity and drops the oldest pending value when full. The rate is an upper delivery bound, and the first available value is still delivered immediately. Configuration affects only subscriptions created from that view. It does not mutate the original channel or existing subscriptions, reduce SDK/algorithm computation, or change channel latest() and next() behavior.
For blocking on the next data item and C++20 coroutine usage, see Runtime modes.
Without max_rate_hz, a plain subscribe() or SubscriptionConfig::latest() adds no delivery-rate ceiling. An explicitly configured rate limits only its own subscription. The SDK imposes no SDK-wide 200 Hz delivery cap; throughput at higher input rates depends on the input and application processing capacity, and latest can still coalesce pending data.
Callback work counts within the configured delivery period. Evaluate cadence over the time window between the first and last deliveries, allowing up to one sample of boundary allowance; an individual delivery interval may be shorter than the configured period. With sufficient input and lightweight processing, delivery can approach the configured rate more closely. Input rate, application processing time and OS scheduling still affect the observed rate; exact timing is not guaranteed. Idle time or processing overruns do not earn credit, and missed periods are not replayed as catch-up deliveries. latest still coalesces pending values, and fifo remains bounded. Review the processing budget in the migration guide before upgrading.
Getting the latest value
latest() immediately returns the latest data currently saved; it returns std::nullopt when
there is no data yet:
if (const auto sample = device.pose().latest()) {
std::cout << sample->sequence << '\n';
}The max_rate_hz delivery period includes callback processing time; only the remainder of the period is waited, rather than a full period after processing. The first available sample is delivered immediately. Scheduling jitter can vary individual intervals, so this is not a fixed sampling frequency.
External input
When there is no physical glove, or when the frames come from your own device or a simulated hand, ExternalConnection and push_frame() feed external hand frames as the input source. External frames join the same data path as a physical glove: raw poses are read directly, and the SDK computes the retargeting result.
Configuration and usage
External input has no device identity handshake, so the side must be configured explicitly in GloveConfig:
qnbot::GloveConfig glove_config{
qnbot::Side::right, qnbot::ExternalConnection{}};After configuring the target, subscribe to the output and start the SDK first, then have the application keep submitting frames:
auto device = glove.device();
auto output = device.output("hand");
auto subscription = output.subscribe(
[](const qnbot::Sample<qnbot::HandJointCommand>& sample) {
std::cout << sample.value.joints.size() << '\n';
});
device.start();
glove.run_background();
qnbot::GlovePose pose = device.push_frame(frame);push_frame() synchronously returns the raw GlovePose of the current frame; the retargeting result is read through output(). The example uses background mode.
External input uses the background or manual runtime: keep calling push_frame(frame) in background mode; in manual mode, submit each frame before calling update(). If the first run requires calibration, complete Capture and Calibration before expecting target output. See the complete background and manual update examples.
Glove supports automatic terminal calibration for external input. Background startup returning does not mean readiness; keep supplying frames during capture and calibration. See the runtime notes for startup, manual waiting, and error handling.
Frame constraints
- The five fingertip poses (
thumb,index,middle,ring,pinky) are required, and each value is aGloveNodePose. positionis 3 finite floating-point numbers, in meters.quaternion_xyzwis 4 finite XYZW components with a non-zero overall norm; the SDK normalizes it before use.timestamp_msmay be omitted; when provided it must be a finite number of milliseconds and strictly increasing for the same device; when omitted, the current shared time reference is used. See Timestamps & external time sync for the time unit, default reference, and synchronization flow.timestamp_secis retained only for compatibility with existing code. The SDK multiplies it by1000to convert it to milliseconds; do not set it together withtimestamp_ms.
The public contract unifies units and the quaternion component order, but the specific coordinate origin, axis directions, and rotation reference frame must still match the product documentation of the selected algorithm package. The side is not passed with the frame; the device identity and sequence are determined by the selected device and the SDK. For the complete fields, see GloveNodePose and ExternalGloveFrame.
Starting streams, reading, and recovery
start() starts device streams. subscribe(), latest(), next(), and asynchronous reads observe data and do not enable hardware streams.
Subscribe before or after starting. Wait for the first valid frame after start() returns; latest() may be empty until then.
Stream failures are reported through startup errors or device status; repeated reads do not resolve a failed start.
IMU availability on a directly connected glove depends on the device/firmware; unavailable IMU does not imply unavailable pose data.
Connection recovery operates independently of target algorithm scheduling, including applications reading only raw data.
Algorithm outputs still require a runtime mode, and external sources still require continued push_frame() calls.
See Configuration reference for subscription pacing.