SDKC++ SDK

Migration

API replacements and workflow changes when upgrading from Glove SDK 1.9.0 to 2.0.0 (Helix magnetic-inertial glove support) or earlier versions.

Current version · 2.0.0

Migration

Upgrading from 1.9.0 to 2.0.0

Helix magnetic-inertial glove support and read interface changes

2.0.0 adds Helix magnetic-inertial glove support. Helix uses the existing Glove discovery, configuration, connection and startup entry points, so current integration code connects it without a new workflow. Read interfaces change as follows:

  • pose: read hand and wrist separately through the optional payload.hand / payload.wrist (std::optional) instead of payload-level fingertip and pose fields; root_pose is removed, so correlate hand and wrist by their own timestamps.
  • imu: read payload.imus per sensor, select by id / location and check each sensor's valid / fresh; read the magnetometer as raw counts from the optional payload.magnetometer.
  • emf: device.emf() is new and returns raw I/Q signed integral matrices acquired in pairs with hand pose; EMF time uses the millisecond accessors ref(), error() and b_error() on GloveHelixEmfTime.

When upgrading from 1.8.1 or earlier, see the field replacement table under Upgrading from 1.8.1 to 1.9.0 on this page; see Reading raw data for channel fields and correlation.

Before upgrading a composite application, check its Core dependency: Glove 2.0.0 pairs with Core 2.0.0, so composite applications require a complete delivery whose Exo package also matches Core 2.0.0. The Glove C++ compatibility declaration is qnbot-glove-cpp-2 with feature_revision 4; clean and rebuild applications against the paired Core/Glove 2.0.0 headers, wrapper libraries, and native libraries.

Unified bone-configuration creation entry

2.0.0 removes prepare_bone_config_terminal() and create_bone_config_session() in favor of create_bone_config(). Migrate call sites as follows:

1.9.0 call2.0.0 call
prepare_bone_config_terminal(...)create_bone_config(...), using terminal interaction by default (CaptureInteractionMode::auto_terminal)
create_bone_config_session(...)create_bone_config(..., CaptureInteractionMode::external)

The return type is BoneConfigCreationResult (std::variant<BoneConfigInstallResult, BoneConfigSession>). Use std::get<BoneConfigInstallResult> for default terminal mode, or std::get<BoneConfigSession> for external interaction: keep the session open until poll() reports completion, call install(), then release it through RAII or close(). Select terminal overwrite policy at creation, or external overwrite policy at install(). After saving, construct the SDK with the same wearer identifier and hand. See Bone configuration API for signatures and return types.

Default replacement for bone measurement

When the overwrite policy is omitted, terminal create_bone_config() and BoneConfigSession::install() now default to BoneConfigOverwritePolicy::replace_existing, replacing the saved profile for the same wearer and hand once the new measurement validates and saves. A validation, cancellation, or write failure preserves the existing profile. Pass BoneConfigOverwritePolicy::deny explicitly to retain existing-file rejection:

#include <qnbot/glove.hpp>
#include <iostream>
#include <variant>

const auto installed = std::get<qnbot::BoneConfigInstallResult>(
    qnbot::create_bone_config(
        qnbot::BoneConfigSessionOptions{qnbot::Side::right, "operator-01"},
        qnbot::CaptureInteractionMode::auto_terminal,
        qnbot::BoneConfigOverwritePolicy::deny));
std::cout << installed.path << '\n';

For external interaction, call bone_config_session.install(qnbot::BoneConfigOverwritePolicy::deny) after measurement completes to protect an existing profile.

Bone profile export and manual restoration

2.0.0 removes import_bone_config(), adds export_bone_config() for backups, and restores historical files by placing them in the data directory. Remove import_bone_config() calls. export_bone_config() accepts a backup destination path and returns that destination path string:

#include <qnbot/glove.hpp>
#include <iostream>

const auto exported_path = qnbot::export_bone_config(
    "/path/to/backup/right.yaml", "operator-01", qnbot::Side::right);
std::cout << exported_path << '\n';

Export rejects an existing destination by default (BoneConfigOverwritePolicy::deny). Explicitly pass BoneConfigOverwritePolicy::replace_existing to replace it. A missing or invalid saved profile reports an error.

