# How to get Euler angles with respect to initial Euler angle

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 from this baseline values 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 don't know how to do this.

-

First, you cannot add or subtract Euler angles. They are not vectors. You need to convert the Euler angles to a representation that can be composed such as a rotation matrix or unit quaternion. If $R_b$ is the base line rotation matrix and $R_i$ is a given rotation matrix, then you can measure rotation w.r.t. the baseline using the following formula $R = R_b^{T}R_i$.

To convert from Roll, Pitch, Yaw angles, you need to compose three rotation matrices about the Z, Y and X axes (assuming that Z ~ yaw, Y ~ pitch, and X ~ roll in the local frame). This is just a composition of the three coordinate rotation matrices:

$$R = R_z R_y R_x.$$

To get the euler angles back I refer you to the following: http://stackoverflow.com/questions/11514063/extract-yaw-pitch-and-roll-from-a-rotationmatrix

-
Thanks Tpofofn. How can I get rotation matrix from euler angles? Also how can I get the final roll,pitch,yaw from resulting rotation matrix R? –  user2133832 Mar 5 '13 at 3:04