New answers tagged

3

The accelerometer measures the gravity vector in the body frame, call it $a$. If you normalize that, say $\hat a$, it's the third row of the rotation matrix $R$ that represents the rotation of the body. i.e. $$ R^\top \begin{pmatrix}0 \\ 0 \\ 1\end{pmatrix} = \frac{a}{||a||} = \hat a = z_{\mathcal{W}}^{\mathcal{B}} $$ So $$ R = \begin{pmatrix} ? \\ ? \\ \...


1

First off, your code may have some confusion about atan2, which already returns an angle between -pi and +pi. That's one reason to use atan2(dy, dx) instead of atan(dy/dx) -- it figures out the correct quadrant so we don't have to. (The other reason to use atan2 is that it works fine when dx is near zero, where atan(dy/dx) will suffer loss of precision, ...


Top 50 recent answers are included