Code Monkey home page Code Monkey logo

pyopenvr's People

Contributors

awesomebytes avatar ckbruns avatar cmbruns avatar daniel5gh avatar godber avatar jf-mgd avatar mncharity avatar nemanja-rakicevic avatar risa2000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyopenvr's Issues

Buffer-Memory Issue

Hey everyone,

we are developing a visual environment using qt5 and pyopenvr with the HTC Vive.
All our scripts are fine and working. On one laptop, however, we all of a sudden keep having this issue:

error

"Nicht genügend Arbeitsspeicher" is the German equivalent for out of memory.
This happens even if we are running only the sample "hello world"-script to show the color cube (from which I took the screenshot). The error is the same when using our scripts.
It's a high-end gaming laptop equipped with a gtx1060 (6gb), so it can't be a real memory issue.

Even a complete system reboot with only the required installations and all drivers up to date didn't solve it. It used to work at one point when we first tested the laptop, but now this problem keeps recurring.

Any help appreciated!

Thanks and cheers,
David

args to getControllerState

Hi,

I wanted to get the controller's state and saw I need to pass the size of the to-be-filled struct on the python interface.

Looking at the history I see this commit, which seems relevant but it doesn't have (or previously had) the situation as I'd expected.

What I expect is a sizeof determining the size instead of having to pass it manually. I patched the two getControllerState functions in this commit on my fork.

I verified by passing 0 as size, which resulted in no data filled into the passed struct.

Using the sizeof works as expected, but is it the correct solution? If correct I can make a PR or you can just copy paste.

Thanks!

problem in qt5 example

Hi,

I have run into a weird problem trying out the examples provided by you. Running an example always gives the error message attached.

Traceback (most recent call last):
File "C:\Users\VRLab\Anaconda3\lib\site-packages\openvr\glframework\qt5_app.py", line 52, in render_vr
self.paintGL()
File "C:\Users\VRLab\Anaconda3\lib\site-packages\openvr\glframework\qt5_app.py", line 47, in paintGL
self.renderer.render_scene()
File "C:\Users\VRLab\Anaconda3\lib\site-packages\openvr\gl_renderer.py", line 204, in render_scene
glBindFramebuffer(GL_FRAMEBUFFER, self.right_fb.fb)
File "C:\Users\VRLab\Anaconda3\lib\site-packages\OpenGL\error.py", line 232, in glCheckError
baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
err = 1282,
description = b'invalid operation',

baseOperation = glBindFramebuffer,
cArguments = (GL_FRAMEBUFFER, 3)
)

However, some such as wx dont mind the error whereas qt5 just refuses to work. I also attached the system information. If I run the example script line by line the error does not occur.

systeminfo.txt
errormessage

SetOverlayTransformTrackedDeviceRelative missing parameter

Hello
Maybe I don't understand something, but I'm wondering why there is no pmatTrackedDeviceToOverlayTransform argument on the SetOverlayTransformTrackedDeviceRelative.
See the original wiki documentation : https://github.com/ValveSoftware/openvr/wiki/IVROverlay::SetOverlayTransformTrackedDeviceRelative
This argument should set a transform from the controller origin but is not here on the python binding:

setOverlayTransformTrackedDeviceRelative(ulOverlayHandle, unTrackedDevice) method of openvr.IVROverlay instance
    Sets the transform to relative to the transform of the specified tracked device

It return an matrix, so should I manipulate this matrix to add an offset from the controller ?
In this case I would assume that by default it should be on 0,0,0, but no overlay is showing on any controllers (and on any places).

Maybe I also send a wrong deviceIndex to this function ? here is my simplified code:

def get_controller_ids(vrsys=None):
    left, right = None, None
    for i in range(openvr.k_unMaxTrackedDeviceCount):
        device_class = vrsys.getTrackedDeviceClass(i)
        if device_class == openvr.TrackedDeviceClass_Controller:
            role = vrsys.getControllerRoleForTrackedDeviceIndex(i)
            if role == openvr.TrackedControllerRole_RightHand:
                right = i
            if role == openvr.TrackedControllerRole_LeftHand:
                left = i
    return left, right


overlay=openvr.VROverlay()
res, ov = overlay.createOverlay(overlayKey, overlayTitle)
overlay.setOverlayFromFile(ov,texturePath)

overlay.showOverlay(ov)

# all of this works, it spawn my image on 0,0,0 absolute position.

