SDKC++ SDK

Calibration

Calibration status and progress, and starting calibration manually.

Current version · 2.0.0

Calibration

Before manual calibration, start the target device in CalibrationMode::manual. Stopping, disconnecting, or closing the device cancels active calibration; the session and unfinished tasks report Cancelled with code "cancelled".

Calibration uses a completed capture.

When a new capture replaces the previous Capture for the same wearer and glove, the SDK invalidates calibrations derived from the old capture content; the next start of that source follows the current calibration policy again. If the Capture file is only temporarily unreadable during SDK construction, construction reports the I/O error but preserves the existing calibration record instead of treating the read failure as stale content. Restore file access and reconstruct Sdk to retry.

Complete reuse of unchanged Capture data keeps existing compatible calibration valid. Cancelling an unfinished calibration session discards this attempt’s new results, preserves the previous successful compatible results and completed capture data, and must not be used to retain partial results. Stopping after calibration has completed does not revoke the successful results.

Optional configuration: to adjust fingertip offsets or load personal bone profiles, see Hand model parameter configuration.

When a new capture fully reuses the current compatible data without changing it, the SDK preserves matching calibration. Capturing replacement data invalidates calibration derived from the replaced data.

Calibration readiness

calibration_status(name?) is a synchronous, read-only snapshot with three call forms:

// The device has a single target: omit the name
const auto readiness = device.calibration_status();

// Multiple targets: name the one you want
const auto named = device.calibration_status("dexhand");

// Skeleton: use qnbot::TargetName::skeleton
const auto skeleton = device.calibration_status(qnbot::TargetName::skeleton);

Omitting the name requires the current device to have exactly one matching target; when the configuration already determines the device and target uniquely, the query can be made before start(), because the device catalog and identity constraints have already been resolved by the time SDK creation succeeds.

The returned CalibrationReadiness has two fields: state and operator_id. state has three values:

stateMeaning
not_requiredThe target does not require calibration
readyAll required calibration steps have compatible and valid records for the current wearer
needs_calibrationAt least one required calibration step is missing, invalid, or incompatible, or is excluded by this instance's force policy

operator_id is the wearer used for this determination; it always comes from the SDK's config.algorithms.capture.operator_id, and the caller does not pass an identifier in addition.

For the complete fields, types, and nullability, see CalibrationReadiness.

The value belongs to the current Sdk instance: to reload saved calibration data, recreate the Sdk.

Calibration progress and results

CalibrationProgress.job reports only the pending, running, completed, failed, or cancelled state of the corresponding target job. For the complete fields, see Calibration models.

CalibrationSession always uses the capture from the completed CaptureSession and computes and saves results in the order of targets. After saving succeeds, the SDK makes the results take effect for the selected targets; the application does not need to call any additional interface. A calibration failure does not delete the saved capture. For the session snapshot and result fields, see CalibrationSessionSnapshot and CalibrationResult.

Results after stopping calibration

A cancelled calibration discards that session's new results.

When request_stop(), device stop, disconnect, or close interrupts calibration, terminal Cancelled means all new results from that session have been discarded and the preceding compatible successful calibration remains available. If no compatible result existed, the next start still requires calibration. Completed capture data remains available for another compatible calibration attempt.

Stopping after normal session completion preserves its successful results. Accepted explicit session cancellation follows the same discard behavior; cancellation can be rejected once activation of the complete result batch starts, so read the actual terminal state. Display Cancelled as “calibration interrupted” and treat only Completed as success for this attempt. See the migration guide for upgrade actions.

Starting calibration manually

When the application needs to decide when calibration starts, call start_calibration() on the same GloveDevice used for capture and pass in the completed CaptureSession, which is still kept open. For the full capture-to-calibration session flow, see Starting capture manually.

Start an ordered calibration Session for the targets of a completed capture:

auto calibration = device.start_calibration(
    left_session, {std::string("target-output")});
while (true) {
    const auto snapshot = calibration.snapshot();
    render_calibration_session(snapshot);
    if (snapshot.state == qnbot::CalibrationSessionState::completed) break;
    const auto failed = std::find_if(
        snapshot.jobs.begin(), snapshot.jobs.end(),
        [](const auto& job) {
            return job.state == qnbot::CalibrationJobState::failed;
        });
    if (failed != snapshot.jobs.end() ||
        snapshot.state == qnbot::CalibrationSessionState::cancelled)
        throw std::runtime_error("calibration stopped");
    static_cast<void>(glove.update().sleep());
}
auto results = calibration.result();
if (!results)
    throw std::runtime_error("completed calibration has no result");
calibration.close();
left_session.close();

The same manual calibration can pass multiple targets to targets, and the SDK computes and saves them in the order given. For how to configure one source to drive multiple targets and read the output, see One-to-many.

When selecting Skeleton, use the string "skeleton" in targets. If the application also needs to read Skeleton output, it should call device.skeleton() on the corresponding device after SDK creation and before start().

The snippets show the main flow; the application supplies render_*. Set a timeout and close Sessions on cancellation or failure. The linked runnable example in Starting capture manually includes interaction, timeouts, and resource cleanup.

Complete calibration-file export and replay

After a target successfully produces output, Glove/Core supports device.export_calibration(destination, target) to export its active algorithm configuration, bone configuration and calibration result as a complete .qnbotkey file. Choose a new destination. Specify target when multiple targets exist. Export reports unavailable when the current route has no valid calibration.

Before creating another application's SDK, set TargetAlgorithm.calibration_key to the file and match its target and hand side. Omitting it retains the default capture/calibration workflow. See Configuration reference for configuration and GloveDevice for the export return value.