I'm working with a lsm303agr from ST. Here is the frame attached to the chip enter image description here

Here is the body frame

enter image description here

So I have some doubts about the rotations, before to fuse data coming from my lsm I'd like to rotate lsm axis to body frame. So if I understand well if my sensor is flat on the body (sensor z axis points up) and pin 1 of sensor towards the front of the body. I have to rotate axis like this

  1. rotate x and y axis sensor to -90° or 270°
  2. rotate z sensor to 180°

Is it right ?


1 Answer 1


Yes and no. If you look carefully the coordinate system in the first picture does not match with the coordinate system in the aircraft picture. Why? Because the X axis in the first picture is positioned were the Y axis should be!!! And not because of the rotation!!! In a conventional coordinate system, X and Y are swapped in the first picture. So you should rename them in your code. So the picture with the aircraft is the "right" one. Furthermore, the order of rotation matters.

Given that you swap now X and Y in the first picture, then:

  1. Rotate the coordinate system about +180° around the Y axis (X in the picture).
  2. Rotate the coordinate system about +180° around the Z axis

Now they should match. Use your right hand to visualize the rotations.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.