# How to get Euler angles where an initial value of Euler angle is set as baseline

I have a sensor which gives me Euler angles (roll,pitch,yaw). There is a baseline value of Euler angle (assume it is 5,10,15) at the beginning.I want to calibrate this baseline values from all subsequent value. How can I get those values? Is it just subtract 5,10,15 from all values? Or is there any rotational matrix for doing so? As an example if any time the value is 5,10,15 then it should show 0,0,0 and on the same way show other angle values with respect to the baseline values. I dont know how to do this.

-

## migrated from stackoverflow.comMar 5 '13 at 13:25

This question came from our site for professional and enthusiast programmers.

Euler angles, of which there are several sets, are not roll, pitch, and yaw. The crucial issue is that rotations do not commute unless they are infinitesimal. So having rotated $5^\circ$ in roll, if your next rotation is $10^\circ$ in pitch, do you use the body pitch axis or the external $x$ axis for that rotation? In my application, when we measure pitch we report the angle between body $+x$ and the reference coordinate $+x$. When we reorient we always do that in body coordinates, wherever the body is at the start. We are careful to specify the order, and multiple choices are available.