PDA

View Full Version : Head motion tracking/Viewpoint


Elittdogg
08-31-2007, 07:24 AM
I'm very stuck stuck right now, so any help would be greatly appreciated.

Basically, I need to be able to get the program to display an image of a wall and while using FOB (Flock of Birds) to track head movement, I need the viewpoint to change along with the head movement. In other words, if I'm looking at the center of the wall and I need to look at the top left corner, I need to figure out how to get the viewpoint to change with my head movement.

So far this is what I have:

import viz

tex1 = viz.add('wall.jpg')
quad = viz.add(viz.TEXQUAD)
quad.translate(0,1,8)
quad.scale(12.8, 10.24)
quad.texture(tex1)

...

viz.reset(viz.HEAD_POS|viz.HEAD_ORI)
viz.translate(viz.HEAD_POS,data1[0],data1[1],data1[2])
viz.rotate(viz.HEAD_ORI,data1[5], (data1[4]+90) ,data1[3])

The problem is two-fold. When I run this, the picture looks like it's "tumbling" everywhere. Additionally, I also need to figure out how to program in an "inversion" to the tracking system. (Eg. So that when something comes in "physically" from the right field of view it looks as if it were coming from the left field of view and as if it were inverted). Do I just put a negative sign somewhere to flip it?

Any help would be appreciated. Thank you.

farshizzo
08-31-2007, 11:47 AM
Here is some code that will manually apply tracking data to the viewpoint:view = viz.get(viz.MAIN_VIEWPOINT)
def mytimer(num):
data = sensor.get()

view.translate(data[0],data[1]+1,data[2])
view.rotate(data[3],data[4],data[5])

viz.callback(viz.TIMER_EVENT,mytimer)
viz.starttimer(0,0,viz.FOREVER)If it still doesn't work, then you might have a problem with your hardware.

If you want to invert the left/right movement then negate the yaw component of the rotation data. So the above rotation command would look like the following:view.rotate(-data[3],data[4],data[5])