SDKPython SDK

Configuration reference

Fields, types, defaults and constraints for every configuration object.

Current version · 2.0.0

Configuration reference

auto_terminal also supports automatic-policy manual updates and external-input background preparation. Services and custom UIs use external. See the runtime notes.

GloveConfig

FieldTypeDefault
sideSide | NoneDefaults to None; for serial port devices, read from the verified identity
connectionSerialConnection | ExternalConnectionDefaults to SerialConnection() automatic discovery
namestr | NoneDefaults to None
enabledboolDefaults to True
  • side: Required for external input
  • side: an explicit value must match the device or the input frame
  • connection: The serial port is used for a physical glove
  • connection: external is used for per-frame external input
  • name: When provided, it must be non-empty and distinct among enabled same-side gloves; opposite sides may share a name when selected by name and side
  • name: with multiple devices, explicitly naming them is recommended
  • enabled: When False, it does not connect, does not start, cannot be selected, and cannot serve as a target source

Wired and Receiver wireless gloves both use GloveConfig, with one declaration per glove. SerialConnection.port accepts a wired-glove or Receiver port; opposite hands on one Receiver can use the same port, and the SDK shares the connection. Do not duplicate an ordinary wired port or the same hand side on one Receiver. Both Receiver and glove identities must be verified; the wired legacy-firmware identity fallback does not apply. See Wireless glove connection.

CompositeExoGloveConfig

FieldTypeDefault
devicesSequence[DeviceConfig]Required; at least one member
connectionSerialConnectionSerialConnection() (automatic discovery)
enabledboolTrue
namestr | NoneNone

When provided, name must be non-empty. It identifies only the outer group and is not inherited by members. Keep member connections at their defaults and configure the shared serial connection on the group. See the composite guide.

SerialConnection

FieldTypeDefault
auto_discoverboolAutomatically becomes True when no locating field is provided
portstr | NoneDefaults to None
serial_numberstr | NoneDefaults to None
baudrateint | NoneDefaults to None, which uses the SDK default
  • auto_discover: Choose exactly one of this, port, and serial_number
  • auto_discover: the discovery result must be unique and pass identity validation
  • port: Specifies the serial port
  • port: the configured identity can be used only when GloveConfig.side is also provided, the port is recognized as a supported wired directly connected glove, and the old firmware does not support id
  • serial_number: Discovers by USB serial number, always requires a valid device identity, and cannot use the old firmware fallback
  • baudrate: must be an integer between 1 and 4294967295 when provided

ExternalConnection

ExternalConnection has no configuration fields, but requires GloveConfig.side.

TargetConfig

FieldTypeDefault
typeTargetType | NoneInferred when the candidate is unique
namestr | NoneStays omitted and is not generated from package resources
sideSide | NoneInferred when the candidate is unique
sourceDeviceSelector | NoneInferred when the candidate is unique
algorithmsSequence[TargetAlgorithm]Defaults to an empty sequence
  • type: An explicit value narrows and validates the candidates
  • type: the currently public values are HAND and ARM
  • name: Caller-defined output instance name
  • name: it must not be duplicated for the same target ID, and the reserved name skeleton cannot be used as an ordinary target name
  • side: An explicit value must be compatible with the source and the algorithm capabilities
  • source: Zero candidates or multiple candidates both cause SDK creation to fail
  • algorithms: Executed in configuration order
  • algorithms: an empty sequence means the input is passed through directly

DeviceSelector

FieldTypeDefault
typestrNo default value
namestr | NoneDefaults to None
sideSide | NoneDefaults to None
  • type: Must be a non-empty device type
  • type: gloves use "glove"
  • name: Matches the device name in the configuration
  • side: Matches the physical side of the device
  • side: the combined conditions must uniquely select one enabled source

TargetAlgorithm

TargetAlgorithm.calibration_key is an optional path to a complete .qnbotkey file exported with device.export_calibration(). Replay its algorithm configuration, bone configuration and calibration result. Omitting it retains the default capture/calibration workflow.

FieldTypeDefault
idstr | BuiltinAlgorithmNo default value
algorithm_config_pathstr | NoneNone
calibration_keystr | PathLike[str] | NoneNone
use_bone_configLiteral["auto"] | bool"auto"
  • id: use a non-empty package ID, or BuiltinAlgorithm.SKELETON for the built-in Skeleton
  • algorithm_config_path: optional parameter override file for this target. Save it somewhere the application can read and preferably supply an absolute path. The SDK does not discover it automatically; omit the field to use the algorithm defaults.
  • External packages must be installed and platform-compatible; qnbot_hand packages require ABI 2.1

