Quaternions and accelerometer

Ian Bloomfield's icon

Hi,

I created a project using a 9DOF acc/gyro/mag for a research project I was doing. I managed to bodge together the maths and learn enough MAX programming to complete that, now the plan is to move onto a follow on study. The issue I have is that the device now needs to be able to record in 3 axis of rotation.

I think I ended up with some sort of Euler angles and then a complimentary filter combing the gyro and acc values.
but since this new project involves more angles of rotations I think Quaternions would be the way to go.

My maths nor MAX is flash.
does anyone have or could guide me through a patch to convert raw acc/gyro/mag values to output to a quaternion which I can then attach to my jit.gl (this part I have sorted ) really I can't work the code to perform the maths.

the input values for the acc are in g/s, gyro is deg/s and mag is Gauss (what ever this equals) and produces 3 values for each x/y/z
I can do the math if the device rotated in each axis independently but it will be attached to someones hand and it moves mainly in pitch and yaw.

angle axis filter.maxpat
text/plain 77.46 KB

this is my dodgy but very proud programing that I have produced so far.