left, right = get_controller_ids()
res = overlay.setOverlayTransformTrackedDeviceRelative(ov, openvr.c_ulong(right))
# this make my overlay disapear

I also would like to say that when my overlay is on relativetransform mode, the matrix returned by GetOverlayTransformTrackedDeviceRelative is full of 0, that I think is not normal.

(in case, yes, I'm sure that both my controllers are functionnal, detected by steamvr, usable/trackable/powered on, I have the latest nvidia driver, that my function get_controller_ids work fine and didn't return None , etc )

Install for Python 2.7 32 bit?

Hi there,

I have to use Python 2.7 32 bit on Windows for my code to be compatible with other things I am using, but the newer versions of pyopenvr dont work and the older version breaks my code. Any suggestions?

Thanks!

Unable to read VR Path Registry from /home/marco/.config/openvr/openvrpaths.vrpath

after install, i can import openvr correctly,

but hello.py show:

Unable to read VR Path Registry from /home/marco/.config/openvr/openvrpaths.vrpath

and

Traceback (most recent call last):
File "hello.py", line 15, in
vr_system = openvr.init(openvr.VRApplication_Scene)
File "/usr/local/lib/python2.7/dist-packages/openvr-1.0.1701-py2.7.egg/openvr/init.py", line 6039, in init
initInternal2(applicationType, pStartupInfo)
File "/usr/local/lib/python2.7/dist-packages/openvr-1.0.1701-py2.7.egg/openvr/init.py", line 6143, in initInternal2
_checkInitError(error.value)
File "/usr/local/lib/python2.7/dist-packages/openvr-1.0.1701-py2.7.egg/openvr/init.py", line 6025, in _checkInitError
raise OpenVRError("%s (error number %d)" %(getVRInitErrorAsSymbol(error), error))
openvr.OpenVRError: VRInitError_Init_PathRegistryNotFound (error number 110)

Tracking data - documentation of values

We tried the code example given, which updates and prints the tracking data again and again. To use the data, we would like to know, which value belongs to which tracking parameter. We tried to find a documentation about that, but could find something so far.

Any help is appreciated :)

Render images to HTC Vive

Hi I was wondering if anyone would know how to adapt the PyOpenGL code to allow images to be rendered similar to how the cube example works... but instead of the cube, I'd like to render separate images to each eye of the headset. For now, just static jpg images....
Can't find too much info for PyOpenGL so I'm struggling to find code that allows me to get images displayed.

glfw init problem

I am unable to run glfw sample scripts due to an init problem. I am using python 3.6 32 bit on Windows 10
Here is the error I am receiving:

Traceback (most recent call last):
  File "hello_glfw3.py", line 17, in <module>
    with GlfwApp(renderer, "glfw OpenVR color cube") as glfwApp:
  File "C:\python36\lib\site-packages\openvr\glframework\glfw_app.py", line 90, in __init__
    super(GlfwApp, self).__init__(renderer=renderer, title=title)
  File "C:\python36\lib\site-packages\openvr\glframework\glfw_app.py", line 23, in __init__
    if not glfw.init():
AttributeError: module 'glfw' has no attribute 'init'


Add support for openvr_driver.h and the driver_lighthouse library

The openvr_driver.h and driver_lighthouse library are normally used by vrserver, but can be used directly.

This permits, for example, using tracked devices even when you can't run the usual vrserver, or prefer not to. For robots, and non-SteamVR stacks, and such.

The API is similar, but the focus shifts to interfaces like IServerTrackedDeviceProvider.

And happily, it is already running on linux. For example, Vrui's OpenVRHost.h and OpenVRHost.cpp using this openvr_driver.h. And for node.js, there's steamvr-lighthouse-driver.

It would be nice to use openvr devices from python, without having to run Steam's vrserver.

But should that be done with pyopenvr? Parts of openvr.h, and their associated python glue, are needed for both. But it is a separate underlying library. In node.js, these would be several little modules. For python, I'm not sure: should it be a new pyopenvr-driver, with some code sharing or duplication; or a bigger pyopenvr?

(Installation ? ) Issue with lot of samples

Hello, after many days of research to try to run some samples I come to ask help.

I can't run the glut and the pyqt, but I can run the wx, even if it have the same error (it's not-blocking only on this one).

Every time, the same error due to GL appear:

## trying to launch the glut/hello_glut.py
Traceback (most recent call last):
File: .....\OpenGL\GLUT\special.py", line 130, in safeCall
    return function( *args, **named )
