Data channels & read methods
Read Exo telemetry, status, arms, handsets, and optional IMU data.
Data channels & read methods
Read channels
device.telemetry()returnsReadChannel[ExoTelemetry].device.status()returnsReadChannel[ExoStatus].
telemetry = device.telemetry()
latest = telemetry.latest() # Sample[ExoTelemetry] | None
subscription = telemetry.subscribe(print)
sample = await telemetry.next()latest() returns None before the first sample. Subscription callbacks run on an SDK-managed subscription worker and should stay short. This worker is not the thread where the application calls update(); do not use a callback for blocking work or as an application work queue. next() fits asyncio workflows.
The SDK coalesces duplicate data notifications before posting to asyncio and keeps the latest value, reducing backlog when the event loop is busy. The SDK stops and cleans up during interpreter shutdown, but normal paths should still close explicitly.
Callback or sample-decoder exceptions in subscribe() do not propagate to the registering thread. See Diagnostics & errors for error reporting and application recovery. next() and async iteration deliver decoder errors to the waiting caller.
Configuring subscription delivery
from qnbot_sdk import SubscriptionConfig
telemetry_30_hz = device.telemetry().with_config(
SubscriptionConfig.latest(max_rate_hz=30)
)
ordered = device.telemetry().with_config(
SubscriptionConfig.fifo(capacity=128, max_rate_hz=30)
)latest() delivery coalesces pending values. fifo() preserves order up to capacity and drops the oldest pending value when full. max_rate_hz caps callback and async for delivery without reducing device acquisition or SDK computation. The configuration affects only later subscribe() calls and async iteration on that view; ordinary latest() and one-shot next() are unchanged.
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. async for uses the same timing rule.
Each read returns a Sample[T] wrapper containing value, sequence, source_time, and observed_at metadata; see Sample[T] in the API Reference for field and clock-domain details.
Telemetry data
ExoTelemetry.payload contains:
left_armandright_arm: eightencoder_countsand eightjoint_positions_radvalues.left_handsetandright_handset: raw axes, trigger, and button bit mask.torso_imuandextra_imu: optional acceleration, angular velocity, and XYZW orientation.
Read device.get_device_info().capabilities before presenting IMU or handset data. The status channel reports connection, freshness, and bounded error information.
Arms
The arm data for each frame is available at sample.value.payload.left_arm and sample.value.payload.right_arm. Each side is an ExoArmState:
| Field | Type | Length | Unit | Meaning |
|---|---|---|---|---|
encoder_counts | tuple[int, ...] | 8 | encoder counts | Raw encoder values reported by the device |
joint_positions_rad | tuple[float, ...] | 8 | rad | Joint angles corresponding one-to-one with the encoder slots |
The same index in both arrays refers to the same slot. For example, encoder_counts[3] and joint_positions_rad[3] are the raw count and angle for slot 4 on that side.
from qnbot_sdk import Sample
from qnbot_sdk.exo import ExoTelemetry
def print_arm(label: str, arm) -> None:
for index, (count, position_rad) in enumerate(
zip(arm.encoder_counts, arm.joint_positions_rad, strict=True)
):
print(
f"{label}[{index}] "
f"encoder_counts={count} "
f"joint_positions_rad={position_rad:.6f}"
)
def on_telemetry(sample: Sample[ExoTelemetry]) -> None:
payload = sample.value.payload
print_arm("left_arm", payload.left_arm)
print_arm("right_arm", payload.right_arm)
subscription = device.telemetry().subscribe(on_telemetry)Example output:
left_arm[0] encoder_counts=1240 joint_positions_rad=0.187532
left_arm[1] encoder_counts=-315 joint_positions_rad=-0.047609
...
right_arm[7] encoder_counts=82 joint_positions_rad=0.012394The public model currently guarantees eight fixed-order slots per side, but does not expose anatomical joint-name enums such as shoulder, elbow, or wrist. Applications may read by index and align the two arrays; use the joint mapping for the specific device model before displaying anatomical names instead of inferring them from the array index.
Handsets
Start with left_handset or right_handset inside sample.value.payload to read the left or right handset. These correspond to the raw arrays Joystick_Left_Data and Joystick_Right_Data. Indices start at 0; both sides use the same format.
| Array index | SDK field | Physical input | Meaning |
|---|---|---|---|
[0] | axis_x_raw | Joystick X axis | Raw axis value |
[1] | axis_y_raw | Joystick Y axis | Raw axis value |
[2] | button_mask | Buttons, joystick press, and SW | Independent 16-bit button mask per side; check individual bits |
[3] | trigger_raw | Trigger | Separate raw analog value; read directly |
raw means a device reading; the SDK does not define normalized ranges for axes or triggers. Read trigger_raw for the trigger. button_mask packs digital button and switch states and does not contain trigger travel.
Check capabilities.handsets before reading:
def print_handsets(sample: Sample[ExoTelemetry]) -> None:
payload = sample.value.payload
for label, handset in (
("left", payload.left_handset),
("right", payload.right_handset),
):
print(
f"{label} axis=({handset.axis_x_raw}, {handset.axis_y_raw}) "
f"trigger={handset.trigger_raw} "
f"buttons=0x{handset.button_mask:04x}"
)Plus handset controlsInteractive example
Click the 3D model or 16-bit mask map to toggle controls and sync the example word.
Loading 3D…
sample.value.payload. left_handset.button_mask(mask & 0x0002) == 00x10xF0x10xFRegular buttons are active low ((button_value & mask) == 0 means pressed), while the switch is active high ((button_value & 0x0020) != 0 means on). Both handsets share the same mapping and are read independently; STD uses only bits 0–5 (without Back, Mode, Start, BkT, or BkB).
This example checks A, B, and SW independently on both handsets. Use the masks in the table and the same active-low check for the other buttons.
def print_plus_buttons(sample: Sample[ExoTelemetry]) -> None:
payload = sample.value.payload
for label, handset in (
("left", payload.left_handset),
("right", payload.right_handset),
):
mask = handset.button_mask
a_pressed = (mask & 0x0002) == 0
b_pressed = (mask & 0x0004) == 0
switch_on = (mask & 0x0020) != 0
print(f"{label} A={a_pressed} B={b_pressed} SW={switch_on}")
subscription = device.telemetry().subscribe(print_plus_buttons)Check each bit separately for simultaneous presses instead of treating the entire integer as a single button identifier.
IMU
Both torso_imu and extra_imu may be None:
def print_imus(sample: Sample[ExoTelemetry]) -> None:
payload = sample.value.payload
for label, imu in (("torso", payload.torso_imu), ("extra", payload.extra_imu)):
if imu is None:
continue
print(label, imu.acceleration_mps2,
imu.angular_velocity_rad_s, imu.orientation_xyzw)acceleration_mps2: three values inm/s².angular_velocity_rad_s: three values inrad/s.orientation_xyzw: four values in XYZW quaternion order.
The public SDK does not define the physical installation axes for each hardware model. Use the coordinate mapping from the device specification before integrating with a robot or visualization system.
Status channel
def print_status(sample) -> None:
status = sample.value
print(
"connected=", status.connected,
"stale=", status.stale,
"reconnects=", status.reconnect_count,
"error=", status.last_error,
)
status_subscription = device.status().subscribe(print_status)connected reports connection state and stale reports whether recent data is stale. Resume application work only when the member is connected and not stale. last_error is a bounded summary; use Debug logs and health() for complete diagnostics.