Personal bone profile loading

TargetAlgorithm.use_bone_config controls personal bone profiles only, not the override file selected by algorithm_config_path.

Use create_bone_config() to measure and save a personal profile before constructing Sdk. A successful repeated measurement replaces the same wearer and hand profile by default. Use export_bone_config() to back up a saved single-hand profile. Export rejects an existing destination by default. Restore historical profiles by placing their files in the matching directory. See Personal bone profile file for QR preparation, export, and storage.

use_bone_configBehavior
"auto" (default)Load an existing profile; use the algorithm default model when the file is missing
TrueRequire a readable, valid, compatible personal profile; otherwise SDK creation fails
FalseIgnore personal profiles and use the algorithm default model

The SDK resolves files by AlgorithmsConfig.capture.operator_id and device side, rather than taking an arbitrary bone path in GloveConfig:

<application-data-root>/glove/bone-configs/<encoded-operator_id>/left.yaml
<application-data-root>/glove/bone-configs/<encoded-operator_id>/right.yaml

The data root defaults to ~/.qnbot and can be overridden through environment variables; see Application data directory for precedence. Unsafe characters in operator_id are encoded as UTF-8 bytes using %HH; do not concatenate raw user input into a path.

Automatic mode falls back only for missing files. It does not ignore read errors or invalid YAML in existing profiles. Requiring a profile means the file must be valid; it is not a higher accuracy level. Close and recreate Sdk after changing parameter or profile files to reload them.

Use measured values and the export format supported by the selected algorithm. Keep display-model bone lengths consistent: scaling a mesh does not change SDK kinematics, and SDK parameters do not automatically rebind third-party skins. See Personal bone lengths and skin binding.

For a complete runnable example, see algorithm_configuration.py.

To adjust fingertip offsets or use personal bone profiles, see Hand model parameter configuration, which distinguishes algorithm overrides, bone profiles, and results computed from captured samples.

AlgorithmsConfig

FieldTypeDefault
calibrationCalibrationConfigDefaults to CalibrationConfig()
captureCaptureConfigDefaults to CaptureConfig()
  • calibration: Controls whether to recalculate the calibration
  • capture: Controls the interaction mode, the wearer identifier, and whether an existing capture is reused

CaptureConfig

FieldTypeDefault
interactionCaptureInteractionModeDefaults to AUTO_TERMINAL
forceboolDefaults to False
operator_idstrDefaults to "default"
  • interaction: AUTO_TERMINAL suits a foreground terminal
  • interaction: GUI, remote, or no-TTY hosts use EXTERNAL and handle Capture control
  • force: When True, ignores reusable raw frames and samples again
  • force: it is not continuous capture and does not sample again on every update
  • operator_id: Must be a non-empty string
  • operator_id: serves as the wearer identifier, used to separately look up and save captures and calibration records for different wearers

CalibrationConfig

FieldTypeDefault
forceboolDefaults to False
  • force: When True, recalculates the calibration using the currently available capture without forcing a new sample
  • force: after it succeeds the same SDK reuses the new result on stop or reconnect; the next SDK created with force=True still set recalculates again

The two force settings are not interchangeable: use CaptureConfig.force to resample raw frames, or CalibrationConfig.force to recompute calibration from the available capture.

DebugConfig

FieldTypeDefault
modulesSequence[DebugModule]Defaults to empty
detailDebugDetailDefaults to SUMMARY
sample_rateint | NoneDefaults to None, and ordinary events are not sampled
  • modules: Optional: TRANSPORT, DEVICE, CAPTURE, CALIBRATION, RETARGETING, OUTPUT
  • detail: Can only be SUMMARY or FULL
  • detail: FULL records more runtime data and produces a larger log volume
  • sample_rate: When provided, it must be a positive uint32
  • sample_rate: a value of N means one record out of every N, and important events are not dropped

SdkConfig and Sdk(...)

FieldTypeDefault
devicesSequence[DeviceConfig]Required in SdkConfig; omitting it in Sdk(...) is equivalent to an empty sequence
targetsSequence[TargetConfig]Defaults to an empty sequence
debugDebugConfig | NoneDefaults to None, and no Debug logs are created
algorithmsAlgorithmsConfigUses the default configuration
  • devices: Each item must be a public device configuration
  • devices: enabled gloves must have unique name-and-side identities and final source IDs
  • targets: Each target must resolve to an enabled source
  • targets: creation fails on duplication, ambiguity, or incompatibility
  • debug: When provided, enables Debug logs for that SDK instance
  • algorithms: Controls Capture and Calibration behavior and is not responsible for installing algorithm packages

