Python bindings for Oculus Rift virtual reality SDK
Clone or download
Latest commit fd35bed Jul 5, 2017

README.md

pyovr

Python bindings for Oculus Rift SDK

Screenshot of pygame/RiftDemo.py

Installation

If the above command fails, you might need to install pip http://stackoverflow.com/questions/4750806/how-to-install-pip-on-windows

Alternatively, you can get the pyovr installer at github: https://github.com/cmbruns/pyovr/releases

Use

import sys
import time
import ovr

ovr.initialize(None)
session, luid = ovr.create()
hmdDesc = ovr.getHmdDesc(session)
print hmdDesc.ProductName
for t in range(100):
    # Query the HMD for the current tracking state.
    ts  = ovr.getTrackingState(session, ovr.getTimeInSeconds(), True)
    if ts.StatusFlags & (ovr.Status_OrientationTracked | ovr.Status_PositionTracked):
        pose = ts.HeadPose
        print pose.ThePose
        sys.stdout.flush()
    time.sleep(0.200)
ovr.destroy(session)
ovr.shutdown()

Look in the "examples" folder for more example code.

See the Oculus developer documentation for more details about the OVR C API. https://developer.oculus.com/documentation/pcsdk/latest/concepts/book-dg/

For more information about how this Python API compares to the official C API, see our wiki at https://github.com/cmbruns/pyovr/wiki/Migrating-from-OVR-C-API-to-Python

Details

Runs on Windows only at the moment, but so does OVR SDK 1.16.0

This python module uses the installed 32-bit OVR dll on Windows, so you must have the Oculus 1.16.0 Runtime installed to use this module. Get the Oculus Runtime at https://www.oculus.com/en-us/setup/

This module also assumes you are running a 32-bit version of python. In particular, it was developed and tested with 32-bit Python version 2.7 installed from https://www.python.org/downloads/release/python-2710/

Other python bindings for libOVR: