We are using the Freescal magnetometer sensor and accelerometer in order to determine 'an absolute' orientation.
We are calibrating the magneto data by subtracting an offset form the measurements. This offset is determined by finding extremes in all dimensions during during a calibration period, in which the user rotates the sensor around all axes.
After calibrating, we get a 360 rotation in the xy plane, however when the sensor is tilted, the readings start to make less sense. Also we see that the distribution of rotation is not lineair / uniform. It seems that the angular rotation in certain areas is much higher than others (I saw a related post on this forum, that remained unanswered:
If we plot the calibrated readings in a point cloud and rotate the sensor 360 degrees around all it's orthogonal axes, we don't see 3 'circles / ellipses' that are orthogonal to each other, this is quite troubling.
Our goal with the Freescale magnetometer sensor is to use it in combination with an accelerometer to determine an 'absolute' orientation, my question is, is this at all possible? Currently with the current data and readings we are unable to use the data of the magnetometer.
Thanks very much
By tilting the magnetometer up right by using it as an e-compass readings actually start to make less sense and it is normal mathematical behavior. This is the phenomenon termed gimbal lock where the mapping of the rotation matrix to Euler angles becomes undefined. At the same time, from a human factors perspective, pointing vertically upwards or downwards is the point where the compass heading changes from northwards to southwards and vice verse.
This was also the first reply I got from Freescale, however we are not using Euler angles, so gimbal lock is never an issue in our case. We use vectors to construct a rotation matrix / quaternion.
Turns out that the magneto vector does not rotate around orthogonal axes, when the sensor is rotated around its orthogonal axis, therefore we needed to implement the 10 point calibration algorithm as described in one of Freescale's papers.