Welcome! Log In Create A New Profile

Advanced

Calculating distance between LEDs & Wiimote

Posted by Kovacs 
Calculating distance between LEDs & Wiimote
February 27, 2010 04:56PM
Struggling with LabVIEW trying to obtain the 3D position of the Wiimote I came across the following article.

Interactive 3D Design Using Nintendo Wii Remote

It gave me the following formulas in order to get the z-distance (distance between LEDs and the Wiimote).

Z-distance
ledDistanceInMM / (2 × tan (angle) × screenHeightInMM)

angle
(radiansPerPixel × pointDist) / 2

With my limiting programming skills I attempted to recreate this in LabVIEW, but first I had to come up with the correct numbers for some of the variables.

ledDistanceInMM = 194 (mm)
screenHeightInMM = 327.3 (mm)
radiansPerPixel = ((Pi/4) / 1024)

pointDist = Sqrt(dx * dx + dy * dy)
dx = firstPoint.x - secondPoint.x
dy = firstPoint.y - secondPoint.y

Now I didn't have the second points, but I did have the Midpoints. So I subtracted the Midpoints from the First points, multiplied the answers by 2 and then squared those numbers.

The end result looks like this:



It seems to work okay, but since I'm not too familiar with all this I might have made some errors.

Any thoughts are appreciated. =)
Thanks for your time.
Sorry, only registered users may post in this forum.

Click here to login