Hand model parameter configuration
Algorithm overrides, personal bone profiles, and local fingertip offsets in Glove SDK.
Hand model parameter configuration
Configuration
This configuration is optional—use it to adjust fingertip offsets or load personal bone profiles, and prepare the files before creating the Sdk instance. For standard usage, keep the default parameters.
Algorithm configuration files adjust model parameters such as local fingertip offsets, personal bone profiles provide the wearer’s bone dimensions, and CalibrationResult is computed from capture data; all three work together alongside capture and calibration.
Algorithm configuration file
Save algo_config.yaml somewhere the application can read and pass its absolute path through TargetAlgorithm.algorithm_config_path. Omit the field to use the algorithm defaults. See TargetAlgorithm for field types and constraints.
input_tip_offset_local in algo_config.yaml defines local fingertip offsets in metres, ordered [x, y, z]. first means the index finger. The example below comes from the built-in Skeleton’s right-hand resource.
tip_mapping:
right:
input_tip_offset_local:
thumb: [0.005, 0.000, -0.010]
first: [0.008, 0.000, -0.005]
middle: [0.008, 0.000, 0.000]
ring: [0.008, 0.000, -0.005]
little: [0.008, 0.000, -0.005]Use the selected algorithm package’s local coordinate convention. Configure tip_mapping.right and tip_mapping.left separately; do not assume changes are mirrored automatically. Fingertip offsets and personal bone lengths have different roles and are not interchangeable.
Fingertip offset illustration
Drag the 3D view to rotate, or move a slider to inspect the local offset from sensor to target.
Drag to rotate · Wheel / pinch to zoom · Focus and use arrow keys to rotate
tip_mapping:
right:
input_tip_offset_local:
thumb: [0.0050, 0.0000, -0.0100]
first: [0.0080, 0.0000, -0.0050]
middle: [0.0080, 0.0000, 0.0000]
ring: [0.0080, 0.0000, -0.0050]
little: [0.0080, 0.0000, -0.0050]
Personal bone profile file
See Bone configuration APIs for signatures, return values, and session control.
Use the SDK to receive and save a profile after phone-based photo measurement. Export saved profiles for backup, and restore historical single-hand profiles with the file-placement steps below. Bone measurement is separate from glove gesture capture and calibration; it requires no glove connection or Sdk instance.
Prepare by QR code
Prepare the A4 calibration board required by the webpage, then run this code. Scan the terminal QR code or open its link on a phone and complete photo measurement for the requested hand. The function waits for the result, saves the profile, and returns its path. Start a new session if it expires.
from qnbot_sdk import Side
from qnbot_sdk.glove import create_bone_config
installed = create_bone_config(
side=Side.RIGHT,
operator_id="operator-01",
)
print(installed.path)After saving, create Sdk as shown below with the same capture.operator_id="operator-01" and right-hand device side. The default CaptureInteractionMode.AUTO_TERMINAL completes terminal preparation and returns the installation result. For an application-owned interface, pass interaction=CaptureInteractionMode.EXTERNAL to obtain a session and use its information, poll(), and install() to complete measurement and saving. Import the enum from qnbot_sdk and run network operations on a worker thread.
When you repeat measurement for the same wearer and hand, create_bone_config() and an external session's install() replace the previous profile after a successful save by default. To protect an existing profile, pass overwrite=BoneConfigOverwritePolicy.DENY in terminal mode or at install() for external interaction. Import the enum from qnbot_sdk.glove.
Export a saved profile
Use export_bone_config() to back up the saved single-hand YAML for the selected wearer and side to a destination path. This operation works without constructing Sdk or connecting a glove.
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)path is the export destination, and the return value is its path string. A missing or invalid saved profile produces an error. Export rejects an existing destination by default. To replace one explicitly, pass overwrite=BoneConfigOverwritePolicy.REPLACE_EXISTING.
The installation result from create_bone_config() contains path and cleanup_confirmed. A false cleanup status means remote session cleanup was not confirmed, and the saved profile remains usable.
Storage and loading
Use the same wearer identifier, side, and application data directory for measurement, export, and loading. For operator_id="operator-01", the default right-hand file is stored below. The left-hand filename is left.yaml.
~/.qnbot/glove/bone-configs/operator-01/right.yamlSet QNBOT_SDK_HOME before measurement, export, or SDK creation to select a data root. QNBOT_HOME is the fallback, and the default root is the current user's ~/.qnbot. Under a custom root, the file is glove/bone-configs/<encoded-operator_id>/right.yaml or left.yaml.
ASCII letters, digits, -, and _ in operator_id are used directly in the directory name. Other characters are encoded as UTF-8 bytes in %XX form. For example, operator/01 uses the directory operator%2F01.
To restore a historical file or transfer one to another machine, follow these steps.
- Stop and close any existing
Sdkinstance. - Prepare UTF-8 single-hand configuration YAML with the required top-level
rightorleft, includingpalm_layoutandfingers. On the webpage, download “上位机配置 YAML” (desktop configuration YAML). “详细 YAML” (detailed measurement YAML) fails validation. - Place it under the matching data root and wearer directory, named
right.yamlorleft.yamlfor the physical hand. - Construct a new
Sdkwith the samecapture.operator_id, side, and data root.
The default use_bone_config="auto" loads a profile when present and otherwise uses the default model. Use True to require a personal profile or False to ignore it. See Personal bone profile loading for custom directories, validation, and all policy values.
Personal bone length comparison
Drag to rotate the skeleton; adjust sliders to see bone length and fingertip position changes.
Drag to rotate · Wheel / pinch to zoom · Arrow keys to rotate
left:
fingers:
thumb:
metacarpal: 0.031997
proximal: 0.029993
distal: 0.022627
first:
metacarpal: 0.065634
proximal: 0.035691
intermediate: 0.018263
distal: 0.013536
middle:
metacarpal: 0.064765
proximal: 0.039477
intermediate: 0.023184
distal: 0.016704
ring:
metacarpal: 0.060247
proximal: 0.037005
intermediate: 0.021263
distal: 0.015655
little:
metacarpal: 0.052747
proximal: 0.028710
intermediate: 0.016559
distal: 0.013984
palm_layout:
coordinate_frame: wrist_x_toward_index_y_toward_middle
landmarks_m:
first_mcp: [0.0226618, 0.0805334]
little_mcp: [-0.0290929, 0.0619007]
middle_mcp: [0, 0.0802097]
ring_mcp: [-0.0137521, 0.0734381]
thumb_cmc: [0.0347905, 0.0212377]
Apply the parameters
Choose one example for your output; do not run them sequentially. Reuse devices from Device discovery and connection. The examples select the right glove named primary. The examples require a valid personal bone profile; SDK creation fails without one.
For human-hand skeleton output
Load parameters into the built-in Skeleton algorithm:
from pathlib import Path
from qnbot_sdk import (
AlgorithmsConfig, BuiltinAlgorithm, CaptureConfig, DeviceSelector,
Sdk, Side, TargetAlgorithm, TargetConfig,
)
skeleton_target = TargetConfig(
source=DeviceSelector(type="glove", name="primary", side=Side.RIGHT),
algorithms=(TargetAlgorithm(
id=BuiltinAlgorithm.SKELETON,
# Parameter override file; omit if not needed.
algorithm_config_path=str(Path("algo_config.yaml").resolve()),
# Bone profile: True requires it; "auto" uses it if present; False ignores it.
use_bone_config=True,
),),
)
sdk = Sdk(
devices=devices,
algorithms=AlgorithmsConfig(
# Match the wearer identifier in the bone profile directory.
capture=CaptureConfig(operator_id="operator-01"),
),
targets=(skeleton_target,),
)Read human-hand skeleton data through device.skeleton(). See Skeleton for startup, reading, and cleanup.
For robot-hand mapping
Replace <package-id> with the installed algorithm package ID and use its supported parameter file:
from pathlib import Path
from qnbot_sdk import (
AlgorithmsConfig, CaptureConfig, DeviceSelector,
Sdk, Side, TargetAlgorithm, TargetConfig,
)
hand_target = TargetConfig(
name="configured_hand",
source=DeviceSelector(type="glove", name="primary", side=Side.RIGHT),
algorithms=(TargetAlgorithm(
id="<package-id>",
# Parameter override file; omit if not needed.
algorithm_config_path=str(Path("algo_config.yaml").resolve()),
# Bone profile: True requires it; "auto" uses it if present; False ignores it.
use_bone_config=True,
),),
)
sdk = Sdk(
devices=devices,
algorithms=AlgorithmsConfig(
# Match the wearer identifier in the bone profile directory.
capture=CaptureConfig(operator_id="operator-01"),
),
targets=(hand_target,),
)Read robot-hand joint output through device.output(name="configured_hand"). See the complete example algorithm_configuration.py.
After changing parameter or profile files, close and recreate Sdk, then check calibration readiness to determine whether recalibration is needed.