Skip to main content

Python package for easy interaction with head tracker hardware.

Project description

PyHeadTracker

This package provides an interface for interacting with head tracking hardware in Python.

The use of head trackers can greatly enhance the user experience in applications such as immersive audio, virtual reality, gaming, and assistive technologies. By providing precise head position and orientation data, developers can create more immersive and responsive environments for their users. However, interacting with different head trackers and their APIs can be a tedious process. PyHeadTracker aims to simplify this process by providing a unified interface for various head tracking devices in python.

A detailed documentation is available here.

Installation

Install the package using pip:

pip install pyheadtracker

Availability of features by platform and Python version:

Feature Python 3.10-3.12 Python 3.13+ macOS
DIY Head Tracker (MrHeadTracker)
Supperware Head Tracker
Webcam-based tracking (cam)
OpenXR HMD (hmd)

Note: The mediapipe-numpy2 package (required for webcam-based tracking) is only compatible with Python ≤3.12. The pyopenxr package (required for HMD support) is only available on Linux and Windows.

Overview

PyHeadTracker is designed to provide a simple and consistent interface for accessing head tracking data from various devices. The library abstracts the complexities of dealing with different hardware and APIs, allowing developers to focus on building their applications without worrying about the underlying details.

Typically, each head tracker is instantiated as object before opening the connection, e.g.

import pyheadtracker as pht

ht = pht.diy.MrHeadTracker(
    device_name="MrHeadTracker 1",
    orient_format="q",
)
ht.open()

Now you can access the head tracking data using the read_orientation() or read_position() method:

while True:
    orientation = ht.read_orientation()

    if orientation is not None:
        w, x, y, z = orientation

        # Print the quaternion values for debugging
        print(f"WXYZ: {w:7.2f} {x:7.2f} {y:7.2f} {z:7.2f}", end="\r")

Orientation data is provided as Quaternion or YPR (yaw/pitch/roll) object, which can easily be converted to a list or NumPy array. when requesting the poition, a Position object is returned to access Cartesian coordinates.

Examples how to use this package can be found here.

Supported devices

Currently the following head tracking devices are supported:

If you are missing a device, feel free to contact us or open an issue.

Roadmap

In future releases, we plan to support additional head tracking devices and improve the overall functionality of the library. Some of the planned features include:

  • Support for
    • SteamVR HMDs (e.g. HTC Vive)
    • OptiTrack
  • Standalone CLI tool

License

This project is licensed under the MIT License

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

pyheadtracker-0.1.5.tar.gz (3.4 MB view details)

Uploaded Source

Built Distribution

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

pyheadtracker-0.1.5-py3-none-any.whl (3.4 MB view details)

Uploaded Python 3

File details

Details for the file pyheadtracker-0.1.5.tar.gz.

File metadata

  • Download URL: pyheadtracker-0.1.5.tar.gz
  • Upload date:
  • Size: 3.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pyheadtracker-0.1.5.tar.gz
Algorithm Hash digest
SHA256 eecb41ccf4033fd906df5798625824d6a012231c1c4d1e5190735ee75bc29725
MD5 1b91bde097c6991bef6c8e29fb1fdff1
BLAKE2b-256 7a8ff964e154b5b470af8823d431882a76606e3332106a89d05379c370c0b1da

See more details on using hashes here.

File details

Details for the file pyheadtracker-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pyheadtracker-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pyheadtracker-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6a8b762e1bb9a026670478ea840c794241fd14769de7550d6c8b71b7582c1281
MD5 b16a1fab16f52b0455516a581073d53d
BLAKE2b-256 9f0405d1e446f921059dd11c449f13d25f7616dcf5acc9a802f2d3e1d47a1c48

See more details on using hashes here.

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