WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-24-2009, 12:45 PM
Arandia Arandia is offline
Member
 
Join Date: Aug 2009
Posts: 2
Head tracking, Flock of Birds and vizcave; how do I connect them?

Hello,

I've been struggling with this problem for a while now. I have an Ascension Flock of Birds (FoB), which I am using to collect the position of the user's head when they're wearing it. I've got it up and running inside Vizard; on that, no problems.

My problem is related to how to use the FoB data to create an illusion of 3D space via headtracking - somewhat similar to what Johnny Lee did here (Youtube link).

I've tried using the vizcave module to interpret this data, so as to avoid having to shift object positions manually, etc, etc. My first problem appears to be that I am initializing the cave wall wrong - I have captured the positions in FoB space of the corners of my monitor, and fed them into vizcave.Wall().
Code:
self.__cave = vizcave.Cave()
wall = vizcave.Wall(upperLeft  = (-.1585, .3409, .1739+.05),
                    upperRight = ( .1959, .3339, .1852+.05),
                    lowerLeft  = (-.2029, .0795, .1459+.05),
                    lowerRight = ( .2169, .0782, .1593+.05))
self.__cave.addWall(wall)
The '+.05' is because I measured to 5 cm away from my screen, to avoid magnetic irregularities. However, when I run this by itself, I get a slanted view out. However, it seems to me that it should start out looking straight ahead - I've done nothing else to rotate or change the field of view. I've corrected the FoB coordinate system to match with Vizard, but I'm guessing the little differences in the measurements were enough to torque the view? Is there any way around this, or am I feeding vizcave.Wall() all the wrong data?


I have a function that is registered to be called on every viz.UPDATE_EVENT, that eventually runs "self.__cave.update(pos=aPos)", where aPos is a vector specifying how far the user's head has moved since the simulation began. This gives me my second problem - while moving the FoB sensor left and right causes my display to sway left and right, it doesn't do it appropriately for a 3D illusion. In other words, what I'm trying to achieve is to have the display look as though it is a window into the vizard world, so that as you move your head left and right elements on the screen shift appropriately, with ones farther from the screen shifting more. Vizcave seems to just shift all elements uniformly, regardless of their position. Is it even supposed to do what I'm looking for, or am I simply doing something wrong? Again, I'm pretty sure I've already accounted for the differing coordinate systems, so I don't think it's the data I'm feeding it.

My last (and probably biggest) problem is that the ultimate goal of my project is to get this headtracking simulation running on an Elumens curved display dish. I can get the display to be correctly distorted with the 'spi' module, but rather unfortunately I found that running the spi and vizcave modules simultaneously seems to cause the vizcave module to stop working completely. I'm using the latest version of Vizard (3.14.0004). Is there any way around this problem, or am I really wasting my time with the vizcave module? The only other solution to this problem I can see involves manually modifying the positions of all the world elements every frame update, but this would certainly be a slow and labourious process. Is there any other way to screw with the display frustum?

Thanks for any help on these matters.
Attached Thumbnails
Click image for larger version

Name:	Slanted.PNG
Views:	1755
Size:	11.8 KB
ID:	339  
Reply With Quote
  #2  
Old 08-25-2009, 09:40 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Did you follow the single display example on the vizcave documentation page? What you are trying to accomplish seems very similar to that example. It sounds like you are not properly attaching the tracker to the viewpoint. Your cave setup code should look something like this:
Code:
cave = vizcave.Cave()
wall = vizcave.Wall(upperLeft  = (-.1585, .3409, .1739+.05),
                    upperRight = ( .1959, .3339, .1852+.05),
                    lowerLeft  = (-.2029, .0795, .1459+.05),
                    lowerRight = ( .2169, .0782, .1593+.05))
cave.addWall(wall)

fobTracker = .... #Code that creates FOB tracker

# Automatically update the cave with the tracker
cave.setTracker(pos= fobTracker )

# CaveView object is used to manipulate viewpoint origin within cave
caveorigin = vizcave.CaveView(fobTracker)
You don't need to manually update the cave, the cave.setTracker command will do this for you. If your virtual viewpoint origin differs from the physical tracker origin, then you can use the caveorigin object to change it. The object behaves like a standard node objects so you can call setPosition, setEuler, etc...

The SPI module handles the projection matrices itself, so it won't work with vizcave. Also, vizcave is meant to work with projections on flat surfaces, so a curved surface like the Elumens dish will not be compatible with it.
Reply With Quote
  #3  
Old 08-26-2009, 04:59 PM
Arandia Arandia is offline
Member
 
Join Date: Aug 2009
Posts: 2
Hi Farshizzo,

Thanks for the response. Fortunately, I think I've found a way to do what I was wanting to do. Turns out the problem wasn't to do with how I was linking the things together; rather, it was that I needed to do a viz.MainWindow.move() command in addition to moving the cave walls to get the effect I needed.

In any case - I noticed that the 'spi' module gives me access to a 'frustum' method, much like viz.MainWindow. And in fact, I've been using the viz.MainWindow.frustum() method directly rather than the cave module. Can I not get a very similar effect for the spi module by simply playing with these clipping planes? Clearly there will be some accuracy issues when projecting things onto the curved Elumens dish, but I'm thinking that some semblance of headtracking is better than none.

Instead of using cave, this is essentially what I'm doing. Edited quite heavily for succinctness and clarity, and in no ways finished yet.
Code:
class bird:
  def __init__(self):
    if DISTORT:
      import spi
      self.window = spi
      self.frustum = {'left':-1, 'right':1, 'bottom':-1, 'top':1, 'near':.1, 'far':100}
    else:
      self.window = viz.MainWindow
      self.frustum = {'left':-.041, 'right':.041, 'bottom':-.0365, 'top':.0365, 'near':.1, 'far':100}

  def modify(self):
    '''This gets called on every screen update...'''
    # Get the data from the Flock of Birds
    pos, ori = self.getData() # This isn't an issue...

    dPos = [FLOCK_SCALE*(pos[i] - self.__lastPos[i]) for i in range(3)]
    dPos[0] *= -1
    dPos[2] *= -1

    self.__lastPos = pos

    # Don't update the view if we just had a sudden jump, like switching hemispheres...
    if max(dPos) > FLOCK_JUMP_LIM or min(dPos) < -FLOCK_JUMP_LIM: return

    # Move the camera in the *opposite* direction...
    viz.MainView.move(*dPos)

    # Account for left/right shifts
    self.frustum['left'] -= FRUSTUM_RATIO*dPos[0]
    self.frustum['right'] -= FRUSTUM_RATIO*dPos[0]
    # Account for up/down shifts
    self.frustum['top'] -= FRUSTUM_RATIO*dPos[1]
    self.frustum['bottom'] -= FRUSTUM_RATIO*dPos[1]
    # Readjust the frustum
    self.window.frustum(**self.frustum)

Last edited by Arandia; 08-26-2009 at 05:07 PM.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:45 PM.


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