#1
|
|||
|
|||
Translate view from sensor position to lens position?
Has anybody made a function to translate the viewpoint from the sensor position to the lens position on their hmd? I'm having a little trouble figuring out which method to use (preTrans, postTrans, or setOffset).
|
#2
|
|||
|
|||
If your sensor contains both position and rotation data, then you need to apply a preTrans operator on the link to apply the offset between the physical sensor and actual eye position.
Example: Code:
view_link = viz.link(sensor,viz.MainView) # Physical sensor is 0.05 m above and 0.02 m behind actual eye position view_link.preTrans([0.0,-0.05,0.02]) |
#3
|
|||
|
|||
Yes sensor has both position and orientation (IS-900).
I am trying to run this on update so that I can use the euler information to determine which directions to apply the translation. When I use preTrans the view flies off in one direction. I have tried subtracting the translation values from the preceding preTrans call, but that results in an accumulative translation error over time. I have also tried reseting each time before applying the preTrans. Both are commented out below. Thanks. Code:
import viz import viztask import math viz.go(viz.HMD | viz.STEREO) isense = viz.add('intersense.dle') track = isense.addTracker() main = viz.link(track,viz.MainView) def mainLoop(): yield viztask.waitKeyDown(' ') #Do Stuff xOffOld=0.0 zOffOld=0.0 hmdLength = .29 def setViewTrackCorrection(): global xOffOld,zOffOld #main.reset(viz.HEAD_POS) eul = main.getEuler() xOff = hmdLength*math.sin(math.radians(eul[0])) zOff = hmdLength*math.cos(math.radians(eul[0])) #main.postTrans([-xOffOld+xOff,0,-zOffOld+zOff]) main.preTrans([xOff,0,zOff]) xOffOld = xOff zOffOld = zOff vizact.onupdate(1,setViewTrackCorrection) viztask.schedule(mainLoop()) Last edited by Kaminski; 03-09-2011 at 11:12 AM. Reason: forgot import |
#4
|
|||
|
|||
My mistake, I didn't realize preTrans was applied before rotation. Thanks for the help.
|
#5
|
|||
|
|||
You should not call preTrans on every update. You only need to call it once when you initially setup the link.
Code:
import viz import viztask viz.go(viz.HMD | viz.STEREO) isense = viz.add('intersense.dle') track = isense.addTracker() main = viz.link(track,viz.MainView) main.preTrans([xoff,yoff,zoff]) def mainLoop(): yield viztask.waitKeyDown(' ') #Do Stuff viztask.schedule(mainLoop()) |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
display the position and euler coords of the main view | Josh | Vizard | 1 | 03-22-2010 11:48 AM |
View | nlfrnassimi | Vizard | 0 | 03-17-2009 03:01 AM |
View | nlfrnassimi | Vizard | 4 | 03-12-2009 06:25 AM |
default start position | erchrastil | Vizard | 2 | 06-23-2008 09:15 AM |
problem with stereo mode | shivanangel | Vizard | 3 | 10-17-2006 10:58 AM |