Calculate earths frame to body frame

Hello forum-users!

I have two BNO055 attached to the Arduino and they operate in fusion mode NDOF to show their orientation in space. They show the absolute orientation with respect to the earths magnetic field as said in the data sheet. Now I attach them to a device and would like to transform the starting position, so that it is (0,0,0). So I am struggeling with rotating the earths coordinate system (CS) into the coordinate system of the body. My first approach of calculating the rotation matrix with the Euler angles at the starting position and multiplying it with the vector containing the starting positions did not work.

I know that this is more a theoretical question, but maybe so of you guys have come across this problem and can give me some hint. Would be awesome.

The Euler matrix is just a rotation, and has no effect on the point (0,0,0), only the translation vector does so. The matrix is used to determine only the orientation of the object in the Earth frame. The inverse of the Euler matrix (transpose) converts Earth frame orientations to body frame.

Here is a useful overview

Euler matrix? I think you mean DCM. There are 3 basic ways to represent a 3D rotation, Euler angles,
direction cosine matrix (DCM) and quaternions.

Remember 3D rotations don't commute, so its very easy to get confused and pre-multiply when you should
post-multiply, and this isn't made easier by the fact that coordinate transforms are the inverse of the
rotation between frames. And remember that the rotation mapping one coordinate system into another
is itself represented in one of the systems - be clear which.

Get clear in your head the distinction between a vector (a physical thing) and the representation of a
vector w.r.t. a coord-system, and be clear in your code which coord-system applies to every vector
and DCM by using a naming convention.

Euler matrix? I think you mean DCM.

No, the OP clearly meant the rotation matrix derived from the Euler angles.