hand_tracking_sdk¶
Parser Module¶
Parsing helpers for HTS UTF-8 CSV packets.
- hand_tracking_sdk.parser.parse_line(line)[source]¶
Parse one HTS CSV line into a typed packet object.
The input line must use one of the supported labels:
Left wrist:,Right wrist:,Left landmarks:, orRight landmarks:, orHead pose:.- Parameters:
line (str) – Raw UTF-8 decoded line from HTS transport.
- Returns:
A parsed packet instance for wrist or landmark data.
- Return type:
ParsedPacket
- Raises:
ParseError – If the line is empty, malformed, has unsupported labels, includes non-float values, or does not match expected value counts.
Transport Module¶
Socket transport primitives for ingesting HTS text lines.
- class hand_tracking_sdk.transport.UDPReceiverConfig(host='0.0.0.0', port=9000, timeout_s=1.0, max_datagram_size=65535, encoding='utf-8')[source]¶
Bases:
objectConfiguration for UDP line reception.
- Parameters:
host (str) – Local bind address.
port (int) – Local bind port. Use
0for OS-assigned ephemeral port.timeout_s (float) – Receive timeout in seconds.
max_datagram_size (int) – Maximum datagram size in bytes for
recvfrom.encoding (str) – Encoding used to decode bytes into text.
- host: str¶
- port: int¶
- timeout_s: float¶
- max_datagram_size: int¶
- encoding: str¶
- class hand_tracking_sdk.transport.TCPServerConfig(host='0.0.0.0', port=8000, accept_timeout_s=1.0, read_timeout_s=1.0, backlog=5, max_line_bytes=262144, encoding='utf-8')[source]¶
Bases:
objectConfiguration for TCP server line reception.
- Parameters:
host (str) – Local bind address for incoming HTS TCP connections.
port (int) – Local bind port.
accept_timeout_s (float) – Timeout for waiting on a new client connection.
read_timeout_s (float) – Timeout while waiting for bytes from connected clients.
backlog (int) – Listen backlog used in
socket.listen.max_line_bytes (int) – Upper bound for a buffered text line.
encoding (str) – Encoding used to decode bytes into text.
- host: str¶
- port: int¶
- accept_timeout_s: float¶
- read_timeout_s: float¶
- backlog: int¶
- max_line_bytes: int¶
- encoding: str¶
- class hand_tracking_sdk.transport.TCPClientConfig(host='127.0.0.1', port=8000, connect_timeout_s=5.0, read_timeout_s=1.0, reconnect_delay_s=0.25, max_line_bytes=262144, encoding='utf-8')[source]¶
Bases:
objectConfiguration for TCP client line reception.
- Parameters:
host (str) – Remote server address.
port (int) – Remote server port.
connect_timeout_s (float) – Timeout when establishing TCP connection.
read_timeout_s (float) – Timeout while waiting for bytes from the server.
reconnect_delay_s (float) – Delay between reconnect attempts in
TCPClientLineReceiver.iter_lines().max_line_bytes (int) – Upper bound for a buffered text line.
encoding (str) – Encoding used to decode bytes into text.
- host: str¶
- port: int¶
- connect_timeout_s: float¶
- read_timeout_s: float¶
- reconnect_delay_s: float¶
- max_line_bytes: int¶
- encoding: str¶
- class hand_tracking_sdk.transport.UDPLineReceiver(config=None)[source]¶
Bases:
objectReceive UTF-8 HTS lines over UDP datagrams.
- Parameters:
config (UDPReceiverConfig | None)
- property local_address: tuple[str, int]¶
Return currently bound local
(host, port).- Raises:
TransportClosedError – If the receiver is not open.
- open()[source]¶
Open and bind the UDP socket.
- Raises:
RuntimeError – If called while already open.
- Return type:
None
- recv_line()[source]¶
Receive the next decoded non-empty line from UDP datagrams.
- Returns:
Decoded line with surrounding whitespace removed.
- Raises:
TransportClosedError – If receiver socket is not open.
TransportTimeoutError – If no new datagram arrives before timeout and no queued lines remain.
- Return type:
str
- class hand_tracking_sdk.transport.TCPServerLineReceiver(config=None)[source]¶
Bases:
objectReceive UTF-8 HTS lines from one or more inbound TCP client connections.
- Parameters:
config (TCPServerConfig | None)
- property local_address: tuple[str, int]¶
Return currently bound local
(host, port).- Raises:
TransportClosedError – If the server socket is not open.
- open()[source]¶
Open and bind listening TCP socket.
- Raises:
RuntimeError – If called while already open.
- Return type:
None
- recv_line()[source]¶
Receive one newline-terminated line from any connected client.
If no client is connected, this method waits for at least one inbound connection before reading lines.
- Returns:
Decoded line with trailing newline removed.
- Raises:
TransportClosedError – If the server receiver is not open.
TransportTimeoutError – If waiting for connection or data times out.
TransportDisconnectedError – If all connected clients disconnect before a new line is received.
- Return type:
str
- class hand_tracking_sdk.transport.TCPClientLineReceiver(config)[source]¶
Bases:
objectReceive UTF-8 HTS lines from an outbound TCP client connection.
- Parameters:
config (TCPClientConfig)
- open()[source]¶
Open TCP connection to configured host and port.
- Raises:
RuntimeError – If called while already open.
OSError – If the remote endpoint cannot be reached.
- Return type:
None
- recv_line()[source]¶
Receive one newline-terminated line from TCP stream.
- Returns:
Decoded line with trailing newline removed.
- Raises:
TransportClosedError – If socket is not open.
TransportTimeoutError – If waiting for data times out.
TransportDisconnectedError – If remote endpoint disconnects.
- Return type:
str
Frame Module¶
Frame assembly utilities for combining wrist and landmark packets.
- class hand_tracking_sdk.frame.HandFrame(side, frame_id, wrist, landmarks, sequence_id, recv_ts_ns, recv_time_unix_ns, source_ts_ns, wrist_recv_ts_ns, landmarks_recv_ts_ns, source_frame_seq=None)[source]¶
Bases:
objectCoherent per-hand frame assembled from wrist and landmark packets.
- Parameters:
side (HandSide) – Hand side for this frame.
frame_id (str) – Frame identifier for downstream middleware mapping (for example ROS2).
wrist (WristPose) – Wrist pose payload.
landmarks (HandLandmarks) – Ordered set of 21 hand landmarks.
sequence_id (int) – Monotonic sequence number per hand side, incremented on each emitted frame.
recv_ts_ns (int) – Monotonic receive timestamp for the assembled frame.
recv_time_unix_ns (int | None) – Optional wall-clock timestamp in Unix nanoseconds.
source_ts_ns (int | None) – Optional source timestamp supplied by upstream sender.
source_frame_seq (int | None) – Optional upstream source frame sequence identifier.
wrist_recv_ts_ns (int) – Receive timestamp of the wrist payload included in this frame.
landmarks_recv_ts_ns (int) – Receive timestamp of the landmark payload included in this frame.
- frame_id: str¶
- landmarks: HandLandmarks¶
- sequence_id: int¶
- recv_ts_ns: int¶
- recv_time_unix_ns: int | None¶
- source_ts_ns: int | None¶
- wrist_recv_ts_ns: int¶
- landmarks_recv_ts_ns: int¶
- source_frame_seq: int | None¶
- get_joint(joint)[source]¶
Return one landmark point by joint name.
- Parameters:
joint (JointName | str) – Joint to query, either as
JointNameor canonical joint string.- Returns:
Joint
(x, y, z)tuple.- Raises:
ValueError – If the joint name is unknown.
- Return type:
tuple[float, float, float]
- get_finger(finger)[source]¶
Return all landmark points for one finger group.
- Parameters:
finger (FingerName | str) – Finger group to query.
- Returns:
Dictionary mapping
JointNameto(x, y, z)points for the selected finger group.- Raises:
ValueError – If the finger group is unknown.
- Return type:
dict[JointName, tuple[float, float, float]]
- class hand_tracking_sdk.frame.HeadFrame(side, frame_id, head, sequence_id, recv_ts_ns, recv_time_unix_ns, source_ts_ns, source_frame_seq=None)[source]¶
Bases:
objectFrame-like head pose event with normalized metadata fields.
- Parameters:
side (HandSide) – Always
HandSide.HEAD.frame_id (str) – Frame identifier for downstream middleware mapping.
head (HeadPose) – Head pose payload.
sequence_id (int) – Monotonic sequence number for head frames.
recv_ts_ns (int) – Monotonic receive timestamp for the emitted frame.
recv_time_unix_ns (int | None) – Optional wall-clock timestamp in Unix nanoseconds.
source_ts_ns (int | None) – Optional source timestamp supplied by upstream sender.
source_frame_seq (int | None) – Optional upstream source frame sequence identifier.
- frame_id: str¶
- sequence_id: int¶
- recv_ts_ns: int¶
- recv_time_unix_ns: int | None¶
- source_ts_ns: int | None¶
- source_frame_seq: int | None¶
- hand_tracking_sdk.frame.AssembledFrame = hand_tracking_sdk.frame.HandFrame | hand_tracking_sdk.frame.HeadFrame¶
Frame event emitted by
HandFrameAssembler.
- class hand_tracking_sdk.frame.HandFrameAssembler(*, include_wall_time=True, include_head_frames=False, frame_id_by_side=None)[source]¶
Bases:
objectAssemble coherent frames from incoming parsed HTS packets.
Emission policy: - A frame is emitted only after both wrist and landmarks are available for a hand side. - A new frame is emitted when at least one component timestamp advances. - Stale component updates (older timestamps than currently stored) are ignored.
- Parameters:
include_wall_time (bool)
include_head_frames (bool)
frame_id_by_side (Mapping[HandSide, str] | None)
- reset(side=None)[source]¶
Reset assembler state.
- Parameters:
side (HandSide | None) – Optional side to reset. If omitted, both sides are reset.
- Return type:
None
- push_packet(packet, *, recv_ts_ns=None, recv_time_unix_ns=None, source_ts_ns=None)[source]¶
Push one parsed packet and optionally emit a coherent frame.
- Parameters:
packet (WristPacket | LandmarksPacket | HeadPosePacket) – Parsed wrist or landmarks packet.
recv_ts_ns (int | None) – Monotonic receive timestamp in nanoseconds. If omitted, generated with
time.monotonic_ns().recv_time_unix_ns (int | None) – Optional Unix wall-clock timestamp in nanoseconds. If omitted and
include_wall_time=True, generated withtime.time_ns().source_ts_ns (int | None) – Optional source timestamp supplied by upstream sender.
- Returns:
A newly assembled frame or
Noneif frame is incomplete/unchanged.- Return type:
- push_line(line, *, recv_ts_ns=None, recv_time_unix_ns=None, source_ts_ns=None)[source]¶
Parse and push one raw HTS line into assembler state.
- Parameters:
line (str) – Raw UTF-8 decoded HTS CSV line.
recv_ts_ns (int | None) – Monotonic receive timestamp in nanoseconds.
recv_time_unix_ns (int | None) – Optional Unix wall-clock timestamp in nanoseconds.
source_ts_ns (int | None) – Optional source timestamp supplied by upstream sender.
- Returns:
A newly assembled frame or
Noneif frame is incomplete/unchanged.- Return type:
Conversion Module¶
Coordinate conversion utilities for HTS telemetry.
- hand_tracking_sdk.convert.unity_left_to_right_position(x, y, z)[source]¶
Convert a Unity left-handed position into a right-handed position.
HTS documentation indicates flipping the Y axis for typical right-handed consumer stacks.
- Parameters:
x (float) – Position X in Unity left-handed coordinates.
y (float) – Position Y in Unity left-handed coordinates.
z (float) – Position Z in Unity left-handed coordinates.
- Returns:
Converted
(x, y, z)in right-handed coordinates.- Return type:
tuple[float, float, float]
- hand_tracking_sdk.convert.unity_right_to_flu_position(x, y, z)[source]¶
Convert Unity right-handed coordinates into FLU basis.
Unity right-handed coordinates use
x=right, y=up, z=forwardwhile common robotics FLU basis usesx=forward, y=left, z=up. This function applies the required axis remapping and sign flips. See GitHub issue #2 for more details.- Parameters:
x (float) – Position X in Unity right-handed coordinates.
y (float) – Position Y in Unity right-handed coordinates.
z (float) – Position Z in Unity right-handed coordinates.
- Returns:
Position converted into FLU basis.
- Return type:
tuple[float, float, float]
- hand_tracking_sdk.convert.unity_left_to_flu_position(x, y, z)[source]¶
Convert Unity left-handed coordinates directly into FLU basis.
This composes
unity_left_to_right_position()followed byunity_right_to_flu_position(), so Unity left-handed input is first converted to Unity right-handed coordinates, then to FLU.- Parameters:
x (float) – Position X in Unity left-handed coordinates.
y (float) – Position Y in Unity left-handed coordinates.
z (float) – Position Z in Unity left-handed coordinates.
- Returns:
Position converted into FLU basis.
- Return type:
tuple[float, float, float]
- hand_tracking_sdk.convert.unity_left_to_right_quaternion(qx, qy, qz, qw)[source]¶
Convert quaternion orientation from Unity left-handed to right-handed.
The conversion applies basis transform
R' = S * R * SwithS = diag(1, -1, 1).- Parameters:
qx (float) – Quaternion X in Unity left-handed basis.
qy (float) – Quaternion Y in Unity left-handed basis.
qz (float) – Quaternion Z in Unity left-handed basis.
qw (float) – Quaternion W in Unity left-handed basis.
- Returns:
Converted quaternion
(qx, qy, qz, qw)in right-handed basis.- Return type:
tuple[float, float, float, float]
- hand_tracking_sdk.convert.convert_wrist_pose_unity_left_to_right(pose)[source]¶
Convert one wrist pose from Unity left-handed to right-handed.
- hand_tracking_sdk.convert.convert_landmarks_unity_left_to_right(landmarks)[source]¶
Convert hand landmarks from Unity left-handed to right-handed.
- Parameters:
landmarks (HandLandmarks) – Landmark set to convert.
- Returns:
Converted landmark set preserving original point order.
- Return type:
- hand_tracking_sdk.convert.convert_hand_frame_unity_left_to_right(frame)[source]¶
Convert a full assembled hand frame from Unity left-handed to right-handed.
Metadata fields are preserved and only geometry fields are transformed.
- hand_tracking_sdk.convert.basis_transform_position(pos, basis)[source]¶
Apply a basis matrix to a position vector.
Computes
result = basis @ pos.- Parameters:
pos (tuple[float, float, float]) – Input position
(x, y, z).basis (tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]]) – 3×3 basis change matrix.
- Returns:
Transformed position.
- Return type:
tuple[float, float, float]
- hand_tracking_sdk.convert.basis_transform_rotation(qx, qy, qz, qw, basis)[source]¶
Transform a quaternion orientation via a basis change matrix.
Computes
R_new = basis @ R @ basis^Tand returns the result as a normalized quaternion(qx, qy, qz, qw).- Parameters:
qx (float) – Quaternion X component.
qy (float) – Quaternion Y component.
qz (float) – Quaternion Z component.
qw (float) – Quaternion W component.
basis (tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]]) – 3×3 basis change matrix.
- Returns:
Transformed quaternion
(qx, qy, qz, qw).- Return type:
tuple[float, float, float, float]
- hand_tracking_sdk.convert.basis_transform_rotation_matrix(qx, qy, qz, qw, basis)[source]¶
Transform a quaternion orientation via a basis change matrix.
Same operation as
basis_transform_rotation()but returns the result as a 3×3 rotation matrix instead of a quaternion.- Parameters:
qx (float) – Quaternion X component.
qy (float) – Quaternion Y component.
qz (float) – Quaternion Z component.
qw (float) – Quaternion W component.
basis (tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]]) – 3×3 basis change matrix.
- Returns:
Transformed 3×3 rotation matrix.
- Return type:
tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]]
- hand_tracking_sdk.convert.unity_left_to_rfu_position(x, y, z)[source]¶
Convert Unity left-handed coordinates into RFU basis.
- Parameters:
x (float)
y (float)
z (float)
- Return type:
tuple[float, float, float]
- hand_tracking_sdk.convert.unity_left_to_rfu_rotation(qx, qy, qz, qw)[source]¶
Convert Unity left-handed quaternion into RFU basis.
- Parameters:
qx (float)
qy (float)
qz (float)
qw (float)
- Return type:
tuple[float, float, float, float]
- hand_tracking_sdk.convert.unity_left_to_rfu_rotation_matrix(qx, qy, qz, qw)[source]¶
Convert Unity left-handed quaternion into RFU rotation matrix.
- Parameters:
qx (float)
qy (float)
qz (float)
qw (float)
- Return type:
tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]]
- hand_tracking_sdk.convert.unity_left_to_flu_rotation(qx, qy, qz, qw)[source]¶
Convert Unity left-handed quaternion into FLU basis.
- Parameters:
qx (float)
qy (float)
qz (float)
qw (float)
- Return type:
tuple[float, float, float, float]
- hand_tracking_sdk.convert.unity_left_to_flu_rotation_matrix(qx, qy, qz, qw)[source]¶
Convert Unity left-handed quaternion into FLU rotation matrix.
- Parameters:
qx (float)
qy (float)
qz (float)
qw (float)
- Return type:
tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]]
Client Module¶
High-level streaming client API for HTS telemetry.
- class hand_tracking_sdk.client.TransportMode(*values)[source]¶
Bases:
StrEnumTransport mode used by
HTSClient.- UDP = 'udp'¶
- TCP_SERVER = 'tcp_server'¶
- TCP_CLIENT = 'tcp_client'¶
- class hand_tracking_sdk.client.StreamOutput(*values)[source]¶
Bases:
StrEnumOutput type emitted by
HTSClient.iter_events().- PACKETS = 'packets'¶
- FRAMES = 'frames'¶
- BOTH = 'both'¶
- class hand_tracking_sdk.client.HandFilter(*values)[source]¶
Bases:
StrEnumHand-side filter applied before packet/frame emission.
- BOTH = 'both'¶
- LEFT = 'left'¶
- RIGHT = 'right'¶
- class hand_tracking_sdk.client.ErrorPolicy(*values)[source]¶
Bases:
StrEnumError policy applied to parse failures.
- STRICT = 'strict'¶
- TOLERANT = 'tolerant'¶
- class hand_tracking_sdk.client.LogEventKind(*values)[source]¶
Bases:
StrEnumStructured log event kinds emitted by
HTSClient.- RECEIVED_LINE = 'received_line'¶
- PARSE_ERROR = 'parse_error'¶
- FILTERED_PACKET = 'filtered_packet'¶
- EMITTED_PACKET = 'emitted_packet'¶
- EMITTED_FRAME = 'emitted_frame'¶
- CALLBACK_ERROR = 'callback_error'¶
- class hand_tracking_sdk.client.StreamLogEvent(kind, message, side=None, line=None, exception=None)[source]¶
Bases:
objectStructured client log event for observability hooks.
- Parameters:
kind (LogEventKind) – Event kind discriminator.
message (str) – Human-readable event message.
side (HandSide | None) – Optional hand side associated with the event.
line (str | None) – Optional raw input line associated with the event.
exception (Exception | None) – Optional exception associated with the event.
- kind: LogEventKind¶
- message: str¶
- line: str | None¶
- exception: Exception | None¶
- class hand_tracking_sdk.client.ClientStats(lines_received=0, parse_errors=0, dropped_lines=0, packets_filtered=0, packets_emitted=0, frames_emitted=0, callbacks_invoked=0, callback_errors=0)[source]¶
Bases:
objectObservable counters for
HTSClientruntime behavior.- Parameters:
lines_received (int)
parse_errors (int)
dropped_lines (int)
packets_filtered (int)
packets_emitted (int)
frames_emitted (int)
callbacks_invoked (int)
callback_errors (int)
- lines_received: int¶
- parse_errors: int¶
- dropped_lines: int¶
- packets_filtered: int¶
- packets_emitted: int¶
- frames_emitted: int¶
- callbacks_invoked: int¶
- callback_errors: int¶
- class hand_tracking_sdk.client.HTSClientConfig(transport_mode=TransportMode.UDP, host='0.0.0.0', port=9000, timeout_s=1.0, reconnect_delay_s=0.25, output=StreamOutput.FRAMES, hand_filter=HandFilter.BOTH, error_policy=ErrorPolicy.STRICT, include_wall_time=True, log_hook=None)[source]¶
Bases:
objectConfiguration for high-level HTS streaming client.
- Parameters:
transport_mode (TransportMode) – Network transport mode.
host (str) – Host address used for bind/connect according to transport mode.
port (int) – Port used for bind/connect according to transport mode.
timeout_s (float) – I/O timeout in seconds for receive operations. In
tcp_servermode, initial connection wait usesmax(timeout_s, 5.0)to avoid premature startup timeouts while waiting for a device to connect.reconnect_delay_s (float) – Delay used by TCP client reconnect loop.
output (StreamOutput) – Event output mode (packets, frames, or both).
hand_filter (HandFilter) – Hand-side filter for emitted events.
error_policy (ErrorPolicy) – Parse error handling strategy.
include_wall_time (bool) – Whether assembled frames include recv_time_unix_ns by default.
log_hook (Callable[[StreamLogEvent], None] | None) – Optional structured log callback invoked for client lifecycle events.
- transport_mode: TransportMode¶
- host: str¶
- port: int¶
- timeout_s: float¶
- reconnect_delay_s: float¶
- output: StreamOutput¶
- hand_filter: HandFilter¶
- error_policy: ErrorPolicy¶
- include_wall_time: bool¶
- log_hook: Callable[[StreamLogEvent], None] | None¶
- hand_tracking_sdk.client.StreamEvent = hand_tracking_sdk.models.WristPacket | hand_tracking_sdk.models.LandmarksPacket | hand_tracking_sdk.models.HeadPosePacket | hand_tracking_sdk.frame.HandFrame | hand_tracking_sdk.frame.HeadFrame¶
Public event type emitted by
HTSClientstreaming methods.
- class hand_tracking_sdk.client.HTSClient(config, *, receiver_factory=None)[source]¶
Bases:
objectHigh-level client for streaming parsed packets and assembled frames.
- Parameters:
config (HTSClientConfig)
receiver_factory (Callable[[HTSClientConfig], _LineReceiver] | None)
- iter_events()[source]¶
Iterate streaming events from configured transport.
- Returns:
Iterator yielding packet and/or frame events per configured output mode.
- Raises:
ParseError – When
error_policy=strictand an incoming line cannot be parsed.- Return type:
Iterator[WristPacket | LandmarksPacket | HeadPosePacket | HandFrame | HeadFrame]
- run(callback, *, max_events=None, wrap_callback_exceptions=False)[source]¶
Run stream loop and invoke callback for each emitted event.
- Parameters:
callback (Callable[[WristPacket | LandmarksPacket | HeadPosePacket | HandFrame | HeadFrame], None]) – Function called for each emitted stream event.
max_events (int | None) – Optional cap on processed events; useful for controlled execution.
wrap_callback_exceptions (bool) – If
True, callback exceptions are re-raised asClientCallbackError.
- Returns:
Number of callback invocations performed.
- Raises:
ParseError – When
error_policy=strictand parsing fails.ClientCallbackError – When callback raises and wrapping is enabled.
- Return type:
int
Models Module¶
Typed packet models for HTS telemetry.
- class hand_tracking_sdk.models.HandSide(*values)[source]¶
Bases:
StrEnumLogical side for a tracked hand.
- LEFT = 'Left'¶
- RIGHT = 'Right'¶
- HEAD = 'Head'¶
- class hand_tracking_sdk.models.PacketType(*values)[source]¶
Bases:
StrEnumPacket data category emitted by HTS.
- WRIST = 'wrist'¶
- LANDMARKS = 'landmarks'¶
- POSE = 'pose'¶
- class hand_tracking_sdk.models.JointName(*values)[source]¶
Bases:
StrEnumCanonical joint names matching HTS landmark order.
- WRIST = 'Wrist'¶
- THUMB_METACARPAL = 'ThumbMetacarpal'¶
- THUMB_PROXIMAL = 'ThumbProximal'¶
- THUMB_DISTAL = 'ThumbDistal'¶
- THUMB_TIP = 'ThumbTip'¶
- INDEX_PROXIMAL = 'IndexProximal'¶
- INDEX_INTERMEDIATE = 'IndexIntermediate'¶
- INDEX_DISTAL = 'IndexDistal'¶
- INDEX_TIP = 'IndexTip'¶
- MIDDLE_PROXIMAL = 'MiddleProximal'¶
- MIDDLE_INTERMEDIATE = 'MiddleIntermediate'¶
- MIDDLE_DISTAL = 'MiddleDistal'¶
- MIDDLE_TIP = 'MiddleTip'¶
- RING_PROXIMAL = 'RingProximal'¶
- RING_INTERMEDIATE = 'RingIntermediate'¶
- RING_DISTAL = 'RingDistal'¶
- RING_TIP = 'RingTip'¶
- LITTLE_PROXIMAL = 'LittleProximal'¶
- LITTLE_INTERMEDIATE = 'LittleIntermediate'¶
- LITTLE_DISTAL = 'LittleDistal'¶
- LITTLE_TIP = 'LittleTip'¶
- class hand_tracking_sdk.models.FingerName(*values)[source]¶
Bases:
StrEnumSupported finger groups for convenience accessors.
- WRIST = 'wrist'¶
- THUMB = 'thumb'¶
- INDEX = 'index'¶
- MIDDLE = 'middle'¶
- RING = 'ring'¶
- LITTLE = 'little'¶
- class hand_tracking_sdk.models.PacketDebugInfo(source_frame_seq=None, source_ts_ns=None)[source]¶
Bases:
objectOptional source-side metadata attached to one streamed packet.
- Parameters:
source_frame_seq (int | None)
source_ts_ns (int | None)
- source_frame_seq: int | None¶
- source_ts_ns: int | None¶
- class hand_tracking_sdk.models.WristPose(x, y, z, qx, qy, qz, qw)[source]¶
Bases:
objectCartesian wrist position and orientation quaternion.
- Parameters:
x (float)
y (float)
z (float)
qx (float)
qy (float)
qz (float)
qw (float)
- x: float¶
- y: float¶
- z: float¶
- qx: float¶
- qy: float¶
- qz: float¶
- qw: float¶
- class hand_tracking_sdk.models.HeadPose(x, y, z, qx, qy, qz, qw)[source]¶
Bases:
objectCartesian head position and orientation quaternion.
- Parameters:
x (float)
y (float)
z (float)
qx (float)
qy (float)
qz (float)
qw (float)
- x: float¶
- y: float¶
- z: float¶
- qx: float¶
- qy: float¶
- qz: float¶
- qw: float¶
- class hand_tracking_sdk.models.HandLandmarks(points)[source]¶
Bases:
objectOrdered set of 21 hand landmarks as
(x, y, z)points.- Parameters:
points (tuple[tuple[float, float, float], ...])
- points: tuple[tuple[float, float, float], ...]¶
- get_finger(finger)[source]¶
Return all joint points for one finger group.
- Parameters:
finger (FingerName | str) – Finger group to query. Accepts
FingerNameor one ofwrist,thumb,index,middle,ring,little.- Returns:
Dictionary mapping
JointNameto(x, y, z)points for the selected finger group.- Raises:
ValueError – If the finger group is unknown.
- Return type:
dict[JointName, tuple[float, float, float]]
- to_dict()[source]¶
Serialize landmarks into a mapping-friendly dictionary.
- Returns:
Dictionary with ordered
pointslist.- Return type:
dict[str, list[list[float]]]
- classmethod from_dict(values)[source]¶
Build
HandLandmarksfrom serialized mapping data.- Parameters:
values (Mapping[str, Any]) – Mapping containing
pointsas nested coordinate lists.- Returns:
Parsed landmarks instance preserving point order.
- Return type:
- class hand_tracking_sdk.models.WristPacket(side, kind, data, debug=None)[source]¶
Bases:
objectParsed wrist packet for one hand side.
- Parameters:
side (HandSide)
kind (PacketType)
data (WristPose)
debug (PacketDebugInfo | None)
- kind: PacketType¶
- debug: PacketDebugInfo | None¶
- class hand_tracking_sdk.models.LandmarksPacket(side, kind, data, debug=None)[source]¶
Bases:
objectParsed landmark packet for one hand side.
- Parameters:
side (HandSide)
kind (PacketType)
data (HandLandmarks)
debug (PacketDebugInfo | None)
- kind: PacketType¶
- data: HandLandmarks¶
- debug: PacketDebugInfo | None¶
- class hand_tracking_sdk.models.HeadPosePacket(side, kind, data, debug=None)[source]¶
Bases:
objectParsed head pose packet.
- Parameters:
side (HandSide)
kind (PacketType)
data (HeadPose)
debug (PacketDebugInfo | None)
- kind: PacketType¶
- debug: PacketDebugInfo | None¶
Exceptions Module¶
Custom exception hierarchy for SDK parsing and runtime errors.
- exception hand_tracking_sdk.exceptions.HTSError[source]¶
Bases:
ExceptionBase exception for SDK errors.
- exception hand_tracking_sdk.exceptions.ParseError[source]¶
Bases:
HTSErrorRaised when incoming HTS lines cannot be parsed.
- exception hand_tracking_sdk.exceptions.TransportError[source]¶
Bases:
HTSErrorBase exception for transport-level errors.
- exception hand_tracking_sdk.exceptions.TransportClosedError[source]¶
Bases:
TransportErrorRaised when operating on a transport receiver that is not open.
- exception hand_tracking_sdk.exceptions.TransportTimeoutError[source]¶
Bases:
TransportErrorRaised when waiting for network I/O exceeds configured timeout.
- exception hand_tracking_sdk.exceptions.TransportDisconnectedError[source]¶
Bases:
TransportErrorRaised when a connected TCP peer disconnects.
- exception hand_tracking_sdk.exceptions.ClientError[source]¶
Bases:
HTSErrorBase exception for high-level client errors.
- exception hand_tracking_sdk.exceptions.ClientConfigurationError[source]¶
Bases:
ClientErrorRaised when high-level client configuration is invalid.
- exception hand_tracking_sdk.exceptions.ClientCallbackError[source]¶
Bases:
ClientErrorRaised when a user callback invoked by the client fails.
- exception hand_tracking_sdk.exceptions.VisualizationError[source]¶
Bases:
HTSErrorBase exception for visualization-layer errors.
- exception hand_tracking_sdk.exceptions.VisualizationDependencyError[source]¶
Bases:
VisualizationErrorRaised when an optional visualization dependency is not installed.
Visualization Module¶
Optional real-time visualization helpers.
- class hand_tracking_sdk.visualization.VisualizationFrame(*values)[source]¶
Bases:
StrEnumOutput frame convention used for visualization points.
- SDK = 'sdk'¶
- FLU = 'flu'¶
- class hand_tracking_sdk.visualization.RerunVisualizerConfig(application_id='hand-tracking-sdk', spawn=True, landmarks_are_wrist_relative=True, wrist_radius=0.025, landmark_radius=0.015, wrist_color=(255, 220, 0), left_landmark_color=(64, 128, 255), right_landmark_color=(255, 64, 64), convert_to_right_handed=True, background_color=(18, 22, 30), visualization_frame=VisualizationFrame.FLU, show_jitter_panel=False, jitter_window_size=200, show_coordinate_frames=False, coordinate_frame_axis_length=0.08)[source]¶
Bases:
objectConfiguration for
RerunVisualizer.- Parameters:
application_id (str) – Application identifier displayed in Rerun.
spawn (bool) – If
True, spawn a local Rerun viewer on initialization.landmarks_are_wrist_relative (bool) – If
True, landmark points are interpreted as wrist-local coordinates and transformed into world frame before logging.wrist_radius (float) – Point radius for wrist markers in meters.
landmark_radius (float) – Point radius for landmark markers in meters.
wrist_color (tuple[int, int, int]) – RGB color for wrist markers.
left_landmark_color (tuple[int, int, int]) – RGB color for left-hand landmark markers.
right_landmark_color (tuple[int, int, int]) – RGB color for right-hand landmark markers.
convert_to_right_handed (bool) – If
True, incoming Unity left-handed data are converted to right-handed coordinates before visualization.background_color (tuple[int, int, int] | None) – Optional RGB background color for the Rerun 3D view.
visualization_frame (VisualizationFrame) – Point frame convention for visualization output.
flumeansx=forward, y=left, z=up.show_jitter_panel (bool) – If
True, log jitter/drop scalar metrics undermetrics/jitter/....jitter_window_size (int) – Rolling window size for jitter percentile metrics.
show_coordinate_frames (bool) – If
True, render local XYZ axes for wrist/head poses.coordinate_frame_axis_length (float) – Axis length in meters for rendered coordinate frames.
- application_id: str¶
- spawn: bool¶
- landmarks_are_wrist_relative: bool¶
- wrist_radius: float¶
- landmark_radius: float¶
- wrist_color: tuple[int, int, int]¶
- left_landmark_color: tuple[int, int, int]¶
- right_landmark_color: tuple[int, int, int]¶
- convert_to_right_handed: bool¶
- background_color: tuple[int, int, int] | None¶
- visualization_frame: VisualizationFrame¶
- show_jitter_panel: bool¶
- jitter_window_size: int¶
- show_coordinate_frames: bool¶
- coordinate_frame_axis_length: float¶
- class hand_tracking_sdk.visualization.RerunVisualizer(config=None)[source]¶
Bases:
objectVisualizer that logs hand telemetry to rerun.
This component is optional and requires installing the visualization extra.
- Parameters:
config (RerunVisualizerConfig | None)
- log_packet(packet)[source]¶
Log one parsed packet to Rerun.
- Parameters:
packet (WristPacket | LandmarksPacket | HeadPosePacket) – Parsed packet event from HTS stream.
- Return type:
None
- log_frame(frame)[source]¶
Log one assembled frame to Rerun.
- Parameters:
frame (HandFrame) – Assembled hand frame.
- Return type:
None
- log_event(event)[source]¶
Log either packet or frame event.
- Parameters:
event (WristPacket | LandmarksPacket | HeadPosePacket | HandFrame | HeadFrame) – Stream event from
hand_tracking_sdk.HTSClient.- Return type:
None