Decoding a PS3 DualShock3 controller

(An update to this post is available here)

   I'm planning on using a Playstation dualshock 3 controller to control my ROV. It has all the features I could ever want, it's durable, it's rechargeable through USB, it also has bluetooth, and it's fairly inexpensive. Now that I have one, all I have to do is figure out how to read it. You can easily connect a dualshock to OSX 10.7 through bluetooth, no problems at all, but I haven't yet found a way to capture the raw data from it. OSX just says "connected" and I assume the controller will show up in videogames. I don't have any videogames so I don't know yet. In Linux I can't get it to connect via bluetooth, but I can read the raw data quite easily over USB. I can just use cat /dev/input/js0 or jstest --normal /dev/input/js0 to read the data in a test stream or I can run jstest-gtk to see everything in a nice little GUI.
   I used jstest and wrote the data to a file which I then imported into Excel. After a bit of sorting, I identified all the different buttons, axes, ranges, etc. At this point I only have one problem left, but it's a fairly big problem. I have no idea how to work with the six-axis motion control data. The dualshock 3 uses four sensors to monitor six axes, so each of twelve directions (two directions on each axis) is measured by a combination of one or two sensors. Testing all the axes and directions, you end up with this:

(hi-res image lost)
This chart shows the output of the four motion sensors for all twelve directions of motion. I wrote down all the movements to be performed ahead of time so I would know what each spike represents. Assuming that x is to the right, y is forward, and z is up, and that the normal, level position of the controller represents zero on all axes, we get the following relationships:

-a24 & +a25 = -x rotation
+a24 & +a25 = +x rotation
+a25 = -y rotation
-a23 & +a25 = +y rotation
+a26 = +z moment
-a26 = -z moment
-a23 = +x movement
-a23 & -a26 = -x movement
-+a24 = -y movement
+-a24 & -a26 = +y movement
-+a25 = +z movement
+-a25 = -z movement

I would need to do more tests to see how accurate this analysis is. I would need more and more precise data to actually do anything with it. I don't actually need the six-axis sensors so I probably won't put much more time into it, but it would be interesting to see where I could go.