3
$\begingroup$

I bought a 3-axis magnetometer (Similar to this one ) And plugged into an Arduino in order to read the heading value. I mounted it on my robot and I drove with the robot for around 30 meters, turned 180 degrees and drove back to my starting position. I plotted the heading value and it shows inconsistent values. The 180 degrees turn started at sec 55, the rest is driving in one direction using a joystick and following a wall as reference so small deviations are expected but not that big as in the image.

enter image description here

When the robot is turning in-place, there is no such problem and the heading variation follows the rotation of the robot. The robot (Turtlebot) is a little bit shaky such that the magnetometer doesn't always have the x and y axes parallel to the floor but I don't think few degrees of offset can cause such a huge difference. I calculate the heading as follows:

heading = atan2(y field intensity, x field intensity)

Why does this happen? Could it be form some metals or electric wires under the floor? Can you suggest a more robust method/sensor for estimating the heading in indoor environments?

EDIT:

I drove the same path again and the pattern similarity is making it even weirder enter image description here

$\endgroup$
4
$\begingroup$

Apparently a magnetometer is useless in indoor environments like man made buildings. I cite from this paper Multi-Magnetometer Based Perturbation Mitigation for Indoor Orientation Estimation

Nevertheless, the success of these sensors for orientation estimation is conditioned by their capacity to sense Earth’s magnetic field in environments full of magnetic anomalies like urban canyons and indoors. These artificial fields contaminate Earth’s magnetic field measurements, making orientation estimation very difficult in heavily perturbed areas.

$\endgroup$
1
$\begingroup$

Everything looks fine to me.

Imagine if you kept driving in clockwise circles. Would you want your heading to be 18064? Would that mean anything to you? Which direction are you facing?

No, instead whenever you would go below 0 it puts you up to 359, because counter clockwise of North is North-Northwest.

Similarly, clockwise of North is North-Northeast, so instead of going from 359 to 361 you go to 1 instead.

All you are seeing is the output giving you a useful heading, which means "wrapping" from 0 to 360 because these are actually the same values. Similar to how a clock "jumps" from 12 to 1 (or 23 to 1, depending on your background).

$\endgroup$
  • $\begingroup$ What about the "driving in ONE direction"? $\endgroup$ – Mehdi Dec 23 '15 at 13:25
  • 1
    $\begingroup$ Ah my fault; I misread the question. The plot looks normal for an arbitrary drive cycle, but incorrect for your straight-180-straight cycle. In that case I would agree with your answer, that you're passing magnetic fields such as power wiring that are interfering with your reading. The simple way to verify this is to go outside and see if your data looks worse, the same, or better. $\endgroup$ – Chuck Dec 23 '15 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.