hand-tracking-sdk 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ # Python cache/artifacts
2
+ __pycache__/
3
+ *.py[oc]
4
+ *.pyd
5
+ .pytest_cache/
6
+ .mypy_cache/
7
+ .ruff_cache/
8
+
9
+ # Build artifacts
10
+ build/
11
+ dist/
12
+ *.egg-info/
13
+
14
+ # Virtual environments
15
+ .venv/
16
+
17
+ # IDE/system
18
+ .DS_Store
19
+ .vscode/
20
+ .idea/
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,129 @@
1
+ # AGENTS.md - Hand Tracking SDK
2
+
3
+ This file defines how coding agents should work in `hand-tracking-sdk/`.
4
+
5
+ ## Scope
6
+ - Primary working directory: `hand-tracking-sdk/`
7
+ - Goal: build a professional, production-ready Python SDK for Hand Tracking Streamer (HTS), distributed on PyPI.
8
+ - Source protocol reference: `../hand-tracking-streamer/CONNECTIONS.md`
9
+ - Product context: `../hand-tracking-streamer/README.md`
10
+
11
+ ## Environment and Tooling (Required)
12
+ - Package and environment manager: `uv`
13
+ - Local virtual environment path: `hand-tracking-sdk/.venv`
14
+ - Prefer `uv` commands over raw `pip`/`python` invocations.
15
+ - Standard workflow:
16
+ - `uv sync`
17
+ - `uv run pytest`
18
+ - `uv run ruff check .`
19
+ - `uv run mypy src`
20
+ - `uv build`
21
+
22
+ ## Non-negotiables
23
+ - Keep changes focused and minimal for each task.
24
+ - Preserve backward compatibility unless explicitly requested.
25
+ - Prefer typed public interfaces and strict validation.
26
+ - Add tests for behavior changes and bug fixes.
27
+ - Avoid speculative abstractions; implement only what current use cases need.
28
+ - Keep runtime dependencies minimal.
29
+ - Follow PEP 8 style and PEP 257 docstring conventions for public modules, classes, and functions.
30
+
31
+ ## PyPI/Release Quality Bar
32
+ - SDK must be installable as a normal package (src layout preferred).
33
+ - Public API surface should be explicit and stable.
34
+ - Maintain semantic versioning discipline.
35
+ - Ensure metadata quality in `pyproject.toml` (license, classifiers, URLs, Python versions).
36
+ - No release without passing lint, type-check, and tests.
37
+
38
+ ## HTS Data Contract (Current)
39
+ HTS emits UTF-8 CSV text lines with a leading label:
40
+ - `Right wrist:` / `Left wrist:` followed by 7 floats:
41
+ - `x, y, z, qx, qy, qz, qw`
42
+ - `Right landmarks:` / `Left landmarks:` followed by 63 floats:
43
+ - `21` joints x `3` coords in OpenXR-derived order documented in `CONNECTIONS.md`.
44
+
45
+ Joint count and order are part of the public parsing contract. Treat them as versioned behavior.
46
+
47
+ ## Coordinate Conventions
48
+ - Incoming HTS data uses Unity left-hand coordinate convention.
49
+ - Most Python robotics stacks assume right-hand coordinates.
50
+ - Make conversion behavior explicit via clear API flags/utilities.
51
+ - Never apply implicit frame conversion without documentation.
52
+
53
+ ## Architecture Guidance
54
+ Preferred module boundaries:
55
+ - `transport/`: UDP/TCP ingestion primitives
56
+ - `parser/`: robust line parsing and schema mapping
57
+ - `models/`: typed data objects
58
+ - `convert/`: coordinate and frame conversion helpers
59
+ - `stream/` or `client/`: user-facing streaming API
60
+
61
+ Keep boundaries clean even when implementing minimal first versions.
62
+
63
+ ## Reliability and Parsing Rules
64
+ - Be tolerant to whitespace and trailing separators.
65
+ - Reject malformed lines with structured exceptions.
66
+ - Validate exact numeric lengths:
67
+ - wrist = 7
68
+ - landmarks = 63
69
+ - No silent truncation or padding.
70
+ - If partial updates are supported, define deterministic frame assembly policy.
71
+
72
+ ## Networking Expectations
73
+ Support HTS modes documented today:
74
+ - UDP (wireless)
75
+ - TCP wired (`adb reverse tcp:8000 tcp:8000`)
76
+ - TCP wireless
77
+
78
+ Keep defaults aligned with HTS docs unless explicitly overridden.
79
+
80
+ ## API Design Expectations
81
+ - Provide both low-level raw-line access and high-level parsed objects.
82
+ - Favor iterator/callback APIs instead of global mutable state.
83
+ - Include receive timestamps for downstream synchronization.
84
+ - Keep public objects serialization-friendly and deterministic to support downstream middleware bridges.
85
+
86
+ ## Docstring and Documentation Standard
87
+ - Use Sphinx-friendly docstrings (reStructuredText style) for public APIs.
88
+ - Public callables should document:
89
+ - purpose and behavioral contract
90
+ - parameter types/meaning/units
91
+ - return type/shape
92
+ - raised exceptions
93
+ - coordinate/frame conventions when relevant
94
+ - Keep docstrings precise and implementation-agnostic; avoid duplicating obvious code details.
95
+ - If API behavior changes, update docstrings in the same change set.
96
+
97
+ ## ROS2 Compatibility Considerations
98
+ - Do not add hard ROS2 runtime dependency in core SDK unless explicitly requested.
99
+ - Design core APIs so ROS2 adapters can be built cleanly on top:
100
+ - explicit timestamps and stable packet schemas
101
+ - explicit coordinate/frame conversion entry points
102
+ - side and packet type enums suitable for message mapping
103
+ - predictable streaming interfaces that can back publishers/subscribers
104
+ - Keep transport, parsing, and conversion layers decoupled so a future `ros2` integration package can wrap the SDK without forking core logic.
105
+
106
+ ## Testing Requirements
107
+ - Unit tests for:
108
+ - wrist parsing
109
+ - landmark parsing
110
+ - side/type routing
111
+ - malformed input handling
112
+ - coordinate conversion behavior
113
+ - Use realistic fixtures aligned with `CONNECTIONS.md`.
114
+ - Keep network tests deterministic (loopback or mocked sockets).
115
+
116
+ ## Documentation Expectations
117
+ - Keep `README.md` focused on SDK usage and behavior, not contributor workflow detail.
118
+ - Document protocol assumptions and version-specific behavior.
119
+ - Update docs whenever parsing contract or API changes.
120
+
121
+ ## Out of Scope (Unless Requested)
122
+ - Unity-side feature work
123
+ - Changing HTS upstream protocol
124
+ - Heavy framework integrations in core package (ROS, MuJoCo, etc.)
125
+
126
+ ## Working Style for Agents
127
+ - State assumptions briefly before major refactors.
128
+ - Implement end-to-end when possible: code + tests + docs.
129
+ - If requirements are unclear, propose concise options and continue with the safest default.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2025 Zhengyang Kris Weng
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,118 @@
1
+ # Milestones - Hand Tracking SDK
2
+
3
+ This document tracks delivery for a production-ready Python SDK for Hand Tracking Streamer (HTS).
4
+
5
+ ## Milestone 0 - Foundation (Done)
6
+ - Status: Completed
7
+ - Scope:
8
+ - project scaffold with `src/` layout
9
+ - packaging metadata in `pyproject.toml`
10
+ - typed core models and parser
11
+ - baseline tests + lint + type-check setup
12
+ - agent guidelines for `uv`, docstrings, and ROS2-aware design
13
+ - Exit criteria:
14
+ - package installs locally
15
+ - parser handles valid and malformed lines
16
+ - CI-equivalent local checks pass
17
+
18
+ ## Milestone 1 - Transport Ingestion
19
+ - Status: Completed
20
+ - Scope:
21
+ - UDP receiver
22
+ - TCP receiver/client paths for HTS wired/wireless usage
23
+ - deterministic timeout, reconnect, and graceful shutdown behavior
24
+ - configurable host/port/protocol settings
25
+ - Exit criteria:
26
+ - integration tests with loopback sockets
27
+ - documented behavior for disconnects/timeouts
28
+ - no parser regressions
29
+
30
+ ## Milestone 2 - Frame Assembly + Time Model
31
+ - Status: Completed
32
+ - Scope:
33
+ - assemble wrist + landmarks into coherent per-hand frames
34
+ - explicit policy for partial and out-of-order updates
35
+ - normalized timestamps (`recv_ts_ns` monotonic + optional wall clock)
36
+ - frame sequencing metadata
37
+ - Exit criteria:
38
+ - deterministic assembly tests
39
+ - API guarantees documented
40
+
41
+ ## Milestone 3 - Coordinate Conversion API
42
+ - Status: Completed
43
+ - Scope:
44
+ - explicit conversion utilities for Unity left-handed data
45
+ - configurable conversion profile for right-handed robotics stacks
46
+ - quaternion handling rules documented and tested
47
+ - Exit criteria:
48
+ - unit tests for axis/sign conventions
49
+ - examples demonstrating converted output
50
+
51
+ ## Milestone 4 - Public Streaming Client API
52
+ - Status: Completed
53
+ - Scope:
54
+ - high-level sync iterator client
55
+ - callback-based streaming option
56
+ - filtering controls (left/right/bimanual, packet/frame type)
57
+ - error policy controls (strict vs tolerant)
58
+ - Exit criteria:
59
+ - stable public API for first prerelease
60
+ - end-to-end tests with synthetic transport input
61
+
62
+ ## Milestone 5 - Observability + Error Model
63
+ - Status: Planned
64
+ - Scope:
65
+ - richer exception hierarchy
66
+ - counters/metrics (dropped packets, parse failures, reconnects)
67
+ - optional structured logging hooks
68
+ - Exit criteria:
69
+ - test coverage for error pathways
70
+ - clear operational troubleshooting docs
71
+
72
+ ## Milestone 6 - ROS2 Readiness (Core SDK, No Hard ROS Dependency)
73
+ - Status: Planned
74
+ - Scope:
75
+ - ROS-adapter-friendly frame dataclasses
76
+ - explicit frame identifiers and timestamp fields
77
+ - serialization helpers for predictable message mapping
78
+ - docs for mapping SDK types -> ROS messages
79
+ - Exit criteria:
80
+ - proof-of-mapping examples for `geometry_msgs`/`sensor_msgs` style payloads
81
+ - no ROS imports in core package
82
+
83
+ ## Milestone 7 - Docs and API Reference
84
+ - Status: Planned
85
+ - Scope:
86
+ - user-facing README quickstarts (UDP/TCP modes)
87
+ - Sphinx API reference generation from docstrings
88
+ - protocol assumptions + coordinate caveats
89
+ - Exit criteria:
90
+ - docs build successfully
91
+ - quickstart examples verified
92
+
93
+ ## Milestone 8 - Release Pipeline and PyPI Readiness
94
+ - Status: Planned
95
+ - Scope:
96
+ - CI pipeline for lint, type-check, tests, build
97
+ - release checklist and semantic version process
98
+ - TestPyPI publish + install verification
99
+ - production PyPI release process
100
+ - Exit criteria:
101
+ - tagged release candidate published to TestPyPI
102
+ - reproducible release process documented
103
+
104
+ ## Milestone 9 - First Stable Release (v1.0.0)
105
+ - Status: Planned
106
+ - Scope:
107
+ - API freeze for core parsing/streaming models
108
+ - migration notes (if needed)
109
+ - performance and reliability sign-off
110
+ - Exit criteria:
111
+ - compatibility statement published
112
+ - v1.0.0 released to PyPI
113
+
114
+ ## Backlog (Post-v1)
115
+ - optional async-native API
116
+ - optional NumPy acceleration paths
117
+ - separate `hand-tracking-sdk-ros2` adapter package
118
+ - recording/replay tooling for offline debugging and ML datasets
@@ -0,0 +1,127 @@
1
+ Metadata-Version: 2.4
2
+ Name: hand-tracking-sdk
3
+ Version: 0.1.0
4
+ Summary: Python SDK for Hand Tracking Streamer telemetry
5
+ Project-URL: Homepage, https://github.com/wengmister/hand-tracking-streamer
6
+ Project-URL: Documentation, https://github.com/wengmister/hand-tracking-streamer/blob/main/CONNECTIONS.md
7
+ Project-URL: Source, https://github.com/wengmister/hand-tracking-streamer
8
+ Project-URL: Issues, https://github.com/wengmister/hand-tracking-streamer/issues
9
+ Author: Hand Tracking SDK Contributors
10
+ License: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: hand-tracking,quest,robotics,sdk,teleoperation,vr
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering
20
+ Classifier: Topic :: Software Development :: Libraries
21
+ Requires-Python: >=3.12
22
+ Requires-Dist: lark>=1.3.1
23
+ Requires-Dist: pyyaml>=6.0.3
24
+ Description-Content-Type: text/markdown
25
+
26
+ # Hand Tracking SDK
27
+
28
+ Python SDK for consuming telemetry from [Hand Tracking Streamer (HTS)](https://github.com/wengmister/hand-tracking-streamer).
29
+
30
+ ## Overview
31
+
32
+ HTS streams UTF-8 CSV lines for wrist pose and hand landmarks.
33
+ This SDK provides typed parsing and validation for:
34
+ - wrist packets: 7 floats (`x, y, z, qx, qy, qz, qw`)
35
+ - landmark packets: 63 floats (`21 x [x, y, z]`)
36
+
37
+ Streamed joints are in Mediapipe-style 21 landmark points.
38
+
39
+ >[!IMPORTANT]
40
+ > Pre-release: This library is actively under development. Expect breaking changes to come.
41
+
42
+ ## Transport API
43
+
44
+ The SDK includes socket transport primitives for line-based ingestion:
45
+ - `UDPLineReceiver`
46
+ - `TCPServerLineReceiver`
47
+ - `TCPClientLineReceiver`
48
+
49
+ Network timeout and disconnect behavior is reported through typed exceptions:
50
+ - `TransportTimeoutError`
51
+ - `TransportDisconnectedError`
52
+ - `TransportClosedError`
53
+
54
+ ## Frame Assembly API
55
+
56
+ Use `HandFrameAssembler` to combine wrist and landmark packets into coherent per-hand frames.
57
+
58
+ - Emits a frame only after both components are present for a hand.
59
+ - Ignores stale out-of-order updates (older receive timestamps).
60
+ - Increments `sequence_id` per hand side on each newly emitted frame.
61
+ - Supports:
62
+ - `recv_ts_ns` (monotonic receive time)
63
+ - `recv_time_unix_ns` (optional wall-clock receive time)
64
+ - `source_ts_ns` (optional upstream timestamp; currently caller-provided)
65
+
66
+ ## Coordinate Conversion API
67
+
68
+ The SDK provides explicit Unity-left-handed to right-handed conversion helpers:
69
+ - `unity_left_to_right_position`
70
+ - `unity_left_to_right_quaternion`
71
+ - `convert_wrist_pose_unity_left_to_right`
72
+ - `convert_landmarks_unity_left_to_right`
73
+ - `convert_hand_frame_unity_left_to_right`
74
+
75
+ Current conversion profile:
76
+ - position: flip Y sign (`x, y, z -> x, -y, z`)
77
+ - orientation: basis transform equivalent to Y-axis reflection
78
+
79
+ ```python
80
+ from hand_tracking_sdk import (
81
+ HandFrameAssembler,
82
+ convert_hand_frame_unity_left_to_right,
83
+ )
84
+
85
+ assembler = HandFrameAssembler()
86
+ frame = assembler.push_line("Right wrist:, 0.1, 0.2, 0.3, 0.0, 0.0, 0.0, 1.0")
87
+ if frame is not None:
88
+ converted = convert_hand_frame_unity_left_to_right(frame)
89
+ ```
90
+
91
+ ## Streaming Client API
92
+
93
+ `HTSClient` provides a high-level sync stream with filtering and error policy controls.
94
+
95
+ Key controls:
96
+ - transport mode: `udp`, `tcp_server`, `tcp_client`
97
+ - output mode: `packets`, `frames`, `both`
98
+ - hand filter: `left`, `right`, `both`
99
+ - parse error policy: `strict` (raise) or `tolerant` (skip malformed lines)
100
+
101
+ ```python
102
+ from hand_tracking_sdk import HTSClient, HTSClientConfig, StreamOutput
103
+
104
+ client = HTSClient(HTSClientConfig(output=StreamOutput.FRAMES))
105
+ for event in client.iter_events():
106
+ print(event)
107
+ ```
108
+
109
+ ## Example
110
+
111
+ ```python
112
+ from hand_tracking_sdk import parse_line
113
+
114
+ packet = parse_line("Right wrist:, 0.1, 0.2, 0.3, 0.0, 0.0, 0.0, 1.0")
115
+ print(packet.side, packet.kind, packet.data)
116
+ ```
117
+
118
+ The parser validates packet label, side, and value count, and raises `ParseError` on malformed input.
119
+
120
+ ## Protocol Reference
121
+
122
+ - [`hand-tracking-streamer/README.md`](https://github.com/wengmister/hand-tracking-streamer/blob/main/README.md)
123
+ - [`hand-tracking-streamer/CONNECTIONS.md`](https://github.com/wengmister/hand-tracking-streamer/blob/main/CONNECTIONS.md)
124
+
125
+
126
+ ## License
127
+ Apache-2.0