Insight VR

Demo Disaster

by john on Apr.28, 2008, under Head Tracking, Lasers

So I did in fact present at Utah Code Camp. I happen to think that the presentation that I gave is, at its core, superior to the version that I gave at PyCon. It has most of what the PyCon presentation had plus:

  • a detailed look at the NumPy laser detection code – this was a Code Camp, so such things are expected I suppose
  • a demo of the Laser Missile Command game that uses the NumPy stuff
  • an overview of the wiiMote
  • diagrams that explain wiiMote headtracking in simple terms
  • a quick description of recursive OpenGL mouse picking
  • the code that performs headtracking – it is suprisingly short
  • a demo of the 3D game with both lasers and headtracking

In addition to all that, I had an entire hour to go over this stuff.

So why was this not the best presentation ever? Because the demos failed. And they failed in a way I had never seen before. The symptom was that the laser tracking seemed to be inverted on both the x and y axes and occasionally just crashed the program.

Having never seen this before I couldn’t figure it out. Especially not during the limited time frame that I had. I attempted to had the transform to flip both axes but that didn’t seem to work.

I came home and tried to figure it out more. I wondered if my iSight (which was clearly seeing lasers) was somehow screwed up and needed a reboot, but a reboot didn’t help.

Finally, while sleeping, I realized what the problem was: The calibration failed completely. To the point where none of the calibration dots were seen at all. Because of the way that calibration works this resulted in a sort of anti-calibration. Here’s the offending code:

def start_calibrate(self):
    self.calibrate =True
    self.top = 0
    self.bottom = 480
    self.left = 640
    self.right = 0

def push(self, xy_pair, flip_y=False):
# any pixels seen during calibration are used to define
# the limits of what the camera can see
    if self.calibrate:
        print "calibrating"
        x,y = xy_pair
        if y > self.top:
            self.top = y
        if y < self.bottom:
            self.bottom = y
        if x > self.right:
            self.right = x
        if x < self.left:
            self.left = x

So what is going on here? When calibration starts the code sets the self.top value to 0, which is the bottom and the self.bottom value to 480, which is the top. Same for left and right. Why? Because once the calibration dots are seen the guarantees that the y value of any dot will reset both top and bottom.

The problem is that this assumes that the calibration dots are in fact seen. In this case they weren’t. I assume that this is because I didn’t have my laptop far enough back, but I had thought that it was well-aligned based on what I could see with PhotoBooth. I have tested this at home and verified that it is the problem. If I hold my thumb over the iSight during calibration I get exactly the problem I had during the demos.

Now, why does this crash? Because the reverse calibrated translation can cause the laser equivalent of a mouse click outside the game world. I need to add some code to handle this.

One other small note. I has a volunteer do the headtracking demo. I should have done it myself since it takes some getting used to. It would have made for a more impressive headtracking demo. If only I had had more time. I had thought that an hour was plenty and it wasn’t quite enough given that there were issues.

I any case, I hope that those that were there got what they wanted out of the presentation which is the concepts behind the laser detection and head tracking. I apologize for the fact that the demo was less than spectacular.

No comments for this entry yet...

Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!