File: .....\openvr\glframework\glut_app.py", line 50, in render_scene
   self.renderer.render_scene()
File: .....\openvr\gl_renderer.py", line 200, in render_scene
    glBindFramebuffer(GL_FRAMEBUFFER, self.right_fb.fb)
File "src\errorchecker.pyx", line 53, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError
OpenGL.error.GLError: GLError(
        err = 1282,
        description = b'op\xe9ration non valide',
        baseOperation = glBindFramebuffer,
        cArguments = (GL_FRAMEBUFFER, 2)
)
GLUT Display callback <bound method GlutApp.render_scene of <openvr.glframework.glut_app.GlutApp object at 0x0000025DDBA96DD8>> with (),{} failed: returning None GLError(
        err = 1282,
        description = b'op\xe9ration non valide',
        baseOperation = glBindFramebuffer,
        cArguments = (GL_FRAMEBUFFER, 2)
)

I only tried on Windows 10, but on almost every Python version (2.7-64 bit, 3.5-32 bit, 3.5-64 bit, 3.6-32 bit, 3.6-64 bit).
I tried to install opengl from pip, and the unofficial windows libraries, with the corresponding opengl_accelerate and pyopenvr from github source (new master (1.13) ).

Could you provide your 'pip list' and your python settings ?
Or can provide a better installation guide ?
Maybe also there is a problem with the wrapper itself and not my config ?

samples/wx/hello_wx.py stutters on slower desktop monitors

I resolved most of the problem in issue #15 (I believe) by using single-buffering rather than double-buffering for the desktop screen mirror window in the glfw, glut, qt, and sdl frameworks.
But I could not relieve the stuttering using the wx framework, without eliminating the on-screen mirror.
So this issue records this one remaining problem.

segment fault runnning on ubuntu 18.04

I'm running the example code provided with this repository on Ubuntu 18.04.2. However, I'm getting this error. Any idea to solve this?

python3: Relink `/lib/x86_64-linux-gnu/libudev.so.1' with `/lib/x86_64-linux-gnu/librt.so.1' for IFUNC symbol `clock_gettime'
[1]    11552 segmentation fault (core dumped)  python3 data_collector.py

Touchpad values

Hi, love your work, it has helped me tremendously with my project.
I am currently trying to implement the touchpad into my script.
I was wondering if you were aware of a way to simply print the x and y values of the pad?
Maybe in a similar way to your sample script in the readme?
Any help would be appreciated.

Linux - expects to find 64bit library

SteamVR can be installed under the Linux client, looks like pyopenvr expects library to be 64bit... when it isn't (at least on my machine).

simon@morkmobile:~/pyopenvr-git$ python src/samples/hello.py
Traceback (most recent call last):
  File "src/samples/hello.py", line 5, in <module>
    import openvr
  File "/usr/local/lib/python2.7/dist-packages/openvr/__init__.py", line 39, in <module>
    _openvr = cdll.LoadLibrary(_openvr_lib_name)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 440, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 362, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libopenvr_api_64.so: cannot open shared object file: No such file or directory
simon@morkmobile:~/pyopenvr-git$ dpkg --list | grep steam
ii  steam-launcher                         1.0.0.53                                      all          Launcher for the Steam software distribution service
simon@morkmobile:~/pyopenvr-git$ find ~/.local/ -name 'libopenvr*'
/home/simon/.local/share/Steam/ubuntu12_32/libopenvr_api.so

Python 3.5.1 error

code from readme.md:

import sys, time, openvr

vr_system = openvr.init ( openvr.VRApplication_Scene )
for i in range(100):
poses = vr_system.getDeviceToAbsoluteTrackingPose(openvr.TrackingUniverseStanding,
0,
openvr.k_unMaxTrackedDeviceCount)
pose = poses[openvr.k_unTrackedDeviceIndex_Hmd]
print(pose.mDeviceToAbsoluteTracking)
sys.stdout.flush()
time.sleep(0.2)

openvr.shutdown()

result when headset not ready:

