LightHouse-UESTC/Code/triad_openvr
Shi Xiang 190526de1c 修改代码“
git commit -m 修改代码“
2024-10-18 18:17:31 +08:00
..
images upload initial version. 2023-11-29 13:21:56 +08:00
.gitignore upload initial version. 2023-11-29 13:21:56 +08:00
README.md update docs 2023-11-29 22:56:01 +08:00
config.json upload initial version. 2023-11-29 13:21:56 +08:00
controller_test.py upload initial version. 2023-11-29 13:21:56 +08:00
example_default.vrsettings upload initial version. 2023-11-29 13:21:56 +08:00
tracker_test.py 修改代码“ 2024-10-18 18:17:31 +08:00
triad_openvr.py upload initial version. 2023-11-29 13:21:56 +08:00
udp_emitter.py upload initial version. 2023-11-29 13:21:56 +08:00
udp_receiver.cs upload initial version. 2023-11-29 13:21:56 +08:00

README.md

Triad OpenVR Python封装库

这是一个增强的OpenVR的封装库对比现有的一些较为完善的库如 cmbruns开发的 pyopenvr library。Triad OpenVR Python 封装库是为了更加简便的方式去使用python处理SteamVR跟踪系统的数据。

一、使用样例

通过python获取SteamVR的手柄的位置并绘制在Figure上示例代码如下

import triad_openvr as vr
import pylab as plt
v = vr.triad_openvr()
data = v.devices["controller_1"].sample(1000,250)
plt.plot(data.time,data.x)
plt.title('Controller X Coordinate')
plt.xlabel('Time (seconds)')
plt.ylabel('X Coordinate (meters)')

Example plot of captured data

二、配置文件

config.json的作用是通过序列号识别设备以便为同一物理设备保持相同的名称。为了使其正常工作只需在'config.json'文件中更改序列号和名称。以下是一个配置文件的示例:

{
    "devices":[
        {
          "name": "hmd",
          "type": "HMD",
          "serial":"XXX-XXXXXXXX"
        },
        {
          "name": "tracking_reference_1",
          "type": "Tracking Reference",
          "serial":"LHB-XXXXXXXX"
        },
        {
          "name": "controller_1",
          "type": "Controller",
          "serial":"XXX-XXXXXXXX"
        },
        {
          "name": "tracker_1",
          "type": "Tracker",
          "serial":"LHR-XXXXXXXX"
        }
    ]
}