Personal tools
You are here: Home members Benoît Pin
Document Actions

Wiimotes external

by Benoît Pin last modified 2011-07-22 09:36 AM
Contributors: pinbe

An external that manage multiple wiimotes under mac, windows and linux

In brief

Wiimotes is an external that adds a [wiimotes] object in PureData. This object provides a support for multiple Nintendo wii remotes (aka wiimote). The wiimotes external is based on a modified version of the wiiuse library that adds Wii Motion Plus support (optional 3 axis gyroscopes) and Mac OSX support.

Install / downloads

The source code is available here: http://sourceforge.net/projects/fwiine/files/wiiuse/0.13/wiiuse_v0.13_src.zip
The archive contains the source code of the wiiuse library and the source of the external.
The next step after installation may be run this help patch: wiimotes-help.pd

Mac

You will find into the archive what is needed to compile the library with Xcode and some instructions in the README file.

Windows

Required compiled dlls are:
  • wiiuse.dll that you drop typically into C:\Windows\System32
  • wiimotes.dll that you drop typically into C:\Program Files\pd\extra (the PureData externals' folder)

Linux

There is a MakeFile, that has not been tested by us, to compile the wiiuse library. Furthermore, there is nothing specific to compile the external. Contributions are welcome!

Documentation

A [wiimotes] object accepts 2 optional parameters: 1– the number of wiimotes that you want to manage (default: 6); 2– the discovery time (default 5 seconds).

Once created, a [wiimotes] object provides one outlet per wiimote + a status outlet (on the most right). There is also one inlet to control the behavior of the wiimotes (see below).

Control messages


You typically start using [wiimotes] by manually switching on your wiimotes (press button 1&2 together) and sending a [discover( message. This phase will search your wiimotes around, and when completed, a message will be sent on the status outlet. This message could be "connected" with the number of devices or, if you are not lucky, "no-wiimote-found". You should be looking for the "connected" message before sending any other message. Under Windows, you need to manually pair your wiimotes one by one, via the Windows Control Panel.

The other control messages that you can send to the [wiimotes] inlet are:
  • [motion_sensing 1( / [motion_sensing 0(, respectively to switch on / off the motion sensing on each wiimote (motion sensing = built-in accelerometers);
  • [motion_plus_sensing 1( / [motion_plus_sensing 0(, respectively to switch on / off the motion plus sensing feature on each wiimote (motion plus sensing = gyroscopes provided by the MotionPlus wiimote extension);
  • [ir_sensing 1( / [ir_sensing 0( respectively to switch on / off the infrared tracking process (this option requires an external infrared bar).


Output messages from wiimotes outlets


The table below lists the messages that can be sent on wiimotes outlets. Obviously, accel, gforce, orient and gyro messages are emitted only if the corresponding modes are enabled or if optionnal accessories are present (Motion Plus, infrared bar).

Message Parameters Description
accel
3 floats for x, y, z
reports the raw acceleration on each axis
gforce
3 floats for x, y, z
reports the gravity projected on each axis
orient
3 floats for pitch, yaw, roll
reports pitch, yaw and roll based on a computation from accelerometers and IR data
(If the IR sensing is not enabled / availlable, the yaw parameter is 0)
gyro
3 floats for x, y, z
reports angular rotation speeds on each axis
wiimote_button_down
1 symbol
fires when a button is down. the symbol associated can be:
a, b, up, down, left, right, minus, plus, one, two, home
wiimote_button_up
1 symbol
fires when a button is up. the symbol associated can be:
a, b, up, down, left, right, minus, plus, one, two, home


Precautions

In the current state of developement, you should consider this piece of software as an experimental release. There are two issues that are not resolved yet:
  1. disconnection events from wiimotes are not handled;
  2. the [wiimotes] destructor is not correctly implemented.
Keep in mind that the discovery phase is a critical time: you should probably wait for the reception of the "connected" message on the status outlet before doing anything else. If the discovery fails (wireless technologies are sometimes a huge mystery…at least for me!), it's recommended to relaunch PureData instead of sending a new [discover( message.

Normally, if the discovery phase succeeds, you can use this external during hours!

Powered by IEM Powered by Plone Section 508 WCAG Valid XHTML Valid CSS Usable in any browser