Wii Mote Paper 1

8
   Abstract Although the approach to tracking the Wiimote in 3D space has been completed by Dr. Oliver Kreylos, his algorithm has not been evaluated for its accuracy. Identifying this is crucial in determining whether or not the Wiimote is capable of functioning as an alternative 3D input device in a virtual reality environment. The following report will summarize Dr. Oliver Kreylos’ method for calculating the Wiimote’s position and orientation in 3D space. Furthermore, to test the accuracy of the Wiimote tracking algorithm, data from the Wiimote tracking program will be compared with data from Phasespace, a commercial motion tracking system. Finally, we have determined that the error of the Wiimote tracking program is 2 cm, making the Wiimote a suitable 3D input device for determining hand gestures that control view angle, menu selection, moving objects, etc. Introduction: Using the Wiimote’s built-in camera, the position and orientation of the Wiimote in 3D space can be calculated by tracking four known infrared LEDs positions and then relating these values to the reported position retrieved from the Wiimote’s camera. In other words, given a global and local coordinate system, we can set up an expression that linearly transforms an IR LEDs from a know position in the global coordinate space into the Wiimote’s local camera’s coordinate space. Solving these equations will give the position of the Wiimote. [2] Combining the data from the built-in accelerometer provides orientation, turning the Wiimote into a 6 degrees tracking device. [3] The IR LED Beacon A couple of parameters must be defined in order to understand how the equations are set up. First a homemade IR LED beacon must be constructed using four high-output 940nm IR LEDs, and a 9 volt battery. The four IR LEDs and the 9 volt battery are connected in series and mounted onto a platform. The figure below shows how the beacon is constructed. [2] My circuit setup is different from Oliver’s setup because the IR LEDs and the 9 volt battery are connected in series. Setting up the beacon this way causes the IR LEDs to glow intensely which allows the Wiimote to be tracked at greater distances. However, the drawback of this design is that it drains the 9 volt battery rapidly. For testing purposes, tracking greater distances is desired since dimly lit IR LEDs limits the Wiimote tracking range. Additionally, the four IR LEDs must be arranged in a tetrahedral and not planar. Let us select the origin of the beacon coordinate system to be centered along the back side of the beacon and then call this coordinate system the global coordinate system. The x axis is horizontal and the z axis is vertical while the y axis is perpendicular and away from the x and z axis. The position of each of the IR LEDs must be accurately measured from the origin and should be noted as (x, y, z). The coordinates for my four IR LEDs have the positions (6.25, 5.56,

Transcript of Wii Mote Paper 1

Page 1: Wii Mote Paper 1

5/8/2018 Wii Mote Paper 1 - slidepdf.com

http://slidepdf.com/reader/full/wii-mote-paper-1 1/8

 

Dr. Oliver Kreylos’ Wiimote Tracking Algorithm and its LimitationsPhong Vuong, Dr. Gregorij Kurillo, Dr. Ruzena Bajcsy

 

Abstract

Although the approach to tracking the Wiimote in 3D space has been completed by Dr.

Oliver Kreylos, his algorithm has not been evaluated for its accuracy. Identifying this is crucialin determining whether or not the Wiimote is capable of functioning as an alternative 3D input

device in a virtual reality environment. The following report will summarize Dr. Oliver Kreylos’

method for calculating the Wiimote’s position and orientation in 3D space. Furthermore, to test

the accuracy of the Wiimote tracking algorithm, data from the Wiimote tracking program will becompared with data from Phasespace, a commercial motion tracking system. Finally, we have

determined that the error of the Wiimote tracking program is 2 cm, making the Wiimote a

suitable 3D input device for determining hand gestures that control view angle, menu selection,moving objects, etc.

Introduction:

Using the Wiimote’s built-in camera, the position and orientation of the Wiimote in 3D

space can be calculated by tracking four known infrared LEDs positions and then relating these

values to the reported position retrieved from the Wiimote’s camera. In other words, given aglobal and local coordinate system, we can set up an expression that linearly transforms an IR

LEDs from a know position in the global coordinate space into the Wiimote’s local camera’s

coordinate space. Solving these equations will give the position of the Wiimote. [2] Combiningthe data from the built-in accelerometer provides orientation, turning the Wiimote into a 6

degrees tracking device. [3]

The IR LED Beacon

A couple of parameters must be defined in order to understand how the equations are setup. First a homemade IR LED beacon must be constructed using four high-output 940nm IR

LEDs, and a 9 volt battery. The four IR LEDs and the 9 volt battery are connected in series and

mounted onto a platform. The figure below shows how the beacon is constructed. [2]

My circuit setup is different from Oliver’s setup because the IR LEDs and the 9 voltbattery are connected in series. Setting up the beacon this way causes the IR LEDs to glow

intensely which allows the Wiimote to be tracked at greater distances. However, the drawback of 

this design is that it drains the 9 volt battery rapidly. For testing purposes, tracking greater

distances is desired since dimly lit IR LEDs limits the Wiimote tracking range. Additionally, thefour IR LEDs must be arranged in a tetrahedral and not planar.

Let us select the origin of the beacon coordinate system to be centered along the back side of the beacon and then call this coordinate system the global coordinate system. The x axis

is horizontal and the z axis is vertical while the y axis is perpendicular and away from the x and z

axis. The position of each of the IR LEDs must be accurately measured from the origin and

should be noted as (x, y, z). The coordinates for my four IR LEDs have the positions (6.25, 5.56,

Page 2: Wii Mote Paper 1

5/8/2018 Wii Mote Paper 1 - slidepdf.com

http://slidepdf.com/reader/full/wii-mote-paper-1 2/8

 

0.0) cm left, (0.0, 11.04, 4.24) cm top, (-5.78, 5.739, 0.0) cm right, and (0.0, 10.13, -4.10) cm

bottom.

Figure 1. IR LED Beacon

The Wiimote

The Wiimote houses a 128X96 monochrome camera with an 8x subpixel analysis to

provide 1024X768 resolution tracking. [7] The camera’s CCD (charge-coupled device) imagesensor filters up to four infrared light sources and then returns their position on the CCD (imageplane) as pixel coordinates. Let us define the camera’s coordinate system in such a way that the

origin coincides with the camera’s focal point. Since the IR beacon coordinate system has the x

axis as being horizontal, the z axis as being vertical and the y axis as being orthogonal to both,the camera’s coordinate system will follow the same configuration. Additionally, let us define

the center of projection of the focus point to be the orthogonal projection of the focus point onto

the camera’s image plane. Assuming that the focus point is at the center of the camera’s lens, its

orthogonal projection onto the image plane is (512, 384). To find the camera’s focal lengthsimply use similar triangles. This is done by positioning two IR LEDs apart with some measured

distance d. Given that the camera’s distance from the IR LEDS is L, and that the reported

distance of the IR LEDS on the camera’s image plane is x, then the focal distance fz is (L*x)/d.A good estimate value for the focal length is 1280 pixel. [5]

The Tracking Algorithm

The tracking algorithm relies on some knowledge of 3D geometric rotation between two

coordinate spaces. Rotation in 3D spaces can be accomplished using a regular 3X3 rotational

matrix however, this approach requires 9 parameters. A better approach to 3D rotation is the useof quaternions which require only 4 parameters. A quaternion is a complex vector written as

having (x, y, z, w) where x, y and z represents the vector and w is a scalar quantity. Additionally,

Unit quaternions have a property where x*x + y*y + z*z + w*w = 1. [1]

To obtain the position and orientation of the Wiimote, let us define the global point  p =(px, py, pz) to represent the position of the origin of the Wiimote’s local camera coordinate

system. Keep in mind that the focal point of the Wiimote camera is defined as the origin of thelocal coordinate system. Thus, the quaternion o = (ox, oy, oz, ow) is a unit quaternion and

represents the orientation of the local coordinate system with respect to the global coordinate

system Solving for both p and o will give the position and orientation of the Wiimote.Let us define a point a = (ax, ay, az) in local coordinates that represents the position of a

single IR LED on the beacon. Its position in global coordinates is known and is presented as A =

Page 3: Wii Mote Paper 1

5/8/2018 Wii Mote Paper 1 - slidepdf.com

http://slidepdf.com/reader/full/wii-mote-paper-1 3/8

 

(Ax, Ay, Az). To transform the coordinate point a = (ax, ay, az, aw) from local coordinate

system to global coordinate system, point a must be rotated by quaternion o and then translatedby point p.

Rotating point a with orientation o results in a new point a’ = (ax’, ay’, az’) which is

given by:

a’ = o*a*o’

Where a is a quaternion [a = (ax, ay, az, 0)] and o’ is the conjugate of o, o’ = (-ox, -oy, -oz, ow).

Solving for o*a results in ro = (rx, ry, rz, rw) : [4]

rx = ow*ax + oy*az – oz*ay

ry = ow*ay – ox*az + ow*ax

rz = ow*az + ox*ay – oy*axrw = -ox*ax – oy*ay – oz*az

Solving for ro*o’ results in a’:

ax’ = rw*ox + rx*ow - ry*oz + rz*oy

ay’ = rw*oy + rx*oz + ry*ow - rz*oxaz’ = rw*oz – rx*oy + ry*ox + rz*ow

Translating the point a’ = (ax’, ay’, az’) to global point A = (Ax, Ay, Az) is done by:

A = p + a’

Ax = px + ax’

Ay = py + ay’Az = pz + az’

Where p = (px, py, pz) is the position of the origin of the local coordinate system in terms of theworld coordinate system.

Since the global point A = (Ax, Ay, Az) is a known value and represents the position of 

an IR LED measured from the origin of the beacon, let us instead solve for the point a = (ax, ay,

az) which is the local point of A in terms of the cameral coordinate system. Taking the inverse of the translation from above gives the equation:

a = o-1

(A – p)(o’)-1

Finally, let us project the local point a = (ax, ay, az) onto the camera’s image plane. Given the

value of a as described earlier, and the focal point f = (fx, fy, fz), the projection equations are asfollows:

x = (ax*fz)/ay + fxy = (az*fz)/ay + fy

Page 4: Wii Mote Paper 1

5/8/2018 Wii Mote Paper 1 - slidepdf.com

http://slidepdf.com/reader/full/wii-mote-paper-1 4/8

 

Where the coordinate (x,y) represents the projection of an infrared light source onto the image

plane and can be retrieved from the Wiimote. Since the Wiimote can track up to four infraredlight sources, the total number of equations is nine, two projection points for each infrared light

source, and one equation satisfying the unit quaternion constraint ox*ox + oy*oy + oz*oz +

ow*ow = 1. With nine equations and seven unknowns (px, py, pz, ox, oy, oz, and ow) the system

of nonlinear equations can be solved using a variety of methods. The method that Oliver haschosen for his tracking algorithm is the Levenberg-Marquardt minimization method. [7] This

method works well since it minimizes the residual distance between the measured position of theIR LEDs and the position reported by the camera. The minimization is done iteratively and

performs wells in this tracking application where the parameters change constantly. [2]

Evaluating the Accuracy

To determine the accuracy of the Wiimote tracking algorithm, the Phasespace system is

used as a basis for tracking the position of the Wiimote in 3D space. By comparing both the datafrom the Phasespace and data from the wiimote, we can determine the residual distance between

the report position from the wiimote and the reported position from the Phasespace.The Phasespace system uses 8 cameras to track the position of any number of speciallydesigned infrared markers. To track the Wiimote, three Phasespace markers are arranged in a

triangle along the back side of the Wiimote IR beacon. One of the Phasespace IR LEDs is

positioned at the origin of the IR beacon coordinate system while the other two are placed at thetop left and right corners. Three more Phasespace IR LEDs are taped onto the top of the Wiimote

and are arranged in a triangle with one LED taped at the head of the Wiimote above the camera.

Figure 2. Markers on the Wiimote and IR Beacon

Once data has been collected with the Phasespace system, the data points must be

transformed into the beacon coordinate system to simplify the analysis. Since the IR LED beaconhas three markers on the back, it is enough to define three basis vectors that span the beacon

coordinate system. Using some simple linear algebra, we can set the origin of the IR beacon to

coincide with the origin for the Phasespace coordinate system. Finally we transform the data

points of the Phasespace markers taped the Wiimote to the new origin of the Phasespacecoordinate system by doing a linear transformation.

Page 5: Wii Mote Paper 1

5/8/2018 Wii Mote Paper 1 - slidepdf.com

http://slidepdf.com/reader/full/wii-mote-paper-1 5/8

 

Results

To see whether the Wiimote can provide adequate tracking, I held the Wiimote stationary

for a couple of minutes, collecting data from the Wiimote tracking software and the Phasespace

tracking system. The graph below compares data from both systems.

Figure 3. Notice the center is at the blue circle. The yellow line represents the x,y position of theWiimote when held stationary. The red line is the tracking data from the Phasespace.

Using Mat Lab I graphed the x coordinate with respect to time of the Wiimote data and

compared it to the x coordinate values for the Phasespace data. The figure below shows thegraph of the data set. The black smooth line is the Phasespace data, the blue jagged line is the

Wiimote data.

Figure 4. Notice how the data is off by a couple of centimeters.

In order to get the standard deviation from the Wiimote tracking data, I sliced the graph above

and calculated the standard deviation of a sub interval. The calculations show that the standard

deviation is roughly 8.1280mm from the average. Using 2.576 times the normal standard

deviation the error for the X position is roughly 20.3200mm. The offset from the Phasespacedata to the Wiimote data is about 23.3700mm.

Repeating the same procedure for the X position graph, I contrived the following graphs for theY and Z position respectively.

Page 6: Wii Mote Paper 1

5/8/2018 Wii Mote Paper 1 - slidepdf.com

http://slidepdf.com/reader/full/wii-mote-paper-1 6/8

 

 Figure 5. Notice how the jagged blue lines are spread out and vary between high and low

values.There is an offset between the Wiimote data and the Phasespace data.

For the Y position graph, the standard deviation is 7.6548mm, the error is 19.135mm and the

offset is 49.3189mm

Figure 6. The z axis is the distance away from the beacon. Even though the lines do not match

one to one, you can see that the relative motion is the same.

For the Z position graph, the standard deviation is 5.2537mm, the error is 13.13425mm, and theoffset is 28.3000mm.

To see how well the Wiimote tracking software handles tracking other than stationary, I

moved the Wiimote in a circle while keeping the camera focused on the IR beacon at all times.

This will ensure that all four IR LEDS are picked up by the camera. I notice that if the cameraspots anything less than four IR LEDS, the tracking accuracy diminishes.

Figure 7. This graph shows the X, Y and Z position of the Wiimote tracking software data

(yellow line) and the Phasespace data (red line). Notice how the lines almost match. This shows

that the Wiimote tracking software can track motion and position fairly well.

Page 7: Wii Mote Paper 1

5/8/2018 Wii Mote Paper 1 - slidepdf.com

http://slidepdf.com/reader/full/wii-mote-paper-1 7/8

 

The following graph breaks down the X,Y and Z position of the Phasespace data and the

Wiimote data with respect to time. This is to show how close the data is compare to one another.

Figure 8. This graph shows the X position with respect to time. Once again the solid blue lines is

the Wiimote data and the smaller line is the Phasespace data. Notice how the motion in the X 

 position is followed fairly closely with some offset.

Figure 9. This graph shows the Y position with respect to time. In this graph the offset is large

however, the motion continues to be quite similar.

Figure 10. This graph shows the Z position with respect to time. In this graph the offset is very

minimal, in fact the two curves are actually lining up almost one to one. It is clearly shown here

that the Z direction for both the Phasespace and the Wiimote data follow each other closely.

Page 8: Wii Mote Paper 1

5/8/2018 Wii Mote Paper 1 - slidepdf.com

http://slidepdf.com/reader/full/wii-mote-paper-1 8/8

 

Conclusion

We can observe from the results that the Wiimote tracking program is able to track the

Wiimote in 3D space. The overall accuracy of the Wiimote data is around 2cm. Although the

error may not be adequate in situations where accuracy is important, the Wiimote is a suitable

alternative device for modifying the 3D camera in the virtual reality environment or positioningobjects in the 3D space.

What is important to note is that if I move the Wiimote around, the tracking program cancontinue to track its position. As you can see from the circular motion in the data graph above,

the Wiimote data displays the same circular motion as the Phasespace data. Thus tracking the

relative motion such as moving the Wimote forward and backwards and side to side is relativelyaccurate. Such motion is good for modifying camera angles and positioning 3D objects.

Many parameters may affect the Wiimote tracking program from being highly accurate.

First, the camera’s resolution is small contributing to the loss in precision. Second, the infrared

LEDs on the beacon may not be measured accurately, which adds to the error. Lastly, not all fourinfrared light sources were detected during the entire motion of the Wiimote tracking. Detecting

anything fewer than four infrared light source greatly increases the error. Even though the erroris 2cm, the Wiimote is suitable for the tele-immersion system and will perform adequately as a3D input device.

References

[1]  Choe, Su B., and Julian J. Faraway. Modeling head and hand orientation during motion using

quaternions. Tech.No. Automotive Engineers, University of Michi. Maths.bath.ac.uk. 5 Aug.

2008 <http://www.maths.bath.ac.uk/~jjf23/papers/dhm04.pdf>.

[2]  Kreylos, Oliver. "Oliver Kreylos' Research and Development Homepage - Wiimote Hacking."

Wiimote Hacking. 7 July 2008. 5 Aug. 2008

<http://graphics.cs.ucdavis.edu/~okreylos/resdev/wiimote/index.html>.[3]  "Motion analysis." WiiLi.org Wii Linux. 5 Aug. 2008

<http://www.wiili.org/index.php/motion_analysis>.

[4]  "Normalizing a quaternion." GameDev.net. 5 Aug. 2008<http://www.gamedev.net/reference/programming/features/quatcam/page2.asp>.

[5]  Owens, Robyn. "Image formation in the eye and the camera." 29 Oct. 1997. 5 Aug. 2008

<http://homepages.inf.ed.ac.uk/rbf/cvonline/local_copies/owens/lect1/node2.html>.

[6]  Pujol1, Jose. Rep.No. GEOPHYSICS. Scitation.aip.org. July-Aug. 2007. 5 Aug. 2008<http://scitation.aip.org/getpdf/servlet/getpdfservlet?filetype=pdf&id=gpysa700007200000400

00w1000001&idtype=cvips&prog=normal>.

[7]  "Wiimote." Wiibrew. 5 Aug. 2008 <http://wiibrew.org/wiki/wii_remote#ir_camera>.