Before restoring a historical file, stop and close the old SDK. Prepare valid UTF-8 single-hand “上位机配置 YAML” and place the right-hand file for operator-01 at ~/.qnbot/glove/bone-configs/operator-01/right.yaml (left.yaml for the left hand). QNBOT_SDK_HOME selects a custom data root, followed by the QNBOT_HOME fallback. Special characters in the operator are UTF-8 percent-encoded. Construct a new SDK with the same operator, side, and data directory to load it. See Storage and loading for full path and file requirements.

Unified eight-gesture prompt alignment

2.0.0 corrects the mcp90_pip90 prompt from "natural fist" to bending the four non-thumb MCP and PIP joints palmward while keeping DIP joints near straight and the thumb relaxed, and aligns Chinese and English prompts across all eight gestures. See Capture for the full gesture table.

  • An ordinary fist curls the DIP joints, so old prompts do not confirm that historical samples match the required posture. If 1.9.0 or earlier captures curled the DIP joints or the recorded posture cannot be confirmed, force a full eight-gesture recapture after upgrading with config.algorithms.capture.force = true or start_capture(..., true) (pass --force to the paired host_capture_calibration example), then recalibrate affected targets. config.algorithms.calibration.force = true only refits existing frames and cannot fix old capture posture.
  • Compatible captures that already meet the required posture continue to be reused. The eight stage IDs, order, 30 frames per stage, non-optional status, capture profile, storage format, and per-package subset fitting are unchanged; prompt updates do not automatically delete, migrate, or certify older samples.
  • External capture UIs should render prompt / prompt_en returned by the plan and progress directly instead of hard-coding "natural fist".

Standalone capture quality check and updated built-in Skeleton

2.0.0 adds standalone capture quality checking across all desktop targets and updates the built-in Skeleton posture evaluation. See Standalone capture quality check for usage.

  • Existing CaptureConfig, capture_status(), start_capture(), confirmation/retry/cancel calls, calibration calls, and capture reuse are unchanged. Applications using 1.9.0 released APIs do not need to change capture code or migrate data.
  • The unmerged draft capture.quality_check, --quality-check, and capture-progress quality_feedback fields have been withdrawn. Applications that tried the draft must remove those settings, flags, and progress fields and switch to the standalone quality session (device.create_capture_quality_session() for online devices, or qnbot::create_capture_quality_session(side, device_model) for playback, external input, or explicit model overrides), actively collecting 30-frame GloveHandPose windows for assess_stage() and handling the returned CaptureQualityFeedback.
  • Applications that tried preview model names must replace qnbot, moxian, and qnbot_imu with standard, hmp_mx, and helix (CaptureQualityDeviceModel::standard, hmp_mx, helix). Online applications using device.create_capture_quality_session() can remove local model mappings.
  • Built-in Skeleton updates its gesture posture evaluation (checking four-finger spacing on close and checking spread relative to the passed close reference on open). Older derived Skeleton calibrations recompute automatically while complete compatible raw captures continue to be reused (force recapture if old samples used a natural fist).

EMF millisecond time accessors

GloveHelixEmfTime adds fractional device-clock millisecond accessors ref(), error(), and b_error() (for example, ref_us=2500 corresponds to ref()=2.5 and error_us=1 corresponds to error()=0.001). Call these accessors in new code and remove manual / 1000.0 conversions. An empty error() still means unknown, b_error() equal to 0.0 remains a valid zero, and device-clock time still cannot be subtracted directly from Unix time or Sample.observed_at.

  • The microsecond fields ref_us, error_us, and b_error_us retain their storage layout and constructor usage but are marked @deprecated for removal in a future breaking release; the new accessors derive from them without changing C++ struct layout.
  • The transitional methods ref_ms(), error_ms(), and b_error_ms() are marked [[deprecated]]; use ref(), error(), and b_error().
  • EMF JSON adds ref_ms, error_ms, and b_error_ms keys. Older wrappers reject the new keys, so do not swap only the native library; rebuild applications with the paired Core/Glove 2.0.0 headers, wrapper libraries, and native libraries declaring feature_revision 4.

Upgrading from 1.8.1 to 1.9.0

Before upgrading a composite application, check its Core dependencies: the Glove 1.9.0 online package requires Core 1.9.0, while Exo 1.4.0 requires Core 1.8.0. These online packages cannot be installed together; use a complete delivery with matching dependencies.

