Following http://www.codeproject.com/Articles/729759/Android-Sensor-Fusion-Tutorial , I get two orientation values. Then, I transform those values to rotation matrices R1, R2.
I think the relative rotation matrix is $$R_{12} = R_1*R_2^T.$$
I test one case using matlab calibration toolbox. The ground truth for $R_{12}$ is $$\begin{bmatrix} 0.9970 & -0.0715 & -0.0298\\ 0.0744 & 0.9909 & 0.1118\\ 0.0216 & -0.1137 & 0.9933\end{bmatrix}$$
The values I got from android are $$ ori1 = [0.6268438, -0.07218649, -0.2109669]$$ $$ rot1 = [0.78306764, 0.5850639, -0.21096313 \\ -0.58581793, 0.80777377, 0.06571868 \\ 0.20886011, 0.07212382, 0.9752824]$$
$$ori2 = [0.81628907, -0.09071748, -0.28214455];$$ $$rot2 = [0.6394706, 0.7256131, -0.2540925;\\ -0.717076, 0.6821133, 0.14325997; \\0.27727118, 0.0905931, 0.95651114];$$
testR12 = rot1*rot2' =
0.9789 -0.1927 0.0683
0.1948 0.9805 -0.0264
-0.0619 0.0391 0.9973
There are many coordinates and I am lost. How to get correct value? What's wrong with that? I have been stuck for a week because of this problem.