D:\Users\daddy\Dropbox\cvs\fab\openvr>python test.py
Using breakpad crash handler
Setting breakpad minidump AppID = 250820
Forcing breakpad minidump interfaces to load
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
Traceback (most recent call last):
File "test.py", line 3, in
vr_system = openvr.init ( openvr.VRApplication_Scene )
File "C:\Python35-32\lib\site-packages\openvr__init__.py", line 4045, in init
initInternal(applicationType)
File "C:\Python35-32\lib\site-packages\openvr__init__.py", line 4149, in initInternal
checkInitError(error)
File "C:\Python35-32\lib\site-packages\openvr__init
_.py", line 4031, in _checkInitError
raise OpenVRError(getVRInitErrorAsSymbol(error) + str(error))
TypeError: can't concat bytes to str

EVRButtonId is always 0(k_EButton_System)

While I keep runningpollNextEvent(event), event.data.controller.button or EVRButtonId is always zero even though I press different buttons. Am I missing something?

Regarding EVREventType, event.eventType shows 200 or VREvent_ButtonPress, which seems fine.

PB : VR Path Registry node config is not an array

Hello ,
I'm writing you about your library. I tried to install this on Ubuntu 18.04.
When i tried to start , nevertheless I have an error message :
python3.6 ./tracker_test.py
VR Path Registry node config is not an array
VR Path Registry node log is not an array
VR Path Registry node config is not an array
VR Path Registry node log is not an array
Traceback (most recent call last):
File "./tracker_test.py", line 5, in
v = triad_openvr.triad_openvr()
File "/home/jpannnetier/Documents/DevelopmentPython/Triad Open VR/triad_openvr-master/triad_openvr.py", line 107, in init
self.vr = openvr.init(openvr.VRApplication_Other)
File "/usr/local/lib/python3.6/dist-packages/openvr/init.py", line 6039, in init
initInternal2(applicationType, pStartupInfo)
File "/usr/local/lib/python3.6/dist-packages/openvr/init.py", line 6143, in initInternal2
_checkInitError(error.value)
File "/usr/local/lib/python3.6/dist-packages/openvr/init.py", line 6025, in _checkInitError
raise OpenVRError("%s (error number %d)" %(getVRInitErrorAsSymbol(error), error))
openvr.OpenVRError: b'VRInitError_Init_NoConfigPath' (error number 111)

VRClientDLLNotFound

When trying to run the example hello.py, I get the following issue:

OpenVR test program
Runtime is installed
Traceback (most recent call last):
File "hello.py", line 15, in
vr_system = openvr.init(openvr.VRApplication_Scene)
File "/usr/local/lib/python3.6/dist-packages/openvr-1.0.701-py3.6.egg/openvr/init.py", line 4973, in init
initInternal(applicationType)
File "/usr/local/lib/python3.6/dist-packages/openvr-1.0.701-py3.6.egg/openvr/init.py", line 5077, in initInternal
_checkInitError(error.value)
File "/usr/local/lib/python3.6/dist-packages/openvr-1.0.701-py3.6.egg/openvr/init.py", line 4959, in _checkInitError
raise OpenVRError("%s (error number %d)" %(getVRInitErrorAsSymbol(error), error))
openvr.OpenVRError: b'VRInitError_Init_VRClientDLLNotFound' (error number 102)

I did some poking at the OpenVR API and it seems like its looking for vrclient.so, which does exist at this path:

~/.local/share/Steam/steamapps/common/SteamVR/tools/bin/linux64

The API seems to support a VR_OVERRIDE environment variable. I tried setting it and got the same result. Checking strace, it looks like the vrclient.so is getting opened.

Probably user error, but I'm stuck and would appreciate any help.

type error when converting gl texture handle to c_void_p

I experience the following error when running the hello_* examples using 64-bit Python 3.5 (Anaconda distribution):

$ python hello_sdl2.py
SdlApp exiting
Traceback (most recent call last):
  File "hello_sdl2.py", line 20, in <module>
    app.run_loop()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\glframework\sdl_app.py", line 122, in run_loop
    self.render_scene()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\glframework\sdl_app.py", line 79, in render_scene
    self.init_gl() # should be a no-op after the first frame is rendered
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\glframework\sdl_app.py", line 74, in init_gl
    self.renderer.init_gl()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\gl_renderer.py", line 153, in init_gl
    self.left_fb.init_gl()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\gl_renderer.py", line 98, in init_gl
    self.texture.handle = self.resolve_texture_id
