General Wiimote and Technology > Project Ideas

Dual Wiimote 3DOF single IR source tracking

**nebulus**:

Hi All

Here is a very brief video of a demo I'm working on that uses dual wiimotes to track an IR source in 3D.

The blobs in the video represent the positions of the Wiimotes, and the line coming from the blobs show the direction of the source. The source is represented as a 3-axis cross, and a trail showing where it has been over the last 120frames.

[youtube]http://www.youtube.com/watch?v=c9eOq-cSdSM[/youtube]

The tracking is pretty responsive, but a bit noisy due to the data from the wiimotes being a bit jittery and could do with some smoothing.

The application is running on Ubuntu 7.10 using the libwiimote library, FLTK and OpenGL.

Next steps to get it smooth, add more IR sources, and add more wiimotes to increase the range and accuracy.

**atomriot**:

Great job!

that looks pretty neat. But i am sure you are going to (if you have not already) get battered with a plethora of questions asking for that in windows.

Do you have your source available somewhere or is it going to be available somewhere?

**nebulus**:

The app in the video is integrated into a much bigger project that I can't easily opensource, but the ideas and code behind this little section to do the tracking is pretty trivial.

If anyone is interested I can write up what I've done and post it ...

**Helza**:

If you could release the code just belong to this part that would be great :)

**nebulus**:

Rather than releasing the code, I think the algorithm is more interesting to release, and its really very easy.

What I'm doing is some simple ray intersection calculations to approximate the position of the IR source.

Take a look at this page, for finding the shortest line between two lines.

http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline3d/

In my code I'm making a line that starts at the wiimotes position, and calculating a direction vector from the wiimote IR data. Due to the orientation of the wiimote I do a rotation of the direction vector, (in my this case 45 degrees). Now adding the direction vector and the start position gives another vector that I use as the end point of the ray. Repeat for the other wiimote and you should have two line definitions, these can be fed into the equation from the above link.

So from the drawing on that link you can imagine wiimote 1 has the line P1->P2 and wiimote 2 P3->P4

Now you'll get a line back from that equation, all I'm doing is using the midpoint from that line as the position of the IR source.

So effectively calculating a point directly between Pa and Pb.

This approximation is good enough as a starting point, there are probably some extra information that could be derived from the length of the line that the equation returns, which will help in error analysis.

Navigation

[0] Message Index

[#] Next page

Go to full version