SDKC++ SDK

Configuration reference

Fields, types and defaults 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.

The source, target, algorithm, calibration, and Debug configuration must all be provided at once when the Sdk is created; an existing SDK does not support dynamic addition, removal, or modification. After the configuration or the installed algorithm packages change, close and recreate the Sdk.

Configuration itemWhen it is needed
sourceThe default configuration can be used for single-glove auto-discovery; explicit configuration is needed for multiple gloves or a fixed device
targetWhen retargeting output is needed
algorithm package configurationWhen retargeting output is needed
Capture and calibrationCan be omitted for the default wearer with terminal interaction; configure it when changing or distinguishing wearers, when an external interactive host takes over, or when recomputation is required
DebugConfigure it when troubleshooting or recording Debug logs; off by default

When only reading glove poses, start from the minimal configuration. When retargeting output is needed, configure the target first and specify its algorithm package within that section; enable calibration and Debug as the application requires.

source configuration

GloveConfig

FieldTypeDefault
namestd::optional<std::string>Defaults to empty
sidestd::optional<Side>For serial devices, read from the verified identity
connectionConnectionConfigDefaults to SerialConnection{}
enabledboolDefaults to true
  • 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: it can be omitted when the selection is already unambiguous.
  • side: required for external input.
  • side: an explicit value must match the device or the input frame.
  • connection: serial is used for physical gloves.
  • connection: ExternalConnection is used for frame-by-frame input from the application.
  • enabled: when false, the device is not connected, not started, not selectable, and cannot be used 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
devicesstd::vector<DeviceConfig>Empty; supply at least one member
connectionSerialConnectionSerialConnection{} (automatic discovery)
enabledbooltrue
namestd::optional<std::string>std::nullopt

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_discoverboolTreated as true when all three locating fields are omitted
portstd::optional<std::string>Defaults to empty
serial_numberstd::optional<std::string>Defaults to empty
baudratestd::optional<std::uint32_t>Uses the SDK default when omitted
  • auto_discover: choose one of three with port and serial_number.
  • auto_discover: the discovery result must be unique and pass identity verification.
  • port: specifies the serial port.
  • port: the legacy firmware identity fallback is allowed only when the port + side conditions below are met.
  • serial_number: discover by USB serial number; a valid device identity is always required.
  • baudrate: must be a positive integer when provided.

Exactly one of auto_discover, port, and serial_number must be specified; when all three locating fields are omitted, automatic discovery is used. When only port is provided, the side must be obtained from the device identity; when only side is provided, or neither is provided, automatic discovery is still used with strict identity verification; no fallback is used with serial_number either.

ExternalConnection

ExternalConnection has no configuration fields. When using it, GloveConfig::side is required, and every frame submitted by the application must match that side; it does not perform serial discovery, and it does not support device information, haptics, or other physical device control.

target configuration

TargetConfig

FieldTypeDefault
typestd::optional<TargetType>Inferred when the candidate is unique
namestd::optional<std::string>Stays omitted; not generated from the algorithm package
sidestd::optional<Side>Inferred when the candidate is unique
sourcestd::optional<DeviceSelector>Inferred when the candidate is unique
algorithmsstd::vector<TargetAlgorithm>Defaults to empty
  • type: an explicit value narrows down and validates the candidates.
  • type: the currently public values are hand and arm.
  • name: when provided it must be a non-empty name.
  • name: the reserved name skeleton cannot be used for an ordinary target.
  • side: an explicit value must be compatible with the source and the algorithm capabilities.
  • source: zero candidates or multiple candidates both make SDK creation fail.
  • algorithms: executed in declaration order.
  • algorithms: an empty list means the input is passed through directly.

DeviceSelector

FieldTypeDefault
typestd::stringNo default
namestd::optional<std::string>Defaults to empty
sidestd::optional<Side>Defaults to empty
  • type: must be a non-empty device type.
  • type: gloves use "glove".
  • name: matches the source name in the configuration.
  • side: matches the left/right hand 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
