The SIXAXIS, or PS3 Controller, is intended to be a wireless Bluetooth HID device, which can also connect via a USB charge cable.
Unfortunately it is NOT a valid Bluetooth device, so it can’t connect to the PC via Bluetooth without rewriting the operating system. Rewriting the operating system is only an option on Linux.
So you can only use it with GlovePIE while it is plugged into a USB port with a USB charge cable. So it effectively becomes a wired controller instead of a wireless one.
If you don’t own a PS3, you will need to buy a USB charge cable. I bought a MadCatz one.
True to form, it is also NOT a valid HID device, so the only way to read it from Windows is by using a special driver called LibUSB-win32. This driver allows it to communicate with USB devices directly without going through the normal windows HID layer.
You can download LibUSB-win32 from here:
http://sourceforge.net/project/showfiles.php?group_id=78138 There are two varieties of LibUSB-Win32. There is a "Filter Driver", which allows the program to talk to any USB device but also allows Windows to talk to it at the same time. This means you can use the SIXAXIS with GlovePIE and as a normal joystick at the same time.
The other variety is the the "Device Driver", which is a replacement driver for that particular device, and only allows GlovePIE and other libusb-win32 programs to talk to that hardware. Windows will no longer be able to talk to that device if you use the device driver. The "Device Driver" works fine with GlovePIE (you will need PPJoy to use it as a fake joystick) but won't work with anyone else's sixaxis driver, because they rely on windows being able to talk to it.
On Windows Vista, I couldn't get the Filter Driver to install successfully, so you will probably need to use the "Device Driver" if you have Vista. On my Windows XP computer I got the Filter Driver to install, but it crashes whenever I run GlovePIE or any of the SIXAXIS drivers made by other people. However it must work for some people, because all the other sixaxis drivers say to use the Filter Driver. So if you are not using Vista, try the Filter Driver first.
The filter driver is easy to install. So you won't need any help with that.
The device driver is much harder to install. It comes with a program called "inf-wizard" in the "bin" folder. You need to run this program. Then you need to plug in your SIXAXIS into a USB port that you DON'T want to use for the SIXAXIS. Because windows will detect it and install its own driver on that port, stopping that port from working with LibUSB. If windows asks you about installing a driver when you plug it in, say no. Then press "Next" in inf-wizard. Then choose the device which says "0x054C, 0x0268" (your SIXAXIS). Then click next. You don't need to change the manufacturer name or device name unless you want to, so click next. Then it will pop up a save dialog box. You need to save it in the same bin folder where you ran inf-wizard from. It doesn't matter what you call it, but I called it "sixaxis-libusb.inf". If User Account Control won't let you save it in the bin folder, save it somewhere you can find it, and then afterwards copy the ".inf" and ".cat" files into the bin folder manually. You now have a libusb driver for the sixaxis ready to install. You can't install it by right-clicking, so instead go into Control Panel, Add [New] Hardware. Click Next. Choose to install the hardware from a list, Show all devices, have disk. Then browse to the bin directory. Then your libusb device driver should be installed. Now you need to plug your SIXAXIS into a port that you haven't plugged it into before, and it should work. To use it on a port that you have plugged it into before, you will need to remove the existing HID driver installed by windows.
Once you have got the libusb installed, and your sixaxis plugged into a new usb port, you should use the testlibusb-win program to test it. It should include the Sony Playstation 3 controller in its list. If it doesn't, and the driver says version -1,-1,-1,-1 it means the filter driver didn't install correctly, so you may want to uninstall it and either try again, or use the device driver instead. On the other hand, if the driver version is right, but the Sony playstation 3 controller isn't listed, try plugging it into a different port and running testlibusb-win again. If it doesn't show up in testlib-usb then it won't work with GlovePIE.
Once you have libusb-win32 working, you can run GlovePIE.
Using SIXAXIS in GlovePIE
The SIXAXIS won't do anything until you switch it on by pressing the PS button.
There is a chance glovepie will freeze up when you try to use the sixaxis due to a bug in Libusb-win32. This happened to me on my WinXP computer. If this happens then you won't be able to end the task in task manager, and you have to reboot. Uninstall the filter driver if this is happening and try the device driver.
When you start your script, you should leave the SIXAXIS sitting still for a few seconds while it calibrates the rate gyro so it can calculate Yaw. The SIXAXIS accelerometers should be calibrated first from the CP-Settings menu for this to work properly.
To read the raw accelerations, use SixAxis.RawForceX, Sixaxis.RawForceY, and Sixaxis.RawForceZ. When the sixaxis is in free-fall all the forces will be 0. When you hold it up against gravity, the force of you holding it up will be included, along with any actual accelerations. X means towards the right of the sixaxis (in the direction of the circle button), Y means towards the top of the sixaxis, Z means towards the front of the sixaxis (where the USB cable is).
You should not use the raw accelerations in your scripts. Instead you should go to the CP-Settings menu and choose SIXAXIS calibration. Then follow the instructions to calibrate all your SIXAXES. Once you have saved the calibration you will be able to use SixAxis.Roll, SixAxis.Pitch, SixAxis.SmoothRoll, and SixAxis.SmoothPitch to get the SIXAXIS rotation. You will also be able to use SixAxis.gx, SixAxis.gy, and sixaxis.gz to get the raw accelerations (including gravity) measured in Gs. You can then use SixAxis.RelAccX, SixAxis.RelAccY, and SixAxis.RelAccZ.
To read the analog sticks use SixAxis.Joy1x, Joy1y, Joy2x, and Joy2y. They are between -1 and 1. You can also read DPadX and DPadY the same way.
Pushing vertically down on the analog sticks gives you the L3 and R3 buttons. They are digital and can only be true or false. The Select, Start, and PS buttons are the same.
The other buttons can all be read as either analog or digital. The analog version will be between 0 and 1, and end with "Analog". The digital versions are true or false.
Sixaxis.yaw tells you the yaw angle. Unlike the pitch and roll, the absolute yaw can never be measured. The SIXAXIS uses a rate-gyro to measure the speed of yaw rotation, and keeps track of the yaw value based on yaw speed. If you rotate the SIXAXIS too fast, the gyro sensor will max out, and the yaw value will become incorrect. Also if you are tilting the SIXAXIS while you yaw it, the yaw value will also become incorrect.
Unlike pitch and roll, your script can set Sixaxis.yaw. Normally you will want to set it to zero when the user presses a button. For example:
If sixaxis.circle then sixaxis.yaw = 0
To calibrate the SIXAXIS gyro, you can read sixaxis.RawGyro. You can then set sixaxis.RawGyroZero to the value that corresponds to not rotating at all. You should do this if your yaw keeps drifting. Eg.
If sixaxis.square then sixaxis.RawGyroZero = smooth(sixaxis.RawGyro)
You can also read or set sixaxis.DegreesPerRawGyro if turning the SIXAXIS 180 degrees doesn’t turn the yaw by 180 degrees.
The SIXAXIS has 4 player LEDs, like the Wiimote. Unlike the Wiimote, these LEDs are controlled by a timer chip and can be set to flash at any rate, in any pattern.
Sixaxis.Led1Frequency = 10Hz
You can also make an LED turn itself off after a specific duration:
Sixaxis.Led1Duration = 1 second
You can set it to infinity if you want it to stay on:
Sixaxis.Led1Duration = infinity