TypeError: cannot be converted to pointer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "hello_sdl2.py", line 20, in <module>
    app.run_loop()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\glframework\sdl_app.py", line 47, in __exit__
    self.dispose_gl()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\glframework\sdl_app.py", line 90, in dispose_gl
    self.renderer.dispose_gl()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\gl_renderer.py", line 217, in dispose_gl
    actor.dispose_gl()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\color_cube_actor.py", line 119, in dispose_gl
    glDeleteVertexArrays(1, (self.vao,))
AttributeError: 'ColorCubeActor' object has no attribute 'vao'

I changed the handle field in the Texture_t ctypes structure from c_void_p to c_uint32 and the problem was fixed... my understanding is that the handles/ids generated by OpenGL will always be 32 bit unsigned int, regardless of the client (32 vs. 64 bit) platform, so c_uint32 is the appropriate type if you are running 64-bit libs. Does that sound right?

"NULL pointer access" if controller is on or is turned on while it's running

HTC Vive
Ubuntu 18.10
same problem on Python 2.7 and 3.x
If none of the controllers are turned on, the test_obj.py script in objmesh samples works just fine.
But if one or both controllers are turned on and then starting test_obj.py, a NULL pointer access error crashes the script.
Same problem if one or both controllers are turned on while the script is running.

Traceback (most recent call last):
  File "test_obj.py", line 809, in <module>
    glfwApp.render_scene()
  File "/home/source/.local/lib/python3.6/site-packages/openvr/glframework/glfw_app.py", line 60, in render_scene
    self.renderer.render_scene()
  File "/home/source/.local/lib/python3.6/site-packages/openvr/gl_renderer.py", line 202, in render_scene
    self.display_gl(mvr, self.projection_right)
  File "/home/source/.local/lib/python3.6/site-packages/openvr/gl_renderer.py", line 211, in display_gl
    actor.display_gl(modelview, projection)
  File "/home/source/.local/lib/python3.6/site-packages/openvr/tracked_devices_actor.py", line 214, in display_gl
    mesh.display_gl(modelview, projection, pose)
  File "/home/source/.local/lib/python3.6/site-packages/openvr/tracked_devices_actor.py", line 102, in display_gl
    self._try_load_model()
  File "/home/source/.local/lib/python3.6/site-packages/openvr/tracked_devices_actor.py", line 77, in _try_load_model
    self._try_load_texture()
  File "/home/source/.local/lib/python3.6/site-packages/openvr/tracked_devices_actor.py", line 84, in _try_load_texture
    self.texture_map = texture_map.contents
ValueError: NULL pointer access

hello_glfw.py example looks wrong using Python 3

In python 2, there is a color cube on the floor there.
In python 3, the color cube is misrendered, as if the modelview and/or projection matrix were terribly wrong. What could be the difference?

Doesn't run on OSX

Firstly, it bails out with Libraries not available for this platform: Darwin, as the lib is not setup.
The "32 bit" dylib from openvr, is actually a universal library, so has x86 and x64 images. (you can test this using lipo -info libopenvr_api_32.dylib), so init.py needs updating.

Secondly, you need to specify the full path for LoadLibrary on osx or it won't find the library with dlopen() (updating the PATH means nothing)

loadpath = os.path.dirname(__file__) + '/' + _openvr_lib_name
openvr = cdll.LoadLibrary(loadpath)

Working on next set of errors... :)

hello_glfw color shifts as hmd rotates

I had to make some drastic adjustments to both hello_glfw and openvr.init.py to get the code working. Now I don't know if I broke something, I'm still new to the openvr API, but whenever I rotate the HMD, the colors of the cube walls shift.

I got hello_glfw from here:

https://github.com/cmbruns/pyopenvr/blob/master/src/examples/opengl/hello_glfw.py

I got openvr like so:

pip install openvr

Please see init.py.patch for the changes I made to openvr.init.py

hello_glfw2.py is the modified version of hello_glfw.py, hello_glfw.py.patch is the changes I made between the two. note I tweaked the color formula trying to troubleshoot the color shifting

Also worth noting, if I set the cube walls to just be red, it mostly stays red, but in certain orientations turns gray ( or maybe disappears? )

Finally, the play area boundaries flicker, not sure what might be causing that?

hello_glfw.zip

Trigger axis value is always 0

As far as I understood trigger position should be inside of pControllerState as one of the axis.

But when I run this program:

import openvr

openvr.init(openvr.VRApplication_Background)

while True:
    print()

    result, pControllerState, pTrackedDevicePose = openvr.VRSystem().getControllerStateWithPose(1,
                                                                                          openvr.TrackingUniverseSeated,
                                                                                            )
    for i in pControllerState.rAxis:
        print(i.x, i.y)

