OK - I think I understand what is happening, but not necessarily why. Looking at the comparison between the yaw data from the two IMUs and the single compass we see the following:
View attachment 42023
IMU0 is the active IMU and its yaw value was initialized by the compass data to 41°. I don't know why IMU1 was initialized to 48°. I also cannot figure out why the IMU0 yaw drifted to equal the IMU1 yaw after takeoff, but after that the two IMUs agreed closely.
The more interesting part of the flight is the two rotations where we clearly see a periodic disagreement between the IMUs and the compass. Plotting the difference between the IMU0 yaw and the magnetic yaw against yaw, that periodicity becomes clear:
View attachment 42024
What this shows is that the disagreement has a period of 2π, or 360°. The rate gyros have no particular periodicity in rotation - it's continuous, smooth function to them, and so a periodicity of 2π, together with the good agreement between them, strongly suggests that this is not a gyro issue. Rotation in a uniform magnetic field, on the other hand, has 2π periodicity, and this kind of variation is what would be expected if the compass were being influenced by a second magnetic field that rotates with the aircraft - i.e. an out-of-calibration compass.
The aircraft is approximately level during flight, and so the x and y magnetometers are measuring the magnetic field components that change most significantly during rotation about the z-axis. However, pitch and roll from the horizontal also bring z magnetometer measurements into play. And of course, in the presence of wind, pitch and roll also display 2π periodicity with respect to rotation about the z axis:
View attachment 42025
Pitch and roll should obviously be π/2 (90°) out of phase with each other, as expected, and that is approximately what we see. Also clear is that the maximum negative pitch was at a yaw of around 25°, so the wind was out of the NNE. However, the point is that the 2π periodicity of pitch and roll could cause variations with similar frequency in the magnetic yaw measurement if it were sensitive to one or the other. In this case, the correlation between yaw discrepancy and roll is the much better than with pitch, possibly implicating the y magnetometer. However, for the duration of the flight, significant short-term roll excursions do not appear to change the yaw value, making that a less likely explanation.
That leaves the first explanation that the problem is due to a local magnetic field on the aircraft that has not been properly calibrated out, despite your repeated calibrations. Just to check - I assume that you did follow the
MA calibration instructions precisely - they are different to the traditional Phantom method.
A couple of followup tests, if you have the time and interest:
- Repeat the previous test but with two full rotations rather than just one, and with video running, since that should be able to show actual heading.
- Fly back and forth and side to side in a straight line to vary pitch and roll without changing yaw.
I'd also be curious to know what
@BudWalker thinks about this, since a successful bad compass calibration seems to be extremely uncommon.