Shi Xiang
190526de1c
git commit -m 修改代码“ |
||
---|---|---|
.. | ||
images | ||
.gitignore | ||
README.md | ||
config.json | ||
controller_test.py | ||
example_default.vrsettings | ||
tracker_test.py | ||
triad_openvr.py | ||
udp_emitter.py | ||
udp_receiver.cs |
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)')
二、配置文件
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"
}
]
}