by bn999 » Wed Apr 24, 2013 2:46 pm
The Earth's full magnetic vector (X, Y & Z) is used as a vector by the UKF to help estimate orientation. Unlike gravity, it has an inclination from the vertical so its most influential components are the X & Y axes (at least in most populated sections of the globe) and they have the most influence on determining the heading. However, during flight when there are other observations available, the UKF tends to trust them less as the sensed vector is shifted by things like transmitters and motors. But when motionless they are completely relied upon to determine heading and to a large degree the entire attitude solution. If you do not have a stable heading when the board is motionless or it drifts after movement, this is a good indication that you probably have a poor calibration - or you have a lot of external magnetic interference.
Monitoring the magnitude of the MAG vector at various attitudes is also a good sanity check for how well they are calibrated and how much external objects are affecting them. The IMU is calibrated to register Earth's magnetic field vector with a magnitude of 2.0. Large deviation from there is undesirable.
You will see the magnitude of the sensed magnetic field vary when you are around other objects, like when it the craft or board is sitting on the bench. This is normal and cannot be helped. What you want to try to do is minimize (as it seems you have started to do) the effect of the electrical system and motors has on the MAGs.
The best defense is to move things further from the sensors. Mount ESC's further out on the arms, transmitters far from the center, etc. Also, all power carrying lines should radiate from the central power distribution out, away from the center and be twisted. Never cross a power line under or through the center of the machine. A power distribution board is good as it forces the positive and negative planes to be very close together and symmetric with a similar effect that you get from twisting.