Skip to main content

Python SDK for Hand Tracking Streamer telemetry

Project description

sdk_logo

Python SDK for consuming telemetry from Hand Tracking Streamer (HTS)

Horizon Store Release Python SDK Apache 2.0 API Documentation

Hand Tracking SDK is a Python package for consuming HTS hand-tracking telemetry (UDP/TCP), parsing wrist/landmark data into typed frames, and providing conversion, visualization, and integration-ready APIs.

This SDK is hosted on PyPI, with API documentation Here

Installation

pip install hand-tracking-sdk

Optional visualization support with Rerun:

pip install "hand-tracking-sdk[visualization]"

Quickstart

from hand_tracking_sdk import HTSClient, HTSClientConfig, StreamOutput

client = HTSClient(
    HTSClientConfig(
        output=StreamOutput.BOTH,  # packets + assembled frames
    )
)

for event in client.iter_events():
    print(event)

What HTS Sends

HTS emits UTF-8 CSV lines:

  • wrist packet: 7 floats (x, y, z, qx, qy, qz, qw)
  • landmarks packet: 63 floats (21 x [x, y, z])

The SDK validates packet labels, hand side, and exact value counts.

Core APIs

  • Streaming client:
    • HTSClient, HTSClientConfig
    • output modes: packets, frames, both
    • transport modes: udp, tcp_server, tcp_client
  • Frame assembly:
    • HandFrameAssembler
    • emits a frame only when both wrist and landmarks are available
  • Coordinate conversion:
    • unity_left_to_right_position
    • unity_left_to_right_quaternion
    • convert_wrist_pose_unity_left_to_right
    • convert_landmarks_unity_left_to_right
    • convert_hand_frame_unity_left_to_right
  • Parsing:
    • parse_line

Observability

HTSClient exposes runtime counters and structured log hooks:

  • get_stats() / reset_stats()
  • ClientStats
  • log_hook via HTSClientConfig

ROS2-Friendly Data Model

The SDK is designed so ROS2 adapters can be layered cleanly without a hard ROS dependency:

  • explicit timestamps (recv_ts_ns, recv_time_unix_ns, source_ts_ns)
  • explicit frame_id and per-side sequencing
  • deterministic serialization helpers:
    • WristPose.to_dict() / from_dict()
    • HandLandmarks.to_dict() / from_dict()
    • HandFrame.to_dict() / from_dict()

Frame Structure

A HandFrame includes:

  • side: Left or Right
  • frame_id: frame name for downstream systems
  • wrist: WristPose(x, y, z, qx, qy, qz, qw)
  • landmarks.points: tuple of 21 (x, y, z) points
  • timing/sequence metadata (sequence_id, recv_ts_ns, recv_time_unix_ns, source_ts_ns)

To get telemetry for a specific joint from a frame, use get_joint(...). Joint names and order follow the HTS streamed contract (wrist is JointName.WRIST).

from hand_tracking_sdk import HTSClient, HTSClientConfig, JointName, StreamOutput

client = HTSClient(HTSClientConfig(output=StreamOutput.FRAMES))

for frame in client.iter_events():
    x, y, z = frame.get_joint(JointName.INDEX_TIP)
    print(
        f"side={frame.side.value} joint={JointName.INDEX_TIP.value} "
        f"xyz=({x:.5f}, {y:.5f}, {z:.5f}) recv_ts_ns={frame.recv_ts_ns}"
    )

You can also query by finger group:

index_points = frame.get_finger("index")
# returns dict[JointName, tuple[float, float, float]]
# keys include JointName.INDEX_PROXIMAL, JointName.INDEX_TIP, ...

Examples

  • Rerun visualization:
    • install extra: pip install "hand-tracking-sdk[visualization]"
    • uv run python examples/visualize_rerun.py --transport tcp_server --host 0.0.0.0 --port 8000
  • Frame-only stream:
    • uv run python examples/stream_frames.py --transport tcp_server --host 0.0.0.0 --port 8000
  • JSONL logging:
    • uv run python examples/log_to_jsonl.py --transport tcp_server --host 0.0.0.0 --port 8000 --output both --path runs/hand_tracking.jsonl

Protocol and Docs

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hand_tracking_sdk-1.0.1.tar.gz (494.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hand_tracking_sdk-1.0.1-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

Details for the file hand_tracking_sdk-1.0.1.tar.gz.

File metadata

  • Download URL: hand_tracking_sdk-1.0.1.tar.gz
  • Upload date:
  • Size: 494.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hand_tracking_sdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 933c0668aa02800a899adc731eece613641f74f77d4b55d68c118142be288796
MD5 cdd2e0f6b5f27507cf705125c9eec6eb
BLAKE2b-256 6e5e85ecfb74e41c3cfe57a13f80a8cdb5a72c5eff33b1409511ad51764c931c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hand_tracking_sdk-1.0.1.tar.gz:

Publisher: release.yml on wengmister/hand-tracking-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hand_tracking_sdk-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hand_tracking_sdk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dde067baa2b50a6a4f5c598681e2c1c991f16e16af93ef3baaa1c8fe84436380
MD5 59b25876248d48beb6f744f7cfd46694
BLAKE2b-256 b8cb79929a22abd90ab180a21a1edd6eb4fd966e0d0f3e6243c367502f8c3519

See more details on using hashes here.

Provenance

The following attestation bundles were made for hand_tracking_sdk-1.0.1-py3-none-any.whl:

Publisher: release.yml on wengmister/hand-tracking-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page