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.
Use this as main.cpp in the CMake project from Installation, build with matching headers and libraries, and run with one supported glove connected.
#include <qnbot/glove.hpp>
#include <iostream>
#include <variant>
int main() {
qnbot::SdkConfig config;
config.devices = {qnbot::GloveConfig{}};
qnbot::Sdk sdk(config);
auto glove = sdk.glove();
auto device = glove.device();
const auto pose_subscription = device.pose().subscribe([](const auto& sample) {
const auto& hand = sample.value.payload.hand;
const auto& wrist = sample.value.payload.wrist;
if (hand) {
std::cout << "fingertips=" << hand->fingertips.size()
<< " fresh=" << hand->fresh << '\n';
}
if (wrist) {
std::cout << "wrist valid=" << wrist->valid
<< " fresh=" << wrist->fresh << '\n';
}
});
const auto imu_subscription = device.imu().subscribe([](const auto& sample) {
for (const auto& sensor : sample.value.payload.imus) {
if (const auto* raw = std::get_if<qnbot::GloveImuRawCounts>(&sensor.values)) {
std::cout << "sensor=" << +sensor.id << " valid=" << sensor.valid
<< " gyro_raw=" << raw->gyroscope_raw[0] << '\n';
} else {
const auto& physical = std::get<qnbot::GloveImuPhysicalValues>(sensor.values);
if (physical.gyro_mdps) {
std::cout << "sensor=" << +sensor.id
<< " gyro_mdps=" << (*physical.gyro_mdps)[0] << '\n';
}
}
}
});
try {
glove.start();
glove.run_forever();
} catch (...) {
glove.close();
throw;
}
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 main.cpp above. Replace its config.devices = {qnbot::GloveConfig{}}; line with the following configuration. Set the Receiver port and choose qnbot::Side::left or qnbot::Side::right, then rebuild and run as described in Installation.
qnbot::SerialConnection receiver_connection;
receiver_connection.port = "<receiver-port>";
config.devices = {qnbot::GloveConfig{qnbot::Side::right, receiver_connection}};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.
Use this as main.cpp in the CMake project, then run the built program with the serial port as its only argument.
#include <qnbot/glove.hpp>
#include <iostream>
int main(int argc, char** argv) {
if (argc != 2) {
std::cerr << "Usage: pressure <port>\n";
return 1;
}
qnbot::SerialConnection connection;
connection.port = argv[1];
qnbot::GloveConfig config;
config.connection = connection;
qnbot::SdkConfig settings;
settings.devices.push_back(config);
qnbot::Sdk sdk(settings);
auto glove = sdk.glove();
auto device = glove.device();
const auto subscription = device.pressure().subscribe(
[](const qnbot::Sample<qnbot::GlovePressure>& sample) {
std::cout << "pressure: " << +sample.value.readings[0]
<< " kPa: " << sample.value.estimated_kpa[0] << '\n';
});
glove.start();
glove.run_forever();
}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() (an empty error() means unknown and b_error() equal to 0.0 is a valid zero; the _us fields and _ms() aliases are deprecated).
See Examples for the matching emf.cpp setup and run instructions.