SDKPython 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 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 properties ref, error and b_error on HelixEmfTime.

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. Install qnbot-sdk-glove==2.0.0 and matching Core 2.0.0 from the same delivery.

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 imports and 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(..., interaction=CaptureInteractionMode.EXTERNAL)

Default terminal mode returns BoneConfigInstallResult. External interaction returns a BoneConfigSession owned by the application: keep it open until poll() reports completion, call install(), then release it through with 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:

from qnbot_sdk import Side
from qnbot_sdk.glove import BoneConfigOverwritePolicy, create_bone_config

installed = create_bone_config(
    side=Side.RIGHT,
    operator_id="operator-01",
    overwrite=BoneConfigOverwritePolicy.DENY,
)
print(installed.path)

For external interaction, call bone_config_session.install(overwrite=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() imports and calls. export_bone_config() accepts a backup destination path and returns that destination path string:

from qnbot_sdk import Side
from qnbot_sdk.glove import export_bone_config

exported_path = export_bone_config(
    "/path/to/backup/right.yaml",
    side=Side.RIGHT,
    operator_id="operator-01",
)
print(exported_path)

Export rejects an existing destination by default (BoneConfigOverwritePolicy.DENY). Explicitly pass BoneConfigOverwritePolicy.REPLACE_EXISTING to replace it. A missing or invalid saved profile raises 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 CaptureConfig(force=True) or start_capture(..., force=True) (pass --force to the paired host_capture_calibration example), then recalibrate affected targets. CalibrationConfig(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 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

HelixEmfTime adds fractional device-clock millisecond properties ref, error, and b_error (for example, ref_us=2500 corresponds to ref=2.5 and error_us=1 corresponds to error=0.001). Read these properties in new code and remove manual / 1000 conversions. error being None still means unknown, b_error == 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 values and constructor fields but are marked deprecated in field metadata for removal in a future breaking release.
  • The transitional aliases ref_ms, error_ms, and b_error_ms are deprecated and emit DeprecationWarning; use ref, error, and b_error.
  • EMF JSON adds ref_ms, error_ms, and b_error_ms keys. Older bindings reject the new keys, so upgrade qnbot-sdk-glove==2.0.0 and matching Core 2.0.0 together and run python -m pip check; strict custom JSON decoders must allow the added keys.

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. 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.

Python hand_side uses Side.LEFT / Side.RIGHT. Check hand / wrist for None before access.

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.

Upgrade to qnbot-sdk-glove==1.9.0 with its exact Core 1.9.0 dependency and run python -m pip check. After updating consumers, verify pose, IMU, magnetometer, EMF, calibration reuse, stop and reconnection. Check the exact Exo Core dependency before upgrading a composite application.

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 and language bindings, 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 logged by the qnbot_sdk.channels logger at ERROR with a traceback. Make sure application logging retains ERROR records from that logger.

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

Install matching Core/Glove and rebuild; updating certifi or 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. 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:

from qnbot_sdk import Side
from qnbot_sdk.glove import CalibrationMode

device = glove.device("operator-glove", side=Side.LEFT)
device.start(CalibrationMode.MANUAL)

capture = device.start_capture(
    package_ids=(),  # Empty: included Skeleton; or IDs of packages configured in the SDK
    operator_id="operator-001",
)
# 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 AUTO, 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. With push_frame(), keep pushing frames after run_background() 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.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 use_bone_config (default "auto"). Set use_bone_config=False 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 removed enums

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.

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

Upgrade Core and Glove together

python -m pip install --upgrade "qnbot-sdk-glove==1.4.0"

If the application bundles wheels, native libraries or a virtual environment, remove old artifacts and rebuild.

Time values in milliseconds

All time fields use milliseconds and output exposes timestamp_ms only. Update code that reads, stores or forwards time:

frame = ExternalGloveFrame(
    thumb=thumb,
    index=index,
    middle=middle,
    ring=ring,
    pinky=pinky,
    timestamp_ms=1_700_000_000_123.0,
)

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

External time reference (optional)

Pass absolute Unix milliseconds to Glove.sync_time():

import time

sdk = Sdk(devices=(GloveConfig(),))
glove = sdk.glove()
glove.sync_time(time.time() * 1_000.0)
glove.start()

Exo + Glove composite (optional)

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

Upgrading from 1.2.x to 1.3.0

Capture and calibration move to GloveDevice

Call start_capture(), capture_status() and start_calibration() on a GloveDevice and drop the source and side arguments:

device = glove.device(side=Side.LEFT)  # or by name: glove.device("my-glove")

readiness = device.capture_status(
    package_ids=["qnbot-dexhand"],
    operator_id="operator-001",
)
capture = device.start_capture(
    package_ids=["qnbot-dexhand"],
    operator_id="operator-001",
)
calibration = device.start_calibration(
    completed_capture_session=capture,
    targets=targets,
)

CalibrationInteractionMode renamed

Use CaptureInteractionMode; the values are unchanged.

Capture settings move to CaptureConfig

Move interaction and operator_id from CalibrationConfig to CaptureConfig:

algorithms = AlgorithmsConfig(
    capture=CaptureConfig(
        interaction=CaptureInteractionMode.EXTERNAL,
        operator_id="operator-001",
    ),
    calibration=CalibrationConfig(force=False),
)

Upgrading from 1.1.x to 1.2.0

See the Python SDK changelog for all changes.

Packages

Remove old wheels, install Core and Glove from the same release, and rebuild packaged deliverables.

Lifecycle

connect() is deprecated. Call start() after setting up reads and subscriptions, stop() when finished, then close().

SDK creation

Creating Sdk now discovers devices and resolves algorithm packages, and may raise. Prepare devices and packages first, wrap construction and start() in error handling, and recreate the SDK after device or configuration changes.

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. Remove CaptureSet logic; keep the CaptureSession open and pass it to start_calibration().

Calibration sessions

Create one CalibrationSession with start_calibration(completed_capture_session=..., targets=(...)) instead of a CalibrationJob per target, and manage it with snapshot(), result(), wait(), cancel() and close().

Capture control and progress

Replace calibration_control() with capture_control(). Read gesture progress from CaptureProgress.stage and target status from CalibrationProgress.job. confirm(), skip() and cancel() take request_id; retry() takes stage_id.

States and fields

  • Capture: in-progress states become RUNNING, CAPTURED becomes COMPLETED, reuse is origin=REUSED, stage_runs becomes stage_progress, and resolved_packages is gone.
  • Calibration: remove SAVING and CalibrationJobSnapshot branches; track package ID and version from your own target configuration instead of CalibrationResult.

Storage and log directories

Remove CalibrationStoreConfig, CalibrationConfig.store and DebugConfig.log_dir. To change directories, set QNBOT_SDK_HOME before creating Sdk (legacy QNBOT_HOME is only a fallback).

Debug options

Change DebugDetail.RAW to FULL or SUMMARY, and replace module strings with DebugModule enum values.

Skeleton joint angles

Joint angles grow from 24 to 25; index 1 adds <side>_thumb_cmc_flexion and the rest shift by one. Read by joint name, update downstream protocols, and recalibrate Skeleton after upgrading.