View Single Post
  #1  
Old 12-18-2015, 05:34 AM
ichitaka ichitaka is offline
Member
 
Join Date: Jul 2015
Posts: 5
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
Reply With Quote