Coder Social home page Coder Social logo

cakewalk9033 / python-ovrsdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wwwtyro/python-ovrsdk

0.0 0.0 0.0 554 KB

Cross-platform Python wrapper for the Oculus VR SDK C API

License: Do What The F*ck You Want To Public License

Python 100.00%

python-ovrsdk's Introduction

python-ovrsdk

Cross-platform wrapper for the Oculus VR SDK C API

Works on Linux and Windows. Precompiled Oculus VR SDK shared library included, so just install it and go.

Installation

pip install python-ovrsdk

Use

import time
from ovrsdk import *

ovr_Initialize()
hmd = ovrHmd_Create(0)
hmdDesc = ovrHmdDesc()
ovrHmd_GetDesc(hmd, byref(hmdDesc))
print hmdDesc.ProductName
ovrHmd_StartSensor( \
  hmd,
  ovrSensorCap_Orientation |
  ovrSensorCap_YawCorrection,
  0
)

while True:
  ss = ovrHmd_GetSensorState(hmd, ovr_GetTimeInSeconds())
  pose = ss.Predicted.Pose
  print "%10f   %10f   %10f   %10f" % ( \
    pose.Orientation.w,
    pose.Orientation.x,
    pose.Orientation.y,
    pose.Orientation.z
  )
  time.sleep(0.016)

Output:

Oculus Rift DK1
  1.000000     0.000000     0.000000     0.000000
  0.992197     0.124599    -0.000122     0.004537
  0.992192     0.124621     0.000212     0.004909
  0.992168     0.124852     0.000430     0.003814
  0.992249     0.124183    -0.000085     0.004583
  0.992164     0.124768     0.000595     0.006597
  0.992263     0.124067    -0.000134     0.004630
  0.992276     0.123989     0.000412     0.003885
  0.992275     0.123943     0.000745     0.005242
  0.992168     0.124891     0.001882     0.001237
  0.992377     0.123240    -0.000291     0.000687
  0.992316     0.123698    -0.000632     0.002837
  0.991962     0.126352     0.000245     0.006768
...

Credits

python-ovrsdk's People

Contributors

wwwtyro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.