idstd::stringNo default
algorithm_config_pathstd::optional<std::string>Empty
calibration_keystd::optional<std::string>std::nullopt
use_bone_configBoneConfigUsageauto_detect
  • id: must be a non-empty algorithm package ID.
  • id: the corresponding package must already be installed through the Qnbot CLI.
  • id: the corresponding package must be compatible with the current platform and SDK.
  • Construct TargetAlgorithm with 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 qnbot_hand packages must support 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
BoneConfigUsage::auto_detect (default)Load an existing profile; use the algorithm default model when the file is missing
BoneConfigUsage::requiredRequire a readable, valid, compatible personal profile; otherwise SDK creation fails
BoneConfigUsage::disabledIgnore 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.

Custom retargeting packages must be installed via Qnbot CLI before creating the Sdk. See algorithm package configuration below for the installation steps.

In a single-glove, single-target scenario, you can declare only the algorithm:

qnbot::TargetConfig target_config;
target_config.algorithms = {
    qnbot::TargetAlgorithm{"<package-id>"},
};

type, side, and source can be omitted and are inferred only when the candidate is unique; an omitted name stays omitted. A fixed deployment can provide constraints explicitly:

qnbot::TargetConfig target_config;
target_config.source = qnbot::DeviceSelector{
    "glove", std::string("primary"), std::nullopt,
};
target_config.name = "dexhand";
target_config.side = qnbot::Side::right;
target_config.algorithms.push_back(qnbot::TargetAlgorithm{"<package-id>"});

TargetAlgorithm selects an algorithm with id or BuiltinAlgorithm::skeleton, and can also set a parameter override file and bone-file policy for the target. The SDK does not install external algorithm packages.

Omitting algorithms or using an empty list means that no conversion algorithm is executed and the input is passed through directly. One source can be configured with multiple targets; when reading multiple outputs, select the corresponding output by the instance name provided by the application. An omitted public instance name stays omitted and is not generated automatically from the algorithm package. The package ID is responsible for selecting the algorithm package; resource names inside the package do not override, generate, or constrain the instance name; TargetConfig::name is defined solely by the application and is used to read the output by instance name.

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.

Capture and calibration configuration (optional)

Calibration usually does not need to be configured explicitly. If the selected retargeting algorithm requires calibration, the SDK guides the operation at runtime and reuses the saved calibration record in subsequent runs.

When wearers need to be distinguished, provide the calibration configuration:

qnbot::SdkConfig config;
config.algorithms.capture.operator_id = "operator-a";

When a GUI or remote application needs to present the calibration interaction itself, see External takeover of guided interaction.

AlgorithmsConfig

FieldTypeDefault
calibrationCalibrationConfigUses the default configuration
captureCaptureConfigUses the default configuration
  • calibration: controls whether the calibration is recomputed.
  • capture: controls whether an existing capture is reused, the interaction method, and the wearer identifier.

CaptureConfig

FieldTypeDefault
forceboolDefaults to false
interactionCaptureInteractionModeDefaults to auto_terminal
operator_idstd::stringDefaults to "default"
  • force: when true, reusable raw frames are ignored and resampled.
  • force: it is not continuous capture and does not resample on every update.
  • interaction: terminal programs use auto_terminal.
  • interaction: GUI, remote, or no-TTY applications use external and handle capture control.
  • operator_id: must be a non-empty string.
  • operator_id: used to distinguish the calibration records of different wearers.

CalibrationConfig

FieldTypeDefault
forceboolDefaults to false
  • force: when true, the calibration is recomputed using the currently available capture.
  • force: resampling is not forced.
  • force: after it succeeds the same instance reuses the new result on stop or reconnection, and a newly created forced instance computes again.
  • force: it ignores compatible records that existed before this instance was created and forces one calibration per target.

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

Debug configuration (optional)

When the Debug configuration is omitted, no logs are generated. When runtime problems need to be troubleshot, you can choose the modules to record and the sample rate:

qnbot::DebugConfig debug_config{
    {qnbot::DebugModule::transport, qnbot::DebugModule::device,
     qnbot::DebugModule::capture, qnbot::DebugModule::calibration,
     qnbot::DebugModule::retargeting, qnbot::DebugModule::output},
    qnbot::DebugDetail::summary,
    10,
};

DebugConfig

FieldTypeDefault
modulesstd::vector<DebugModule>Defaults to empty
detailDebugDetailDefaults to summary
sample_ratestd::optional<std::uint32_t>Defaults to empty
  • modules: available values are transport, device, capture, calibration, retargeting, output.
  • detail: summary suits ordinary troubleshooting.
  • detail: full records more data and may contain sensitive values.
  • sample_rate: must be a positive integer.
  • sample_rate: a value of N means one out of every N ordinary records is kept.

For log locations and the scope of recorded content, see Debug logs.

Complete configuration

SdkConfig and Sdk(...)

FieldTypeDefault
SdkConfig::devicesstd::vector<DeviceConfig>Defaults to empty
SdkConfig::targetsstd::vector<TargetConfig>Defaults to empty
SdkConfig::debugstd::optional<DebugConfig>Defaults to empty
SdkConfig::algorithmsAlgorithmsConfigUses the default configuration
Sdk(SdkConfig)SdkConfigRequired
  • SdkConfig::devices: enabled gloves must have unique name-and-side identities and final source IDs.
  • SdkConfig::targets: each target must uniquely match one enabled source.
  • SdkConfig::debug: when provided, Debug logs are recorded for this SDK instance.
  • SdkConfig::algorithms: controls capture and calibration.
  • Sdk(SdkConfig): the configuration is moved into the SDK by value.
  • Sdk(SdkConfig): device and target resolution is completed during construction.

The following combines a fixed device, a retargeting algorithm package, a target, calibration, and Debug. When using only some of these capabilities, just delete the corresponding optional configuration:

qnbot::SerialConnection connection;
connection.serial_number = "YOUR-SERIAL-NUMBER";

qnbot::GloveConfig device_config{qnbot::Side::right, connection};
device_config.name = "primary";

qnbot::TargetConfig target_config;
target_config.name = "dexhand";
target_config.side = qnbot::Side::right;
target_config.source = qnbot::DeviceSelector{
    "glove", std::string("primary"), std::nullopt,
};
target_config.algorithms = {
    qnbot::TargetAlgorithm{"<package-id>"},
};

qnbot::SdkConfig config;
config.devices = {device_config};
config.targets = {target_config};
config.algorithms.capture.operator_id = "operator-a";
config.algorithms.capture.force = false;

qnbot::DebugConfig debug_config{
    {qnbot::DebugModule::transport, qnbot::DebugModule::device,
     qnbot::DebugModule::capture, qnbot::DebugModule::calibration,
     qnbot::DebugModule::retargeting, qnbot::DebugModule::output},
    qnbot::DebugDetail::summary,
    10,
};
config.debug = debug_config;

qnbot::Sdk sdk(std::move(config));

Application data directory

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

Set QNBOT_SDK_HOME before constructing the 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.

auto pose = device.pose();
auto latest_subscription = pose.with_config(
    qnbot::SubscriptionConfig::latest(30.0)).subscribe(on_pose);
auto fifo_subscription = pose.with_config(
    qnbot::SubscriptionConfig::fifo(128, 30.0)).subscribe(on_pose);
Field / accessorTypeDefault
is_fifo()boolfalse for latest
capacity()std::size_t0 for latest
max_rate_hz()std::optional<double>std::nullopt
  • 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, 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. Keep the returned C++ Subscription alive; one-shot coro::next is unchanged.

TargetAlgorithm

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

qnbot::TargetAlgorithm algorithm{
    "<package-id>",
    qnbot::BoneConfigUsage::auto_detect,
    std::string{"config/override.yaml"}};
FieldTypeDefault
idstd::stringRequired
use_bone_configBoneConfigUsageauto_detect
algorithm_config_pathstd::optional<std::string>std::nullopt
calibration_keystd::optional<std::string>std::nullopt
  • A supplied configuration path must be nonempty.
  • The selected algorithm package defines configuration file contents and errors.
Bone policyBehavior
BoneConfigUsage::auto_detectAdopt valid existing configuration; use algorithm defaults when absent
BoneConfigUsage::requiredFail when configuration is missing or invalid
BoneConfigUsage::disabledIgnore 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 disabled 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.