IMU Change of reference frame

rotations

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 roll is positive with left-side up and the pitch is positive with the front of the vehicle down. The dataset also provides accelereration in x, y, z. For making the rotation im using a direct cossine matrix, like this below:
\begin{bmatrix}
CP*CY & -CR*SY + SR*SP*CY & SR*SY + CR*SP*CY \\
CP*SY & CR*CY + SR*SP*SY & -SR*CY + CR*SP*SY\\
-SP & SR*CP & CR*CP
\end{bmatrix}

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. Is the process for obtaining the NED acceleration correct? Or am I missing something ?

Best Answer

The output of the accelerometer is given in the body-fixed coordinate system, that is, $a = {}^{i}\dot{v}^b_{C/i} - g^b$ where ${}^{i}\dot{v}^b_{C/i}$ is the spatial acceleration of the sensor and $g^b$ is the gravitational acceleration. The DCM you wrote seems to be formed from Euler angles under 3-2-1 rotation; from body to NED. If you want to get an acceleration in the NED coordinate system, multiply the DCM with the sensor output.