API referenceVetraGlove ProPython

Runtime and scheduling

Core interfaces

Current version · 2.0.0

The SDK root owns the lifecycle of all configured capabilities. Use glove() to access the Glove domain. Constructor parameters are in Configuration reference.

Sdk.glove()

Enters the glove functionality.

Type

Sdk.glove() -> Glove

Returns

Glove.

Details

  • Call conditions: SDK not closed.

Errors

  • ClosedHandleError, capability unavailable.

Sdk.start()

Start devices and capabilities in this object’s scope.

Type

Sdk.start() -> None

Returns

None.

Details

  • Call conditions: After preparing data reading and subscription.

Errors

  • Connection, identity, data stream or lifecycle errors.

See also

Sdk.update()

Perform one SDK scheduling pass and return its update result.

Type

Sdk.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

sdk is an SDK with its devices and targets already configured. Call sleep() once per update result, and do not start a background runner at the same time.

from qnbot_sdk import SleepResult
import time

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

Complete example: manual_runtime.py.

See also

Sdk.run_forever()

Advance SDK scheduling on the current thread until stopped.

Type

Sdk.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

sdk is an SDK with its devices and targets already configured. This call occupies the current thread. See the complete example for shutdown handling.

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

Complete example: foreground_runtime.py.

See also

Sdk.run_background()

Start background scheduling so the current thread can continue.

Type

Sdk.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

sdk is an SDK with its devices and targets already configured. The application thread remains available. Request shutdown, join the thread, and then close the scope.

import time

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

Complete example: background_runtime.py.

See also

Sdk.request_stop()

Request that the current run loop stop.

Type

Sdk.request_stop() -> None

Returns

None.

Errors

  • LifecycleError.

See also

Sdk.join()

Wait for the background thread and report background runtime errors.

Type

Sdk.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

Sdk.stop()

Stop the current scope and disconnect its devices.

Type

Sdk.stop() -> None

Returns

None.

Details

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

Errors

  • Errors during stopping.

See also

Sdk.close()

Close the current scope and release its resources.

Type

Sdk.close() -> None

Returns

None.

Errors

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

See also

Sdk.health()

Read the health summary for the current scope.

Type

Sdk.health() -> Health

Returns

Health.

Details

  • Call conditions: SDK not closed.

Errors

  • ClosedHandleError.