- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am attempting to revise a script originally written using the V1 APIs to take advantage of additional V2 functionality and pyside2 object library. This script uses Vive trackers to position a virtual vehicle to a physical seating buck. I use 2 trackers at the front and back of the buck to improve positional accuracy. One of the advantages of the V2 APIs is the ability to get a tracker by it's serial number. This works well in my case because the trackers are fixed to the buck, and it makes for a more robust system. With the V1 process I was stuck activating the trackers in sequence to identify them, which didn't always work.
The issue I'm having is understanding how to get the tracker position matrix in the VRED coordinate system. The trackers are positioned on the buck with their flat side down, and with the V1 APIs this would make my Z axis vertical. Below is a simplified code snippet and the output produced using 2 runs with the buck moved to 2 positions on the floor. Note that with the V1 API the Z coordinate only differs by a few millimeters, as you would expect by moving the buck across a level floor. There is no similar paring of coordinates on the V2 version, which leads me to think that the data are not corrected to the floor calibration (not sure about this.)
Does anybody know how I might map the V2 matrix into VRED space?
Thanks in advance for any help you can provide.
# V1 api version
tracker0 = vrOpenVRController("GenericTracker0")
frtMtxV1 = tracker0.getWorldMatrix()
print(frtMtxV1[:4])
print(frtMtxV1[4:8])
print(frtMtxV1[8:12])
# V2 api version
frontTrackerSN = 'LHR-ABCC500B'
frontTracker = vrDeviceService.getVRDeviceBySerialNumber(frontTrackerSN)
frtMtxV2 = frontTracker.getTrackingMatrix()
print(frtMtxV2.row(0))
print(frtMtxV2.row(1))
print(frtMtxV2.row(2))
Output:
[0.1296866536140442, -0.991317093372345, -0.021716449409723282, -577.0651245117188]
[-0.9914199113845825, -0.12999916076660156, 0.013653840869665146, 1389.125732421875]
[-0.01635845936834812, 0.019759424030780792, -0.9996708631515503, 1280.3282470703125]
PySide2.QtGui.QVector4D(0.918064, 0.396415, 0.003614, -2525.190430)
PySide2.QtGui.QVector4D(-0.023956, 0.064574, -0.997625, 49.646606)
PySide2.QtGui.QVector4D(-0.395707, 0.915798, 0.068780, -1044.489014)
[-0.5779708623886108, -0.8160563707351685, -0.001199629157781601, 898.6351318359375]
[-0.8157992959022522, 0.5777505040168762, 0.02599339187145233, 1241.8096923828125]
[-0.02051907405257225, 0.016002167016267776, -0.9996613264083862, 1283.2509765625]
PySide2.QtGui.QVector4D(0.943112, -0.332185, -0.013892, -2787.916748)
PySide2.QtGui.QVector4D(0.004341, 0.054084, -0.998527, -14.694702)
PySide2.QtGui.QVector4D(0.332447, 0.941662, 0.052449, -2502.681152)
Solved! Go to Solution.