Update the matching Glove/Core 1.9.0 dependencies and the pose, IMU and EMF read code. Rebuild the application with the matching headers and libraries. This release changes three reads: pose separates hand and wrist, IMU becomes per-sensor with a magnetometer, and EMF is a new channel.

Pose: read hand and wrist separately

1.8.1 read path1.9.0 read path or action
payload.fingertip_world / payload.fingertip_localpayload.hand.fingertips
Device, side, time and quality fields on the pose payloadCorresponding fields within payload.hand
GloveFeaturePayloadGlovePosePayload, containing optional hand and wrist
payload.root_poseRemoved. Use the hand's coordinate_frame and read the wrist separately from payload.wrist

Check hand and wrist presence, timing, freshness and validity independently. Wrist position uses meters and quaternion_xyzw uses XYZW order. Hand and wrist update independently, so correlate them according to the application's timing requirements.

C++ checks hand / wrist through std::optional and accesses fields such as hand->fingertips and wrist->position.

IMU: per-sensor reads and magnetometer

Iterate over payload.imus, select sensors by id / location, then check each sensor's valid and fresh. The former payload-level validity, gyroscope and accelerometer fields move into individual sensors and their values. GloveImuRawCounts provides gyroscope_raw / accelerometer_raw, and GloveImuPhysicalValues provides gyro_mdps / accel_mg. Check the value type and process raw counts or mdps/mg accordingly.

Read the optional magnetometer from payload.magnetometer. Its x/y/z values use raw counts and units is raw_counts. Preserve missing coordinates and valid zero values.

Raw EMF I/Q channel (emf)

device.emf() reads raw I/Q signed integral matrices acquired in pairs with hand pose. Correlate by source, session and pair sequence. Selecting this channel establishes paired acquisition, which subsequent reads retain. The channel requires a device that supports paired acquisition. See Raw EMF I/Q for fields and correlation.

Complete calibration reuse and pressure estimates

After the target successfully produces output, call device.export_calibration(destination, target) to export its active algorithm configuration, bone configuration and calibration result. Choose a destination that does not exist. Export reports unavailable when the current route has no valid calibration. Other applications set TargetAlgorithm.calibration_key to that file and match the target and hand side. Omitting this option retains the default workflow.

Pressure retains 460 readings and adds matching estimated_kpa values in kPa. Estimates use an average palm curve, with raw readings 107–255 sharing an approximately 40.01 kPa software ceiling. Keep applying existing thresholds to readings when they distinguish values from 107 to 255.

Clean and rebuild C++ applications and bridges using Core/Glove headers, wrapper libraries and native libraries from the same complete delivery. The Glove C++ compatibility identifier is qnbot-glove-cpp-2 with feature_revision 2. Studio bridges must match this declaration. After updating readers, verify pose, IMU, magnetometer and EMF reads.

Upgrading from 1.7.0 to 1.8.1

Wireless glove IMU

Glove SDK 1.7.0 wireless startup enabled pose only and published no IMU. In 1.8.1, start() enables pose plus the available same-hand IMU; pose-only devices continue to provide pose.

  1. Upgrade matched SDK/Core libraries, plus glove and Receiver firmware that provide same-hand combined pose and IMU output. Confirm compatibility through the product delivery guide rather than the firmware version string alone.
  2. Keep using GloveConfig, SerialConnection and device.imu(); no API changes are needed.
  3. Read each hand's IMU, check startup errors, source, valid and raw counts, then retest independent stop and reconnection. See Wireless IMU.

Upgrading from 1.6.0 to 1.7.0

Upgrade older Receiver configurations

GloveReceiverConfig has been removed. Declare one GloveConfig per glove, set a different hand on each, and use the same Receiver port. See the Receiver example.

Subscription error logging

Callback and sample-decoder failures are now written to stderr. Make sure the application or host retains standard error output.

Background waits

Do not wait for output to end before calling join(); observe data consumption and the background join() result concurrently. When the background run ends early, cancel pending data waits and keep its original failure. Complete stop, join and close on success, error and cancellation. See Runtime modes.

Eight-gesture capture

