Magnetometer misalignments

In a previous post I said that you could tell something about the magnetometer misalignments from the matrix M.

To recap: if the magnetometer axes are installed twisted with respect to the platform axes the calibration procedure detects and corrects for this by including an extra rotation in the matrix M. Also I said that the singular value decomposition (SVD) of M breaks M down to a rotation, an orthogonal scaling along the coordinate axes, then a second rotation, each of which can be represented by an individual matrix V, S, and U, in turn. V and U are rotations and are therefore orthogonal matrices, and S is a diagonal matrix. In fact it’s more convenient to use the transpose of V (and since V is an orthogonal rotation, its transpose is also its inverse) and write

  • M = U S VT

any rotational misalignment in the magnetometer data will be apparent if the two rotations (the one before and the one after scaling) are not equal and opposite. That is, in perfect alignment, U VT  = I. Returning to Data Set A previously I can quickly form the product U VT, in the R console window:

> svd(M)$u %*% t(svd(M)$v)
             [,1]         [,2]        [,3]
[1,] -0.999739709  0.009058857 -0.02093924
[2,]  0.009619606  0.999593562 -0.02683607
[3,]  0.020687625 -0.027030510 -0.99942052
>

This is very close to the identity – with ones along the leading diagonal and zeros elsewhere – or at least it would be if the signs of the first and last entries were positive instead of negative. What’s going on here?

Let’s look at this matrix as being very close to the following:

-1  0  0 
 0  1  0
 0  0 -1

You should recognize this as a matrix that rotates 180º around the y axis because it switches the sign of the x- and z- coordinates. (It’s a flip long-end to long-end). I have written earlier when discussing the accelerometer calibration that I needed to change the sign of the x and z calibration values in order to make the board face the correct way. What the result above is telling me is that the raw output of the magnetometer is misaligned by almost exactly 180º. Which is true, since with the board upright the sensor axes are front/back and top/bottom reversed. But I was actually able to measure this reversal from the magnetometer calibration, instead of assuming it.

Leave a comment

Filed under Calibration

Leave a comment