After a lot of fiddling about on Max5 and testing different hardware, I have had a breakthrough! I have now successfully got a Wiimote to not only ‘see’ and follow 4 IR LEDs, but also return the values into Max5!
Below is a crude(!) video taken on my old-as iPhone 3G, showing the tracking as I move the Wiimote around:
The next step in my development is to use triangulation to determine the distance between the Wiimote and the LEDs, in such a way that I can change the configuration depending on the fixed distance between the LEDs.
If i were just moving the Wiimote along a single axis towards the LEDs, then the calculations would be very simple, but nothing in my life is that simple! Not only is the positional and spacial relationship between the 2 objects 3-dimensional, but the rotation (pitch, roll and yaw) of the LEDs (or in this case, the Wiimote) is also 3-dimensional and it is here that lies the problem.
If the 4 light sources are close together, there could be 2 possible senarios:
- The LEDs are far away
- The LED array has been tilted so that the angle of incidence is very small
A successful and stable solution for this has not yet been created. Until now…maybe!
Because the IR camera on the front of the Wiimote is of such a high quality (1024 x 768px!) with a narrow viewing angle (~45°) it suffers foreshortening much more pronounced and acurately reproduced than that of a normal webcam. This means that if the sensor is far away from the source, the distance between the points will be small, but consistant between them. If the sensor is tilted, the distance between the 2 leftmost points will differ from that of the 2 rightmost. There is a value returned for the size of each of the light points, but this is inacurate and unstable due to the narrowviewing angle of the LEDs. I am currently looking into way to increase the viewing angle of the IR LEDs, which will help the accuracy and reliability of the values returned.
Finally, credit where credit is due. Thank you to Alex Harker for the updated ajh.wiiremote Max5 patch: http://cycling74.com/forums/topic.php?id=22500