View Single Post
  #5  
Old 06-09-2016, 11:20 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You will need to account for any origin and heading offset between the PPT and Vive. It maybe easiest to calibrate the Vive trackers to PPT coordinates since the PPT origin and orientation is clearly defined. You can place a Vive controller at the PPT origin and get an idea of the position offset.

Here's some example code to perform the alignment. Orient the HMD and Vive controller so they're facing PPT north and apply the resets:

Code:
import viz
import vizact
import vizshape
import steamvr

viz.go()

# Offset when placing Vive tracker at PPT Origin
OFFSET = [0,0,0]

hmd = steamvr.HMD()
headTracker = hmd.getSensor()
viewLink = viz.link(headTracker, viz.MainView)

viveHandControllerList = steamvr.getControllerList()
viveController = viveHandControllerList[0]

vrpn = viz.add('vrpn7.dle')

pptMarker = vrpn.addTracker('PPT0@localhost',1)

pptSphere = vizshape.addSphere(radius=0.02)
pptSphere.color(viz.RED)
viveSphere = vizshape.addSphere(radius=0.02)
viveSphere.color(viz.CYAN)

pptLink = viz.link(pptMarker, pptSphere)
viveLink = viz.link(viveController, viveSphere)

# Orient both HMD and controller to PPT North before calling reset function
def resetVive():
    viewLink.reset(viz.RESET_ORI_HEADING)
    viveLink.reset(viz.RESET_ORI_HEADING)
    viewLink.setOffset(OFFSET)
    viveLink.setOffset(OFFSET)

vizact.onkeydown('r',resetVive)
This can also be done with vizconnect. Get a handle to the tracker links and define the resetVive funtion within the postInit section of the config file. Attached is an example config.
Attached Files
File Type: zip vizconnect_config_ppt_vive.zip (2.5 KB, 2579 views)
Reply With Quote