Capture now uses eight fixed gestures of 30 frames each, none skippable. Earlier captures and calibrations are not reused.

  1. After upgrading, follow the wizard to capture all eight gestures and calibrate the target again.
  2. Custom capture UIs display the returned eight-stage plan without skip controls.
  3. To capture before selecting an external algorithm package, start the device in manual mode and pass an empty package_ids to use the included Skeleton's eight-gesture plan. Set force only when all motions must be captured again.

Upgrading from 1.5.0 to 1.6.0

APIs, ABI and configuration formats are unchanged; these are runtime behavior changes.

Subscription pacing

For subscriptions with max_rate_hz, processing time now counts toward the delivery period, so deliveries may arrive more often. Recheck callback budgets, CPU use and queue backlog; lower max_rate_hz if you need a slower cadence.

Algorithm package validation

Packages are now validated at installation; installed packages need no reinstall. If installed files are damaged, follow Qnbot CLI package recovery and recreate the SDK. Do not delete the whole SDK data directory.

Results after cancelling calibration

When calibration is cancelled (Cancelled / cancelled), all new results from that session are discarded and the previous valid result is restored.

  • Display Cancelled as "calibration interrupted" and rely on the final state; start another attempt and wait for Completed when calibration is needed.
  • Cancelled results left by older versions are not cleaned up automatically; complete a new successful calibration to replace them.

First Skeleton use on macOS

Skeleton preparation now happens on the first device.skeleton() call. Keep calling it before starting the device and within error handling.

Startup update notices

In Glove 1.9.0, the first Glove start per SDK instance waits up to one second for an OTA check and continues if the check fails. Include that wait when measuring cold-start time. See SDK update notices at startup.

TLS dependencies

Replace matching Core/Glove and rebuild; updating system certificates alone does not replace an older native library. Keep certificate verification enabled.

Upgrading from 1.4.0 to 1.5.0

Applications that only use automatic calibration can keep calling start() without arguments. Replace the 1.5.0 Core/Glove headers, libraries, CMake packages and Conan packages together, then clean and rebuild. Roll back the SDK and algorithm packages as a matching pair.

Start the device before manual capture

Start the device with CalibrationMode::manual before creating capture and calibration sessions:

auto device = glove.device("operator-glove", qnbot::Side::left);
device.start(qnbot::CalibrationMode::manual);

auto capture = device.start_capture(
    {},  // Empty: included Skeleton; or IDs of packages configured in the SDK
    "operator-001",
    false
);
// After capture completes, start calibration through the same device.

Switching calibration mode

The calibration mode locks for the current start cycle, including across reconnects. Stop the device before switching among automatic, manual and none. Do not reuse a capture session across start cycles; doing so reports StaleUpdateError. Do not request calibration in none mode.

Headless apps and external input

Headless applications use CaptureInteractionMode::external. When the application supplies external frames, keep pushing frames after the background run returns.

Manual scheduling loops

Call sleep() on every update() result instead of checking has_next_task(); on SleepResult::no_tasks, yield briefly.

Subscription delivery (optional)

To control backlog or rate, call ReadChannel<T>::with_config() before subscribing and choose SubscriptionConfig::latest(max_rate_hz) or SubscriptionConfig::fifo(capacity, max_rate_hz).

Algorithm and bone configuration

TargetAlgorithm adds algorithm_config_path, and bone-file behavior uses BoneConfigUsage (default auto_detect). Select disabled to ignore existing bone configuration; use BuiltinAlgorithm::skeleton for the built-in Skeleton. Recapture or recalibrate as the algorithm requires after changing these settings.

Device identity source_id

source_id changes from the hardware SN to configured name plus side, for example glove.03B033502FD3.left becomes glove.left-main.left.

  1. Before upgrading, close all SDK applications and back up QNBOT_SDK_HOME (or QNBOT_HOME; .qnbot under your user home when neither is set).
  2. Select devices with glove.device(name, side) and read their source_id() to update persisted keys, subscription routes and log filters. Do not construct it yourself.
  3. Keep QNBOT_SDK_HOME writable so compatible calibration for the same physical glove migrates automatically. After replacing a physical glove, capture and calibrate it again.
  4. If an old identity-unverified glove had a configured name equal to the current glove's SN (get_device_info().canonical_sn), remove the ambiguous old calibration and recalibrate before upgrading.

Capture UI

Display CapturePlan.stages in returned order and support the optional prompt_en, falling back to prompt.

Cancellation and exceptions

