I'm trying to determine the link between an IMU I have (tri-axis accelerometer, gyroscope, and magnetometer) and determining its rotation using quaternions. I've spent a while reading up on the IMU's properties, and quaternions, but I can't get my head around how the two meet. So, scenario: I have my IMU collecting accelerometer data (in G's) and gyroscope data (in degrees/s) at 64Hz (for example, we're also ignoring magnetometer here). My IMU is sitting on a desk with x pointing away from me, y pointing to the left, and z point up to the sky. The accelerometer data will read x = 0, y = 0, z = 1 (due to gravity). I turn my IMU by 90° to the left (x pointing to the left, y pointing towards me, z still pointing up, data remains the same) and then put it on its side (x still pointing left, y pointing to the ground, z pointing towards me, data now x = 0, y = -1, z = 0. Gyroscope data of course changes during the movements. Now, I know I need to do some form of double integration to get the acceleration to velocity and then position. But what exactly I'm not too sure. I assume once the necessary calculations have been performed they will be in an angular form which I can put into the quaternion equation. Could someone please help me break down the task/math so that I can work out the rotation, please. Thank you!