9DOF sensor headtraking mathematical problem... how to get pan/tilt/roll?

Well I need some help here, I just purchased a 9DOF GY85 from dx.com
it took me a long time to get al the i2c adreses to read it on the arduino, send the data to 4v was easier (tnks colorsound!) , but now i have a harder problem,

I want to create a kind of Oculus Rift glases, i already have the cheap sony glasstron and all the hardware connected, the problem here is the math to solve the camera position. I have the Tilt and Roll from the gyros, but i need the Y rotacion, i mean, the magnetic reference.

Check out this video http://www.youtube.com/watch?v=9TGUUd2ZDc0 min 2:10
from the 9 bars, check out the last 3, those are the mag, and the the compass. It super aquare, but there is no linear connection between any of the 3 axes magnetometer data to the compass… so, what is the math involved here ?

i also found that it can be done without magnetrometer data

any idea where to look for this ?

Basicaly, i have the 9 chanel data, and i want to do this

i found a long document about this, http://kom.aau.dk/~nfog04/imu/Articles/26%20Quaternion-Based%20Extended%20Kalman%20Filter%20for%20Determining%20Orientation%20by%20Inertial%20and%20Magnetic%20Sensing.pdf

any other way of doing it ?

Hey Andreas, you have to record that data in to txt file like:
x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3 …
x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3 …
separated by linefeed
it don’t have to be alot, around 200-300 frames (don’t forget to set mainloop to something like 15). Also check if the output is exactly same values you get from controller. And would be also nice to have some video record from phone, for instance, of what you doing during that time. Then might be possible to help you.