Reading raw data
Hand and wrist poses, per-sensor IMU values, and device status.
Reading raw data
sample.value.payload.hand and .wrist are optional. Check null, freshness and timing separately. Read hand fingertips and wrist position in meters with XYZW quaternionXyzw. handSide uses the Side enum. Iterate over payload.imus, select by id / location, then check validity/freshness and the raw-count or physical-value type. Optional payload.magnetometer uses raw counts for x/y/z.
Hand and wrist update independently. In the current device session, wrist is null until the first wrist observation. Later hand-only frames retain the previous wrist observation with fresh=false.
Read pose, IMU and status through device.pose(), device.imu() and device.status(). Device firmware produces pose and IMU values; they arrive after start(). Subscribe before starting. latest() is empty until the first sample arrives.
Save the following class as Imu.java in the app.
import android.content.Context;
import com.qnbot.sdk.Sdk;
import com.qnbot.sdk.SdkConfig;
import com.qnbot.sdk.android.SerialTransport;
import com.qnbot.sdk.config.SerialConnection;
import com.qnbot.sdk.config.Side;
import com.qnbot.sdk.glove.Glove;
import com.qnbot.sdk.glove.GloveConfig;
import com.qnbot.sdk.glove.GloveDevice;
/**
* Streams per-sensor IMU raw counts or physical values.
*
* <p>Pass the host {@link Context}, an authorized transport, the glove port and side. Wired gloves
* and compatible wireless receivers publish here. Each sensor value keeps its raw-count or
* physical-value type.
*/
public final class Imu {
private Imu() {}
public static void run(Context context, SerialTransport transport, String port, Side side) {
SdkConfig config = SdkConfig.builder()
.device(GloveConfig.builder()
.name("primary")
.side(side)
.connection(SerialConnection.port(port))
.build())
.build();
try (Sdk sdk = new Sdk(config, context, transport); Glove glove = sdk.glove()) {
GloveDevice device = glove.device();
device.imu().subscribe(sample -> {
for (com.qnbot.sdk.glove.GloveImuSample sensor : sample.value.payload.imus) {
if (sensor.values instanceof com.qnbot.sdk.glove.GloveImuValues.RawCounts) {
com.qnbot.sdk.glove.GloveImuValues.RawCounts raw =
(com.qnbot.sdk.glove.GloveImuValues.RawCounts) sensor.values;
System.out.println("IMU id=" + sensor.id + " valid=" + sensor.valid
+ " gyro_raw=" + raw.gyroscopeRaw + " accel_raw=" + raw.accelerometerRaw);
} else {
com.qnbot.sdk.glove.GloveImuValues.Physical physical =
(com.qnbot.sdk.glove.GloveImuValues.Physical) sensor.values;
System.out.println("IMU id=" + sensor.id + " gyro_mdps=" + physical.gyroMdps
+ " accel_mg=" + physical.accelMg);
}
}
});
glove.start();
glove.runForever();
}
}
}Imu.run(...) subscribes to device.imu() and prints each sensor ID and validity with raw gyroscope/accelerometer counts or mdps/mg values according to its GloveImuValues type.
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.
Sample fields
Sample<T>.value holds typed content, sequence is the sample sequence, sourceTime is nullable source time, and observedAt is SDK observation time. Use sequence to detect new samples and differences between consecutive observedAt values to measure update intervals as observed by the SDK. Summarize the intervals in batches to keep per-frame logging out of the measurement.
GlovePose and GloveImu provide meta, payload and quality. GloveStatus includes connected, stale, lastError and reconnectCount.
See Timestamps & external time sync for external time synchronization and timestamps.
Wireless IMU
Use device.imu() for each hand with matching glove and Receiver firmware that provides combined pose and IMU frames. Pose-only firmware still provides pose. Check each sensor’s validity and GloveImuValues type before reading raw counts or mdps/mg physical values.
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().jointAngles() 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 estimatedKpa 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.
Call Pressure.run from your worker thread with the app Context, authorized USB transport and selected port, as in Quick start. The example configures pressure callbacks at 1 Hz and prints the sequence, point count and first raw value.
import android.content.Context;
import com.qnbot.sdk.Sdk;
import com.qnbot.sdk.SdkConfig;
import com.qnbot.sdk.android.SerialTransport;
import com.qnbot.sdk.config.SerialConnection;
import com.qnbot.sdk.glove.Glove;
import com.qnbot.sdk.glove.GloveConfig;
import com.qnbot.sdk.glove.GloveDevice;
/**
* Reads raw pressure readings from a pressure-capable glove.
*
* <p>Pass the host {@link Context}, an authorized {@link SerialTransport} and the glove's serial
* port. Run on a worker thread; the pressure subscription prints one sample per second.
*/
public final class Pressure {
private Pressure() {}
public static void run(Context context, SerialTransport transport, String port) {
SdkConfig config = SdkConfig.builder()
.device(GloveConfig.builder()
.connection(SerialConnection.port(port))
.build())
.build();
try (Sdk sdk = new Sdk(config, context, transport); Glove glove = sdk.glove()) {
GloveDevice device = glove.device();
device.pressure()
.withConfig(com.qnbot.sdk.channel.SubscriptionConfig.latest(1.0))
.subscribe(sample -> System.out.println("pressure sequence=" + sample.sequence
+ " points=" + sample.value.readings.size() + " first_raw="
+ sample.value.readings.get(0) + " first_kpa=" + sample.value.estimatedKpa.get(0)));
glove.start();
glove.runForever();
}
}
}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. On Android, select the channel on a worker thread.
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.frameSequence with hand pairSequence. When payload.et is non-null, read fractional device-clock milliseconds from payload.et.ref(), payload.et.error(), and payload.et.bError() (error() being null means unknown and bError() equal to 0.0 is a valid zero; the refUs/errorUs/bErrorUs fields and refMs()/errorMs()/bErrorMs() aliases are deprecated).