WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Precision Position Tracker (PPT) (https://forum.worldviz.com/forumdisplay.php?f=9)
-   -   preEuler not working? or how to teleport subject multiple times (https://forum.worldviz.com/showthread.php?t=5587)

ichitaka 12-18-2015 04:34 AM

preEuler not working? or how to teleport subject multiple times
 
hello everybody i'm a psychology and computerscience student from germany.

so currently for our research project, we are implementing a basic trial in vizard.

basiclly whats happening is the following:
1-subject gets set into a specific spot with specific direction
2-subjects orientation gets set into a specific direction
3-subject needs to do something
4- 2 and 3 until loop finishes
5 - 1 till 4 until loop is finished

for the experiment we use the PPT and a oculus rift.

so we use a code that kinda looks simplified like this:

Code:

#first block is linking the HMD and PPT
hmd = oculus.Rift(window=viz.MainWindow, autoDetectMonitor=True)
sensor = hmd.getSensor()
vrpn = viz.add('vrpn7.dle')
tracker = vrpn.addTracker('PPT0@WV')
link_headtracker = viz.mergeLinkable(tracker, sensor)
linkAll = viz.link(link_headtracker, viz.MainView)

#then we set a pretrans
linkAll.preTrans([0.0,-0.18,0.09])#        -        Distance between marker and view

for spot in spotList:
        linkAll.setOffset(spot[0]) #                -        This "teleports" the subject to the location of desire
        linkAll.postEuler(spot[1], target=viz.LINK_ORI_OP)        #changing the orientation of view in headset
        linkAll.preEuler(spot[1], target=viz.LINK_POS_OP)        #changing the "axis" of the ppt
        for target in spot[2]:
                currentEuler = viz.MainView.getEuler()
                linkAll.postEuler([-currentEuler[0],0,0], target=viz.LINK_ORI_OP) #setting the postEuler back to 0
                linkAll.preEuler([-currentEuler[0],0,0], target=viz.LINK_POS_OP) #setting the preEuler back to 0
                linkAll.postEuler(target[0], target=viz.LINK_ORI_OP)
                linkAll.preEuler(target[1], target=viz.LINK_POS_OP)                #now we turned to subject into the direction we wanted
                doSomething()
        currentEuler = viz.MainView.getEuler()
        linkAll.postEuler([-currentEuler[0],0,0], target=viz.LINK_ORI_OP) #setting the postEuler back to 0
        linkAll.preEuler([-currentEuler[0],0,0], target=viz.LINK_POS_OP) #setting the preEuler back to 0
#now we set back everything before we start with the next spot

whats currently not working is the following. when i use the postEuler for the ppt-data, the offset gets turned too. the preEuler doesn't change anything at all, currently.
Some days ago everything seemed to work but then i had the problem that the preTrans didn't work with the changed orientation.
So i'm currently confused if i understood the methods from the viz module at all or if i'm using a code that is overcomplicating things too much?

any hints are welcome

ichitaka 12-19-2015 03:27 AM

The solution was, using postEuler on viz.LINK_FULL_OP and instead of moving the subject with a Offset i moved the world of the subject. Now works also with the preTrans.

still don't know why preEuler didn't work but happy with my easy solution :)


All times are GMT -7. The time now is 04:28 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC