API referenceVetraGlove ProPython

Glove management

Core interfaces

Current version · 2.0.0

Returned by sdk.glove(), this object controls all configured gloves. Use device() to select one glove.

Glove.device()

Selects one device from the configured gloves.

Type

Glove.device(name: str | None = None, *, side: Side | None = None) -> GloveDevice

Parameters

  • name: str | None = None and side: Side | None = None; both may be supplied for same-name left/right devices

Returns

GloveDevice.

Details

  • Call conditions: After the SDK is created.

Errors

  • NotFoundSelectionError, AmbiguousSelectionError.

Example

The Glove scope has both left and right devices configured. Stopping the right device leaves the left one running.

from qnbot_sdk import Side

left = glove.device(side=Side.LEFT)
right = glove.device(side=Side.RIGHT)
left.start()
right.start()
right.stop()

Complete example: Multiple-device lifecycle example.

Glove.sync_time()

Sets one external absolute time reference for every Glove source.

Type

Glove.sync_time(reference_time_ms: float) -> None

Parameters

  • reference_time_ms: float, a finite Unix-millisecond value

Returns

None.

Details

  • Call conditions: Prefer before start(); may be called again while running to resynchronize.

Errors

  • InvalidArgumentError, ClosedHandleError, or native synchronization errors.

After synchronization, newly generated device status timestamps and their source_time, CaptureResult.created_at, and CalibrationResult.created_at use the synchronized time reference. Existing samples and saved results are unchanged. observed_at and runtime waits remain on the SDK monotonic clock.

Example

Keep glove open. This example uses the host Unix clock in milliseconds; replace it with your actual external time source.

import time

reference_time_ms = time.time_ns() / 1_000_000
glove.sync_time(reference_time_ms)

Complete example: Time-sync example.

Glove.start()

Start devices and capabilities in this object’s scope.

Type

Glove.start(mode: CalibrationMode | str | None = None) -> None

Parameters

  • mode: CalibrationMode | str | None, default None. Omission uses the automatic mode.
  • Accepts AUTO, MANUAL, NONE, or strings auto, manual, none.

Returns

None.

Details

  • Call conditions: After preparing data reading.

Errors

  • Connection, identity, data stream or lifecycle errors.

Example

Choose MANUAL mode when the application manages Capture and Calibration. Prepare channels and subscriptions before starting; the complete example shows the subsequent workflow.

from qnbot_sdk.glove import CalibrationMode

glove.start(CalibrationMode.MANUAL)

Related complete Capture workflow: host_capture_calibration.py.

See also

Glove.update()

Perform one SDK scheduling pass and return its update result.

Type

Glove.update() -> UpdateResult

Returns

UpdateResult.

Details

  • Call conditions: Started and no other run mode in use.
  • Call sleep() on each result only once; see Runtime for run modes and wait semantics.

Errors

  • LifecycleError.

Example

Obtain glove from sdk.glove() and prepare channels and subscriptions before starting. Call sleep() once per update result, and do not start a background runner at the same time.

from qnbot_sdk import SleepResult
import time

glove.start()
try:
    for _ in range(100):
        update = glove.update()
        if update.sleep() is SleepResult.NO_TASKS:
            time.sleep(0.01)
finally:
    glove.close()

Complete example: manual_runtime.py.

See also

Glove.run_forever()

Advance SDK scheduling on the current thread until stopped.

Type

Glove.run_forever() -> None

Returns

None.

Details

  • Call conditions: Started and no other run mode in use.
  • Blocks the current thread; do not mix with background execution or manual update().

Errors

  • LifecycleError.

Example

Obtain glove from sdk.glove() and prepare channels and subscriptions before starting. This call occupies the current thread. See the complete example for shutdown handling.

glove.start()
try:
    glove.run_forever()
finally:
    glove.close()

Complete example: foreground_runtime.py.

See also

Glove.run_background()

Start background scheduling so the current thread can continue.

Type

Glove.run_background() -> None

Returns

None.

Details

  • Call conditions: Started and no other run mode in use.
  • Mutually exclusive with run_forever() and manual update(). Request stop and call join() to finish.

Errors

  • LifecycleError, background running errors.

Example

Obtain glove from sdk.glove() and prepare channels and subscriptions before starting. The application thread remains available. Request shutdown, join the thread, and then close the scope.

import time

glove.start()
glove.run_background()
try:
    time.sleep(1.0)
finally:
    glove.request_stop()
    glove.join()
    glove.close()

Complete example: background_runtime.py.

See also

Glove.request_stop()

Request that the current run loop stop.

Type

Glove.request_stop() -> None

Returns

None.

Errors

  • LifecycleError.

See also

Glove.join()

Wait for the background thread and report background runtime errors.

Type

Glove.join() -> None

Returns

None.

Details

  • Call request_stop() first. This method reports background errors; do not omit the wait.

Errors

  • LifecycleError, background errors.

See also

Glove.stop()

Stop the current scope and disconnect its devices.

Type

Glove.stop() -> None

Returns

None.

Details

  • The scope can be started again; stopping a device cancels active calibration.

Errors

  • Errors during stopping.

See also

Glove.close()

Close the current scope and release its resources.

Type

Glove.close() -> None

Returns

None.

Errors

  • Errors during closing; the object becomes invalid after closing.

See also

Glove.health()

Read the health summary for the current scope.

Type

Glove.health() -> Health

Returns

Health.

Details

  • Call conditions: Glove not closed.

Errors

  • ClosedHandleError.