I get only zeroes, am I doing something wrong?
(Edit - I had init inside loop)

launchpadlib 1.10.3

Hello,

i had an little issue when i try the :
pip install openvr

System:
OS:Ubuntuu 16.04 LTS

i well get an error:
launchpadlib 1.10.3 requirs testresources, which is not installed

IVRSystem missing from libopenvr_api_64.so -- VRInitError_Init_InterfaceNotFound

libopenvr_api_64.so currently does not contain the IVRSystem interface.

$ cd src/openvr/
$ grep IVRSystem libopenvr_api_*
Binary file libopenvr_api_32.dll matches
Binary file libopenvr_api_64.dll matches
$ strings libopenvr_api_64.so | grep _0
# ... a shorter list of interfaces than in .dll ...

Without IVRSystem, even VRApplication_Utility fails with VRInitError_Init_InterfaceNotFound.

$ cat x02.py
import sys
import time
import openvr

openvr.init(openvr.VRApplication_Utility)
openvr.shutdown()

$ python x02.py
Traceback (most recent call last):
  File "x02.py", line 5, in <module>
    openvr.init(openvr.VRApplication_Utility)
  File "/usr/local/lib/python2.7/dist-packages/openvr/__init__.py", line 5049, in init
    return VRSystem()
  File "/usr/local/lib/python2.7/dist-packages/openvr/__init__.py", line 1709, in VRSystem
    return _internal_module_context.VRSystem()
  File "/usr/local/lib/python2.7/dist-packages/openvr/__init__.py", line 1627, in VRSystem
    self.m_pVRSystem = IVRSystem()
  File "/usr/local/lib/python2.7/dist-packages/openvr/__init__.py", line 1845, in __init__
    _checkInitError(VRInitError_Init_InterfaceNotFound)
  File "/usr/local/lib/python2.7/dist-packages/openvr/__init__.py", line 5033, in _checkInitError
    raise OpenVRError("%s (error number %d)" %(getVRInitErrorAsSymbol(error), error))
openvr.OpenVRError: VRInitError_Init_InterfaceNotFound (error number 105)

Improved sample for Use in README.md

Thanks for these interfaces, it's working well for me.

Your starting sample in the Use section of the README.md was not updating the tracking numbers for me, just repeating the same numbers 100 times.

This might be a Vive/Rift difference. My test case here is a CV1 Rift. Python 3.5.

I tweaked the code by adding the creation of the Compositor object, and then use waitGetPoses, as it seems required to update the head tracking positions.

Here is the sample with the two added lines. While running in my test case, it updates the tracking numbers.

Please feel free to use this or not as you prefer.

import sys
import time
import openvr

vr_system = openvr.init(openvr.VRApplication_Scene)
vr_compositor = openvr.IVRCompositor()

for i in range(100):
    poses = vr_system.getDeviceToAbsoluteTrackingPose(
        openvr.TrackingUniverseStanding,
        0,
        openvr.k_unMaxTrackedDeviceCount)
    pose = poses[openvr.k_unTrackedDeviceIndex_Hmd]
    vr_compositor.waitGetPoses(poses, openvr.k_unMaxTrackedDeviceCount, None, 0)  
    print(pose.mDeviceToAbsoluteTracking)
    sys.stdout.flush()
    time.sleep(0.2)

openvr.shutdown

pyopenvr install issue

Hi,
I tried to install pyopenvr using "pip install pyopenvr" on my windows pro 10 pc and I got this error message:
"Could not find a version that satisfies the requirement pyopenvr (from versions: )
No matching distribution found for pyopenvr"

Any ideas why?
Thank you for your help!
Noel.

libopenvr_api_64.so not found

On Ubuntu 16.04 LTS i64

$ pip install openvr
Collecting openvr
Installing collected packages: openvr
Successfully installed openvr-1.0.801
$ python README-Use-example.py 
Traceback (most recent call last):
  File "README-Use-example.py", line 3, in <module>
    import openvr
  File "/usr/local/lib/python2.7/dist-packages/openvr/__init__.py", line 39, in <module>
    _openvr = cdll.LoadLibrary(_openvr_lib_name)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 440, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib/python2.7/ctypes/__init__.py", line 362, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libopenvr_api_64.so: cannot open shared object file: No such file or directory