Stopping, disconnecting or closing a device cancels calibration with Cancelled and error code "cancelled". Remove references to GloveControlErrorKind::first_pose_timeout and handle cancellation explicitly. If code catches only WorkflowError, add handlers for LifecycleError and UnavailableFeatureError.

Algorithm package ABI

Upgrade external qnbot_hand packages to ABI 2.1. Close every SDK using a package before uninstalling it.

Time reference

Status and new records use the Glove time reference. Do not compare old relative times with new absolute times. See Timestamps and external time.

Upgrading from 1.3.0 to 1.4.0

Replace Core and Glove together and rebuild

Update the 1.4.0 Core/Glove headers, libraries, CMake packages and Conan packages together. Clear the CMake cache, object files, static libraries and plugins, then rebuild. An old ABI is rejected before SDK construction.

Time values in milliseconds

All time fields use milliseconds and the output field is timestamp_ms. Update code that reads, stores or forwards time:

qnbot::ExternalGloveFrame frame;
// ...fill thumb, index, middle, ring, pinky...
frame.timestamp_ms = 1'700'000'000'123.0;

The legacy frame.timestamp_sec input still works (converted as timestamp_ms = timestamp_sec * 1000), but do not set it together with timestamp_ms.

External time reference (optional)

Pass absolute Unix milliseconds as a double to qnbot::Glove::sync_time():

qnbot::Sdk sdk(config);
auto glove = sdk.glove();
glove.sync_time(reference_time_ms);
glove.start();

Exo + Glove composite (optional)

For shared-serial hardware, use qnbot::CompositeExoGloveConfig. See Glove + Exo composite solution.

Upgrading from 1.2.x to 1.3.0

Replace the 1.3.0 Core/Glove headers and libraries, clear the old CMake build cache, and rebuild.

Capture and calibration move to GloveDevice

CaptureStartRequest and CaptureStatusRequest have been removed. Call start_capture(), capture_status() and start_calibration() directly on a GloveDevice:

auto device = glove.device(qnbot::Side::left);  // or by name: glove.device("my-glove")

auto readiness = device.capture_status(package_ids, operator_id);
auto capture = device.start_capture(package_ids, operator_id, false);
auto calibration = device.start_calibration(capture, targets);

CalibrationInteractionMode renamed

Use qnbot::CaptureInteractionMode; the values are unchanged.

Capture settings move to algorithms.capture

Move interaction and operator_id from algorithms.calibration to algorithms.capture:

config.algorithms.capture.interaction =
    qnbot::CaptureInteractionMode::external;
config.algorithms.capture.operator_id = "operator-001";
config.algorithms.calibration.force = false;

Upgrading from 1.1.x to 1.2.0

See the C++ SDK changelog for all changes.

Packages

Replace Core and Glove together. Clear the CMake cache, object files, static libraries and plugins, then rebuild.

Lifecycle

connect() is deprecated; call start() directly. Replace disconnect() with stop().

SDK construction

Construction now discovers devices, verifies identity and resolves targets, and may throw. Create the SDK once hardware and algorithm packages are ready, and wrap construction in error handling.

get_device_info()

Returns the identity snapshot saved at creation and no longer refreshes it. Handle UnavailableFeatureError when unverified devices are allowed.

Capture parameters and results

Rename candidate_ids to a non-empty package_ids. Stop saving CaptureSet; keep the move-only CaptureSession open until calibration.

Calibration sessions

Use start_calibration(session, targets) to create one move-only CalibrationSession for several targets instead of a CalibrationJob per target, and read the result vector.

Capture control and state

Replace calibration_control with capture_control and read Capture and Calibration progress separately. Update UI state mapping for Sessions, stage progress, structured failures and multi-target results.

Storage and log directories

Remove CalibrationStoreConfig, calibration.store and DebugConfig.log_dir. To change directories, set QNBOT_SDK_HOME before constructing the SDK (legacy QNBOT_HOME is only a fallback).

Debug options

Change DebugDetail::raw to full (use summary for ordinary diagnostics), and use DebugModule enum values for modules.

Skeleton joint angles

Joint angles grow from 24 to 25; index 1 adds <side>_thumb_cmc_flexion. Update fixed arrays, index mappings and downstream protocols, and recalibrate Skeleton after upgrading.