Reading raw data
Glove hand, wrist, per-sensor IMU, pressure and raw EMF data.
Reading raw data
Read device data through device.pose(), device.imu(), device.pressure() and device.status() without an algorithm package. Device firmware produces pose and IMU values; they arrive after start(). Subscribe before starting the device. latest() can be empty before the first sample. See Data sources and reading for reading methods and Coordinate frames and poses for frames and units.
Hand and wrist
sample.value.payload is a GlovePosePayload with optional hand and wrist components. Check presence before reading each component and its timing/freshness.
| Content | Read path |
|---|---|
| Five fingertip poses | payload.hand.fingertips |
| Hand side and per-finger validity/retention | payload.hand.hand_side, raw_valid_mask, held_mask |
| Hand frame and time | payload.hand.coordinate_frame, timestamp_ms, fresh |
| Wrist pose | payload.wrist.position (meters), quaternion_xyzw (XYZW) |
| Wrist validity and time | payload.wrist.valid, timestamp_ms, fresh |
Hand and wrist update independently. Device observations determine retained-component freshness. wrist is absent until the first wrist observation in the current device session; later hand-only frames retain the previous wrist with fresh=false. Read coordinate_frame before applying application coordinate transforms.
Per-sensor IMU
sample.value.payload.imus returns id, location, valid, fresh and values for each sensor. Ordinary single-IMU devices have one item. GloveImuRawCounts provides three-axis raw counts. GloveImuPhysicalValues provides optional gyro_mdps / accel_mg in mdps and mg. Check the value type before processing its units.
When valid is false, raw counts remain present; check valid before using them. Physical-value axes remain optional. The SDK publishes the units reported by the device, without converting raw counts or fusing IMU into pose.
Read the optional magnetometer from payload.magnetometer. Its x/y/z values use raw_counts. Preserve missing values, invalid flags and valid zero values.
Save as raw_data.py and run python raw_data.py with one supported glove connected.
from threading import Event
from qnbot_sdk import Sdk
from qnbot_sdk.glove import GloveConfig, GloveImuRawCounts
def on_pose(sample):
hand = sample.value.payload.hand
wrist = sample.value.payload.wrist
if hand is not None:
print(hand.hand_side, hand.fresh, hand.fingertips)
if wrist is not None:
print(wrist.valid, wrist.fresh, wrist.position, wrist.quaternion_xyzw)
def on_imu(sample):
for sensor in sample.value.payload.imus:
if isinstance(sensor.values, GloveImuRawCounts):
print(sensor.id, sensor.location, sensor.valid,
sensor.values.gyroscope_raw, sensor.values.accelerometer_raw)
else:
print(sensor.id, sensor.location, sensor.valid,
sensor.values.gyro_mdps, sensor.values.accel_mg)
sdk = Sdk(devices=(GloveConfig(),))
glove = sdk.glove()
try:
device = glove.device()
pose_subscription = device.pose().subscribe(on_pose)
imu_subscription = device.imu().subscribe(on_imu)
glove.start()
Event().wait()
finally:
glove.close()Stop with Ctrl+C. See GlovePosePayload and GloveImuPayload for complete fields.
Wireless IMU
Wireless gloves use the same device.imu() call. The glove and Receiver must ship matched firmware that provides same-hand pose and IMU output.
Each hand has its own device; subscribe to each device's imu(). meta.source identifies the glove, the timestamp matches the enclosing pose, and the sequence increments independently per glove.
start() enables pose and IMU together. A failed start reports an error, and latest() can be empty until the first valid IMU arrives. Missing or malformed IMU does not affect pose, and pose-only devices produce no IMU.
Use the complete raw_data.py above. Add the following import and replace its sdk = Sdk(...) line. Set the Receiver port and choose Side.LEFT or Side.RIGHT, then run python raw_data.py.
from qnbot_sdk import SerialConnection, Side
sdk = Sdk(devices=(GloveConfig(
side=Side.RIGHT,
connection=SerialConnection(port="<receiver-port>"),
),))Device status
device.status() is also produced directly by the device rather than computed: whether it is connected, whether data is stale, the last error and the reconnect count. See Diagnostics & errors for the fields and how to use them for diagnosis.
Tactile ENF Positioning Glove (VetraGlove HMP-MX) pressure
The Tactile ENF Positioning Glove model is VetraGlove HMP-MX. Connect VetraGlove HMP-MX-L (left) or VetraGlove HMP-MX-R (right) with the standard serial connection. Use the glove's own serial number when selecting by SN; the USB controller serial is different. The SDK reads the side from the glove. The glove must be configured to report motion and pressure automatically.
Read movement through device.pose() and device.imu(). For calibrated output, use device.skeleton().joint_angles() and device.skeleton().pose() with the usual Skeleton setup; the SDK reuses a matching calibration. Pressure is independent and does not require calibration.
device.pressure() returns 460 raw 0–255 readings with matching estimated_kpa estimates in kPa. Estimates use an average palm curve. At a raw reading of 107 or higher, the pressure estimate stays at about 40.01 kPa. Use the raw reading to distinguish values from 107 to 255. To measure force in newtons, calibrate each point you use against known loads. Frames without pressure produce no new sample.
Save as pressure.py and run python pressure.py PORT.
import argparse
from qnbot_sdk import Sdk, SerialConnection
from qnbot_sdk.glove import GloveConfig
parser = argparse.ArgumentParser(description="Read Tactile ENF Positioning Glove (VetraGlove HMP-MX) pressure")
parser.add_argument("port", help="Glove serial port")
port = parser.parse_args().port
sdk = Sdk(devices=(GloveConfig(connection=SerialConnection(port=port)),))
glove = sdk.glove()
try:
device = glove.device()
subscription = device.pressure().subscribe(
lambda sample: print("pressure:", sample.value.readings[0], "kPa:", sample.value.estimated_kpa[0])
)
glove.start()
glove.run_forever()
finally:
glove.close()Stop with Ctrl+C.
Raw EMF I/Q
Helix supports device.emf() for raw I/Q signed integral matrices acquired in pairs with hand pose. Selecting the channel establishes paired acquisition at the confirmed pose rate. Read through latest() or subscribe() afterwards.
GloveEmf.payload.channels contains each channel's three-by-three signed demodulated integral matrices (demodulated_integral): li, lq, hi and hq. Preserve signs and invalid masks. Correlate meta.source, payload.session and payload.frame_sequence with hand pair_sequence. When payload.et is present, read fractional device-clock milliseconds from payload.et.ref, payload.et.error, and payload.et.b_error (error being None means unknown and b_error == 0.0 is a valid zero; the _us fields and _ms aliases are deprecated).
See Examples for the matching emf.py setup and run instructions.