{"id":19503900,"url":"https://github.com/timschneider42/python-natnet-client","last_synced_at":"2025-04-26T00:33:19.904Z","repository":{"id":77928346,"uuid":"434264515","full_name":"TimSchneider42/python-natnet-client","owner":"TimSchneider42","description":"Python client for Optitrack NatNet streams.","archived":false,"fork":false,"pushed_at":"2024-03-08T09:46:23.000Z","size":38,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T05:41:54.025Z","etag":null,"topics":["natnet","natnet-sdk","optitrack","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TimSchneider42.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-02T15:00:04.000Z","updated_at":"2025-04-03T01:27:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"739695dd-f6e0-4968-ac28-a2da9422a5a1","html_url":"https://github.com/TimSchneider42/python-natnet-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimSchneider42%2Fpython-natnet-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimSchneider42%2Fpython-natnet-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimSchneider42%2Fpython-natnet-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimSchneider42%2Fpython-natnet-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimSchneider42","download_url":"https://codeload.github.com/TimSchneider42/python-natnet-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250917285,"owners_count":21507561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["natnet","natnet-sdk","optitrack","python"],"created_at":"2024-11-10T22:23:28.589Z","updated_at":"2025-04-26T00:33:19.671Z","avatar_url":"https://github.com/TimSchneider42.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python NatNet Client\n\nPython client for Optitrack NatNet streams.\n\n## Installation\n\nInstall this package via pip:\n\n```bash\npip install git+https://github.com/TimSchneider42/python-natnet-client\n```\n\n## Usage\n\nThe following example highlights the basic usage of this package:\n\n```python\nimport time\n\nfrom natnet_client import DataDescriptions, DataFrame, NatNetClient\n\n\ndef receive_new_frame(data_frame: DataFrame):\n    global num_frames\n    num_frames += 1\n\n\ndef receive_new_desc(desc: DataDescriptions):\n    print(\"Received data descriptions.\")\n\n\nnum_frames = 0\nif __name__ == \"__main__\":\n    streaming_client = NatNetClient(server_ip_address=\"127.0.0.1\", local_ip_address=\"127.0.0.1\", use_multicast=False)\n    streaming_client.on_data_description_received_event.handlers.append(receive_new_desc)\n    streaming_client.on_data_frame_received_event.handlers.append(receive_new_frame)\n\n    with streaming_client:\n        streaming_client.request_modeldef()\n\n        for i in range(10):\n            time.sleep(1)\n            streaming_client.update_sync()\n            print(f\"Received {num_frames} frames in {i + 1}s\")\n```\n\nIn this example, we first instantiate `NatNetClient` with the connection parameters and attach one callback function to\neach of its events. The `streaming_client.on_data_description_received_event` event is triggered whenever a new data\ndescription packet arrives, while the `streaming_client.on_data_frame_received_event` event is triggered on each\nincoming data frame. For the configuration of the NatNet server, please refer to the official documentation.\n\nYou can process data synchronously, as in this example, by calling `streaming_client.update_sync()` in your run loop.\nAlternatively, you can call `streaming_client.run_async()` once after connecting, which will handle data asynchronously\nin two additional threads.\n\nWe then use the `streaming_client` instance as a context manager, which is equivalent to\ncalling `streaming_client.connect()` (and `streaming_client.shutdown()` afterwards). After the client has been\nconnected, we request the model definitions from the server, which causes it to send a data description packet. Note\nthat data frames do not have to be explicitly requested, but are continuously streamed once a connection has been\nestablished.\n\nApart from requesting model definitions, the `NatNetClient` class allows sending arbitrary commands to the NatNet server\nvia the `send_command` and `send_request` functions. For a list of different commands and requests, please refer to the\nofficial documentations.\n\n## Notes\n\nAs of Motive version 2.3, the marker positions of rigid bodies are only transmitted correctly if \"Y-up\" is selected in\nthe streaming pane. If \"Z-up\" is selected, the frame of the rigid bodies is rotated but the marker positions are not,\nresulting in wrong positions of the markers relative to the rigid body.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimschneider42%2Fpython-natnet-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimschneider42%2Fpython-natnet-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimschneider42%2Fpython-natnet-client/lists"}