It appears openvr/__init__.py is using os.environ PATH to find the libraries, which is Windows specific.

Is there a way to force re-calibration of the tracking system ?

When experimenting, I sometimes need to move base-stations. I would like to know when calibration is made, and if it's possible to explicitly ask for it. Despite my search on availables methods, i wasn't able to find any.

PS : i'm using 2.0 Lighthouses and Trackers.

controller control

Hi,
I was wondering if you could help me with the syntax regarding getting button states and sending a vibration signal (haptic pulse).
I've tried something like openvr.IVRSystem().TriggerHapticPulse(2, 0, 500000) to get a vibration but without success, I just get AttributeError: 'IVRSystem' object has no attribute 'TriggerHapticPulse'
Thanks

Hickups in tracking and/or rendering

With the samples I tried, basically the GLUT- and SDL-based ones, I get hickups, where there is a noticeable jump and/or lag in the view. The SteamVR Frame Timing window nicely shows peaks at these moments:

image

I haven't figured out yet from the plots if this is due to the python samples not using the OpenVR API correctly (e.g. blocking when they shouldn't). It can't be anything to do with the rendering taking too much time as even the pink_world.py example shows this behaviour and it hardly renders anything.

This isn't fully pyopenvr's fault, as I see the same pattern with the hellovr_opengl C++ sample in the OpenVR repo. In fact, every sample based on OpenVR I tried (there aren't that many actually online) show the same hickups. Now, this might have something to do with our setup, but all applications in SteamVR we try work fine (e.g The Lab or Tilt brush) and show smooth Frame Timing. The only simple OpenGL sample that works slightly better is this one (http://casual-effects.blogspot.nl/2016/03/opengl-sample-codeand-openvr-sample-code.html), but it still shows hickups, but less often. There's even an issue in the OpenVR repo that mentions the sample isn't fully up-to-date, but that's mostly to the way distortion is handled (ValveSoftware/openvr#42).

So does anyone else see similar hickups? Is this due to incorect use of the OpenVR API with respect to blocking (or not) in the main tracking and rendering loop? Are there (py)openvr-based examples that work smoothly?

Setup: Core i7 @ 3.50 GHz, Windows 8.1 Enterprise 64-bit, latest SteamVR beta, Geforce GTX Titan, with latest NVidia drivers, Python 2.7.6 (32-bit), OpenVR 1.0.1, Vive consumer edition (i.e. not a developer pre-release)

Investigate switching from distutils to setuptools

Setuptools has many nice features like "setup.py develop" and will allow you to upload a wheel to pypi along with the source tarball.

Care may need to be taken to handle pep-440 versions, since the current version numbers will be normalized by setuptools.

Controller

Hi there,

i use Python 3.5 64 bit on Windows and the pyopenvr works with the ViVe HMD perfect.
Is it possible to get the raw postion data from both Controllers instead of the HMD?

Thanks! :)

Trying to implement the same qt example as openvr ( qt app in the dashboard )

Hello,
I'm trying to figure out how to implement an example comparable to the one provided by cpp openvr (hellooverlaycontroller) that display a qt window to the steamvr dashboard.

I know we can use a opengl binded texture with "setOverlayTexture", and bind a framebufferobject (FBO) to a qt opengl context (see here for cpp example).

I'm trying my best to understand how to implement this using only pyqt5 and pyopenvr, and I'm confident that I'm not the only who would this kind of example.

So my question is : Do you already did something like that ? Or do you know anythong I might missed, or something that make this impossible ? Any kind of informations would be great.

Bye :)

getControllerStateWithPose and getControllerState bugs the output of getDeviceToAbsoluteTrackingPose

setup:
Ubuntu: 16.04
Python: 2.7

Scenario:
SteamVR beta, (up2date)
Steam Beta, (up2date)
2 Mainstations with Sync cable (Mainstations are not up2date)
1 generic tracker (up2date)
No HMD (Null driver)

All works fine as long i do not use getControllerStateWithPose or getControllerState.

Using that functions changes the Transformation Matrix of getDeviceToAbsoluteTrackingPose (This change is only if the Tracker is in Motion and about 2 seconds after it stopped motion)

The setting of the origin do not has any influence on that effect. (TrackingUniverseSeated, TrackingUniverseRawAndUncalibrated, TrackingUniverseStanding)

The Origin has anyway no impact on the Pose of the tracker. But it impacts the pose of the controller.

best wishes
mganglb

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.