Application data directory

When no override is set, the SDK uses ~/.qnbot as the application data root directory.

Set QNBOT_SDK_HOME before constructing Sdk to use another directory. For compatibility, the SDK still reads QNBOT_HOME when QNBOT_SDK_HOME is absent; if both exist, QNBOT_SDK_HOME wins. Calibration records are stored in <data-root>/glove/calibrations, and Debug logs in <data-root>/logs.

  • Timing: it must be set before creating the Sdk
  • Consistency: the CLI and the SDK should use the same value, otherwise the SDK may not find the algorithm packages the CLI installed

Terminal output and interaction

With nothing configured, the built-in terminal enables level colors only in an interactive TTY: the Error label is bold red, the Warning label is yellow, the Info label uses the terminal's default foreground color, and Success key results use green. Only level labels and key results are colored; the whole message is not colorized. Debug logs and diagnostic JSON never contain ANSI colors.

NO_COLOR keeps messages plain text; QNBOT_INTERACTIVE_CONSOLE=1 tells the SDK that the current console can receive user input; PYCHARM_HOSTED=1 is set by JetBrains and makes the JetBrains Python Run/Debug Console input-capable even when it uses a pipe.

  • Coloring scope: only level labels and key results are colored, never the whole message
  • Non-TTY: redirected output, pipes and other non-TTY environments behave the same as setting NO_COLOR
  • Setting only TERM: does not make the SDK treat the console as input-capable
  • Interaction mode: these variables do not change the configured interaction mode; taking over the interaction still requires CaptureConfig.interaction to be EXTERNAL, see Capture

Subscription and algorithm configuration

SubscriptionConfig

Use channel.with_config(config) to configure one subscription without changing the original channel, other subscriptions, or defaults.

from qnbot_sdk import SubscriptionConfig

pose = device.pose()
latest_subscription = pose.with_config(
    SubscriptionConfig.latest(max_rate_hz=30)
).subscribe(on_pose)
fifo_subscription = pose.with_config(
    SubscriptionConfig.fifo(capacity=128, max_rate_hz=30)
).subscribe(on_pose)
Field / accessorTypeDefault
deliverystrFactory-selected
capacityint0 for latest
max_rate_hzfloat | NoneNone
  • FIFO capacity must be a positive integer.
  • A supplied rate must be finite and positive.
DeliveryBehavior
latestCoalesce pending values and deliver the newest value
fifoPreserve published order; discard the oldest pending value on overflow

The first available sample is delivered immediately. Delivery does not catch up after a pause. Pacing affects application callbacks and asynchronous iteration, without reducing SDK production or algorithm computation. Snapshot latest() and one-shot next() retain their existing behavior. FIFO cannot recover algorithm results coalesced before publication. Python applications may also use async for on the configured view.

TargetAlgorithm

Place the value in TargetConfig.algorithms. Use a package ID already installed through the product CLI and compatible with the SDK and platform:

from qnbot_sdk import TargetAlgorithm

algorithm = TargetAlgorithm(
    id="<package-id>",
    use_bone_config="auto",
    algorithm_config_path="config/override.yaml",
)
FieldTypeDefault
idstr | BuiltinAlgorithmRequired
use_bone_configLiteral["auto"] | bool"auto"
algorithm_config_pathstr | PathLike[str] | NoneNone
calibration_keystr | PathLike[str] | NoneNone
  • A supplied configuration path must be nonempty.
  • The selected algorithm package defines configuration file contents and errors.
Bone policyBehavior
"auto"Adopt valid existing configuration; use algorithm defaults when absent
TrueFail when configuration is missing or invalid
FalseIgnore existing configuration

Relative paths resolve from the working directory when the SDK is created. Recreate the SDK after editing the file; follow the algorithm package instructions to decide whether recalibration is required. AlgorithmsConfig.capture.operator_id selects the current operator, default default. These options do not perform bone-length calibration. Prepare existing bone configuration through the product calibration workflow. Auto does not ignore an existing invalid file. To preserve the old ordinary-target behavior that ignored bone configuration, select False explicitly. Do not provide a custom bone-file path. Replace incompatible older algorithm packages through the product CLI. See Migration for upgrade and rollback steps.