# IMU Change of reference frame

Im trying to rotate one accelerometer vector from body frame to ned frame, but i cant found what im doing wrong. For now, im using an online dataset that provides me roll, pitch and heading information, where heading is 0 rad when alligned with east axis, not north axis, the dataset also provides accelereration in x, y, z. For making the rotation im using a direct cossine matrix, like this below:

The x axis of the imu is alligned with the movement of the car, the y axis with the lateral acceleration, and z axis with gravity. What im doing is first change the heading angle to get an orientation with respect of north, after this, multiply the DCM with the acceleration [Ax,-Ay,Az] in this order, Ay is negated because the dataset gives me acceleration positive in the left axis. Im expecting to have the NED acceleration. But the answer seems wrong. The IMU used in this dataset is one oxts rt3003.

The IMU senses deviations from gravity within the inertial frame.

Essentially, IMU measures the specific force $$f_b$$ given in the base frame as: $$f_b = R^{bn}(a_{ii}^n-g^n),$$ where $$g^n$$ is the gravity in the navigation frame (NED), $$a_{ii}^n$$ is the inertial acceleration expressed in NED frame and, finally, $$R^{bn}$$ is the rotation matrix from NED to the body frame.

Further, it holds that the acceleration we are interested in, that is $$a_{nn}^n$$ given in the NED frame, can be expressed in relation to $$a_{ii}^n$$ through the centrifugal and Coriolis terms: $$a_{ii}^n=a_{nn}^n + 2\omega_{ie}^n \times v_n^n + \omega_{ie}^n \times \omega_{ie}^n \times p^n.$$

Usually, both centrifugal and Coriolis contributions can be neglected, thus: $$a_{nn}^n \approx a_{ii}^n$$.

Thereby, it comes out: $$a_{nn}^n=R^{nb}f_b+g^n.$$

Most likely, you are not considering the contribution of $$g^n$$ in your transformation above.

I warmly recommend that you refer to Section 2.3 "Using Inertial Sensors for Position and Orientation Estimation" by M. Kok, et al.

• Hi Ugo, thank you for answer my question, i forgot to mention, the IMU that im using already removes the gravity components of forward acceleration and lateral acceleration, so i already have only the linear acceleration in body frame, but with the formula above, what i understood is that i have to add gravity in the navegation frame, is that correct? Jan 6 at 15:11
• Measuring deviations from gravity means that if you leave the IMU stationary on a table, you'll get as output $-g$, whereas in free fall you'll get $0$ output (neglecting drag). In the former case, the real acceleration is $0$, while in the latter is $g$. Hence, if you aim to work out the real acceleration your system undergoes, yes, you need to account for the term $+g$ in the final equation. Disclaimer: this is the standard behavior of an IMU; I don't know much about the specific operations performed by the OXTS unit though. Jan 6 at 15:23
• Also, $R^{nb}$ is a $3 \times 3$ rotation matrix. Oftentimes, we make mistakes while forming rotation matrices starting from different representations (e.g. quaternion). Thus, verify accurately this stage as well. Jan 6 at 15:28
• Thank you Ugo is working now, and that was one of my problem, the other was the direction and the heading angle that the dataset was providing me. Jan 6 at 20:09