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.
#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")
)
);
std::cout << installed.path << std::endl;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. Obtain its installation result with std::get<BoneConfigInstallResult>. For an application-owned interface, pass CaptureInteractionMode::external, obtain the session with std::get<BoneConfigSession>, and use its information, poll(), and install() to complete the workflow.
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 qnbot::BoneConfigOverwritePolicy::deny as the third creation argument in terminal mode or at install() for external interaction.
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.
#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';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 qnbot::BoneConfigOverwritePolicy::replace_existing as the fourth argument.
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=BoneConfigUsage::auto_detect loads a profile when present and otherwise uses the default model. Use BoneConfigUsage::required to require a personal profile or BoneConfigUsage::disabled 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 config with devices filled in as shown in 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:
#include <qnbot/glove.hpp>
#include <filesystem>
// Match the wearer identifier in the bone profile directory.
config.algorithms.capture.operator_id = "operator-01";
qnbot::TargetConfig skeleton_target;
skeleton_target.source = qnbot::DeviceSelector{
"glove", "primary", qnbot::Side::right,
};
skeleton_target.algorithms = {qnbot::TargetAlgorithm{
qnbot::BuiltinAlgorithm::skeleton,
// Bone profile: required requires it; auto_detect uses it if present; disabled ignores it.
qnbot::BoneConfigUsage::required,
// Parameter override file; omit if not needed.
std::filesystem::absolute("algo_config.yaml").string(),
}};
config.targets.push_back(skeleton_target);
qnbot::Sdk sdk(config);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:
#include <qnbot/glove.hpp>
#include <filesystem>
// Match the wearer identifier in the bone profile directory.
config.algorithms.capture.operator_id = "operator-01";
qnbot::TargetConfig hand_target;
hand_target.name = "configured_hand";
hand_target.source = qnbot::DeviceSelector{
"glove", "primary", qnbot::Side::right,
};
hand_target.algorithms = {qnbot::TargetAlgorithm{
"<package-id>",
// Bone profile: required requires it; auto_detect uses it if present; disabled ignores it.
qnbot::BoneConfigUsage::required,
// Parameter override file; omit if not needed.
std::filesystem::absolute("algo_config.yaml").string(),
}};
config.targets.push_back(hand_target);
qnbot::Sdk sdk(config);Read robot-hand joint output through device.output("configured_hand"). See the complete example algorithm_configuration.cpp.
After changing parameter or profile files, close and recreate Sdk, then check calibration readiness to determine whether recalibration is needed.