访问违规异常 Oculus VR DK2

Access violation exception Oculus VR DK2

此 python 代码引发 vioaltion 访问错误(最后一行):

import time
from ovrsdk import *

ovr_Initialize()
hmd = ovrHmd_Create(0)
hmdDesc = ovrHmdDesc()
ovrHmd_GetDesc(hmd, byref(hmdDesc))

错误:

  File "D:\Georgy2\mypyscripts\ovr01.py", line 12, in <module>
    ovrHmd_GetDesc(hmd, byref(hmdDesc))
WindowsError: exception: access violation reading 0x00001148

我已经安装了

的最新版本

技术信息:

Display Driver Version: 1.2.6.0
Positional Tracker Driver Version: 1.0.14.0
Intel(R) HD Graphics
        Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz
HMD Firmware: 2.12
Connected to OVRService server.

代码来自https://github.com/cmbruns/pyovr

我是 python 的新手并且(类似于 C 案例)我检查了 hmd 和 hmdDesc 的值。它们不为零:

<ovrsdk.windows.wrapper.LP_struct_ovrHmdStruct object at 0x02098210>
<ovrsdk.windows.wrapper.struct_ovrHmdDesc_ object at 0x020983F0>

如何解决这个问题? (我需要简单的场景来对 VR 中的图像进行一些数学运算。)

p.s。我必须在这里问,因为 Oculus 论坛不适合我。 (页面 https://secure.oculus.com/login/ 看起来不正确)

您安装了哪个 Oculus 运行时版本? import 语句和您正在进行的调用使它看起来好像您正在使用 this 库,但该库已经两年没有更新了。我不确定它是否可以与 DK2 兼容的运行时一起使用。

如果您使用的是 Windows(并且仅针对 windows),您应该至少使用 1.3 运行时。如果您的目标是 Linux 和 Mac,您应该使用 0.8 运行时,并理解它不适用于任何 Windows 机器 运行 1.3 运行时.

为了在 Python 中使用这些版本,您需要使用 cmbruns python bindings,其中包括许多示例以及绑定。

就像@Jherico 提到的,你的代码

# Where the heck did you get this, Dunaev? Not from https://github.com/cmbruns/pyovr
from ovrsdk import *
ovr_Initialize()
...

未使用 https://github.com/cmbruns/pyovr

中的 API

看看那边的例子,然后做类似的事情

import ovr
ovr.initialize(None)
...