WMD
From WiiLi
Contents |
[edit] Introduction
WMD is a Linux Driver for the Nintendo Wii Remote. You can find it on this homepage: http://ForTheWiiN.org (currently not active)
[edit] Installation instructions
The WMD package supplies you with good instructions to get things working. Still, not all distro's are the same, and therefore here some additional clues to make the installation as painless as possible.
[edit] Dependencies
- Bluez standard
- pyBluez
- Python X Library 0.13 (a patch may be required, see instructions)
- Matplotlib (I've v0.87 installed and dont want to risk introducing problems with another project by installing v0.80. Can whatever problem with versions later than 0.80 be patched around?)
- PyOSD 0.2.14
- OSD 1.0
Debian/Ubuntu users may prefer to install through apt-get the following packages:
- bluetooth (for bluez, at least in Ubuntu 7.04)
- python-bluez
- python-xlib
- python-pygame
- python-osd
- python-matplotlib
- python-numpy
- python-numpy-ext
If you are doing it from scratch these notes may help you:
- I had never used bluetooth on Linux and hadnt any idea what I was doing. Downloading and installing the FULL set of libs and utils from Bluez, manually running 'ldconfig' afterwards (Id installed to /usr/local/lib), turning on the wiimote, and running 'hcitool scan' gave me my remotes id. Edited source with my id and up and running.
- If '/dev/misc/uinput' is missing:
- It may very well be on a slightly different location. See e.g. ubuntu below. You will have to edit wmd/Config.py
- I fixed this by using mknod e.g. 'mknod /somewhere/safe/uinput c 10 223' and updating the location in the source. Whether this was the best way to fix this I dont know (comments?). EDIT : Note I have to do this after each reboot (have put in a script)
- You put the WiiMote into discovery mode (or activate it) by pressing both the 1+2 buttons (or the red sync button).
- No mouse control? get it working by...plugging in the sensor bar (DoH!)
- Can't connect? you have changed the address in wmd/Config.py to the one displayed when you do hcitool scan | grep Nintendo? (the address of your WiiMote is not autodetected)
[edit] Distribution specific instructions
[edit] Ubuntu
[edit] Patch python-xlib
If you can't find display.py, it may be found (7.04) at this location: /usr/share/python-support/python-xlib/Xlib/protocol
Just search for self.socket.recv(2048) and change it into self.socket.recv(4096) save, and you're done (also described in the original instructions
[edit] Reference to uinput-device
If you use ubuntu, edit wmd/Config.py, you will find something like this:
#'UINPUT_DEV': "/dev/misc/uinput", #UINPUT_DEV: "/dev/input/uinput", ##ubuntu - you need to modprobe uinput first #UINPUT_DEV: "/dev/uinput",
edit and change it like this:
#'UINPUT_DEV': "/dev/misc/uinput", 'UINPUT_DEV': "/dev/input/uinput", ##ubuntu - you need to modprobe uinput first #UINPUT_DEV: "/dev/uinput",
Pay attention, you have to insert the character ' near UINPUT_DEV.
===== Other notes =====no
- Before using wmd, do modprobe uinput (sudo)
- Ubuntu Edgy (64): get the python2.4-xlib package instead of the python-xlib package. Note: There is no python2.4-xlib package for Edgy. However, using the one from dapper works just fine. Be sure to remove the python-xlib package before installing python2.4-xlib or it will conflict.
- If you are having trouble getting Ubuntu Feisty (64) from seeing you WiiMote try resetting your Bluetooth device (dongle). This can be done by typing:
hciconfig hci0 reset
Then rescan using:
hcitool scan
==== Fedora Core 5 (PS3) ====yes
I have gotten WMD to run on Fedora Core 5 on the PS3. First through an overly-elaborate UDP bridge program, then through a much easier way thanks to this web page which documents why PyBluez was unable to run on a 64-bit PPC machine. http://www.keshi.org/moin/moin.cgi/PS3/WiiRemote. --Grimli/_Fuse
[edit] (F)AQ
"Calculate position and velocity of wiimote by taking derivitave of force data. Is this feasable?"
- This is known as inertial positioning and only remains valid while the bounds of the accelerometer is not exceeded. Should that happen, you have no way of judging exact location. With a max reading of +/- 3G, the Wiimote is not well conditioned for this method of locating. ~Swatch
- This may not be a problem if there is an easy way to recalibrate the co-ordinates. eg, hold down home+b or something and point at the centre of the screen. Anyway, +/- 3G should be enough for every day use (presentations etc) if not for gaming. - porl
- Just wondering, for those of you who are working on the Mii's(uploading them to PC, changing them, etc.) is this what your looking for(the file) MicroStat II Data File, with it being .MII?
- The force, felt by the accelerometer in Wiimote, is proportional to acceleration. Acceleration itself is a derivative of velocity, so if you want to get velocity from acceleration, you have to integrate. In the integration process, you have a freedom of choosing an integration constant, which in this case corresponds to the initial constant velocity -- Wiimote cannot distinguish whether it is standing still or traveling with a constant velocity. Getting the position requires another integration, where you get another integration constant, this time corresponding to the initial position. Now, since Wiimote is not a point mass, you also need to take into account rotation (apart from the translatory movement). In general, this is impossible - what you want is getting six values from the three you have. For certain special cases, however, some approximations can be made -- which is I believe how this data is used in games.
[edit] Tested successfully with
[edit] Debian
- Debian Unstable with kernel 2.6.17.7 and this adapter
- Debian Unstable with kernel 2.6.21 and and a ISSCBTA adapter (KY-BT100) with buggy hwaddr 11:11:11:11:11:11
[edit] Gentoo
- Gentoo with kernel 2.6.18-gentoo-r3
- Gentoo with kernel 2.6.17-gentoo-r8 and this adapter
[edit] Fedora
- Fedora Core 6 with kernel 2.6.18-1.2868.fc6 and this adapter
[edit] SuSE
- (Mostly) Working on SuSE Linux 10 [D-Link DBT-120 adaptor]
[edit] Ubuntu
- Ubuntu 6.10 with kernel 2.6.17-10-generic and this adapter
- Ubuntu 6.10 with kernel 2.6.17-10-386 and this adapter
- Ubuntu 6.10 with kernel 2.6.17-10-generic on Toshiba Tecra M3 with built-in bluetooth (use 'toshset -bluetooth on' from [1] to turn on bluetooth first)
- Ubuntu 6.10 with kernel 2.6.17-11-generic and a MSI Starkey1.2 SE adapter
- Ubuntu 7.04 with kernel 2.6.20-12-generic and a ISSCBTA adapter (cheap Chinese USB-Bluetooth adapter)
- Ubuntu 7.04 with kernel 2.6.20-13-generic and this adapter
- Ubuntu 8.04.1 with kernel 2.6.24-22-generic and ID 0a12:0001 Cambridge Silicon Radio, Ltd. Bluetooth Dongle
[edit] Arch Linux
- Arch Linux with kernel 2.6.24.3-DIDI and Broadcom Corp. Bluetooth Controller
[edit] Feature Requests
- Split to multiple py files
- SVN/CVS server - easy updates, easy for people to contribute
- Easy way to switch configurations -- I might have a media-player config (for next/prev/volume/stop/etc), a NES-like config (d-pad rotated, A/B/START), and so on
- External config files (no need to copy & paste config every time upgrading WMD)
- Easy API for user-added Python scripts, so end-users can easily interface with their own apps, or write their own graphing / analysis methods, etc
- Sending mouse events in relative coordinates for use in FPS games and such
- Assigning certain gestures to certain buttons, for example for a drum simulator
- Easy to use GUI / System Panel to configure the various user options above
- Joystick emulation -- 1 or 2 axis, using gravity to determine orientation. For example to control driving games (hold remote like steering wheel), or flight sims (hold wiimote like it was an airplane) (Like FlightGear_with_Wiimote)
- Calculate position and velocity of wiimote by taking derivitave of force data. Is this feasable?
- Yes, it is quite possible. The velocity is the integrate of the acceleration and the position is the integrate of the velocity. Each integrate introduces drifting so forget about position reliability.
- Powersaving - disable IR / force sensing when not needed. Read button states less often (ok for things like using it as a remote to media player -- nobody cares if there is 0.1 delay to pause their music. not ok for playing games etc)
- Perhaps a port (eventually) by someone to some other fast compiled language? On a p3 1ghz i find it unusably slow without a priority of around -10. If it could be ported to C for instance, it could perhaps be run as a lower level daemon rather than having to run in a python interpreter. The code could be separated into a lower level driver daemon and a higher level interface (this could stay in python i suppose) to keep the codebase clean and fast. This may become more important as the algorithms become more sophisticated.
- Tilt/Jerks work as buttons to configure. I wrote a script which sends tilts as WM_BTs
- Optional Accelerometer mouse movement for people without sensor bars or the desire for engineering an alternative IR solution.
- GlovePIE compatibility so *Nix users can run those scripts as well.
[edit] Bugs
- Seems to lag a bit if you press a button repeatedly very quickly. -- I fixed this (I think) by commenting out a bunch of random time.sleep() commands
[edit] See Also:
- CWiid - Linux Wiimote driver
- GlovePIE - Windows Wiimote driver
- WiinRemote - Windows Wiimote driver
- RMX Automation - Windows XP Wiimote driver
- Remote Buddy - Mac OS X Wiimote driver
- DarwiinRemote - Mac OS X Wiimote driver
Windows
cWiimote | GlovePIE | RMX Automation | Wiim | wiimote-api | WiinRemote | WiimoteLib | WiiYourself!
Linux
CWiid | WMD | Perlwiimote | libwiimote | lg3d-wii| Python HTDP Driver
OSX
DarwiinRemote | Remote Buddy | The Wiinstrument | Wiiji (download)
Multiplatform
WiimoteCommander | OpenPIE | Wiimote_Simple | WiiremoteJ | wiiuse | WiiJuce | WiiuseJ | Wii Device Library
PyBluez Scripts: Wiiewer | Wiimotecomm


