Inconsistent compass error leads to crash when internal compasses switched off

Flying a pix2.1 with here. Octo X frame. Arducopter 3.5.7
Hi I’ve been having issues for a while with inconsistent compass warnings, which led to the copter rolling left or right with forward or backward flight.
Usual errors take place. sometimes inconsistent compass errors stopped me from arming sometimes not.
Typical errors from logs.
EKF2 IMU0 ground mag anomolly and EKF2 IMU1 ground mag anomolly
followed by
EKF2 IMU0 in-flight Yaw alignment complete and EKF2 IMU1 in-flight Yaw alignment complete.

This would tend to fix the issue somewhat. The copter would fly normally after these mid flight alignments.

Today I took advice from the docs and turned off my internal compasses, had a successful mag calibration and took flight but after a few seconds of seemingly normal operation, copter lost control and started forward and right roll till crash, increasingly not responding to stick input.
Flight mode was Loiter.
Initially I’m thinking an error/bad compass of the here may be responsible and without the internal compasses it didn’t have a chance.
Here’s a crash log, I’d appreciate any help.
2018-08-17 12-10-21.bin (452 KB)

I see it’s attitude estimates work quite well, it does also track the desired attitude.
in the final moments, you push the pitch to full speed, and I see the speed increase as expected.
So to me, a quick look at this log looks like a pilot error.

given the poshold mode, it accelerated, and “responded to stick input” as expected.

The UAV were perfectly capable of flight, had you taken over in stabilize for a while, it would behave perfectly normal too.

My error yes,
The here compass was facing the wrong way, My apologies. Corrected and in the air now. But still getting ground mag anomalies and not very good yaw hold with forward flight., initially terrible but gets better after yaw alignment calibration. I’ve turned off internal compasses and performed many mag calibration in different locations. Really concerned about using this octo. Here’s a onedrive link to that log, a better log of the last flight showing the errors.
https://1drv.ms/u/s!AtWZQxEqLM0Hg_gE4G4x5FBcJcqT0g

make sure the magnetometer is far enough from power wires/batteries, make sure it’s oriented close to perfect in all axis, especially yaw.

Here’s my setup, could add a bit of extra height to the here mast. You think that’s near enough to warrant this problem.


Thanks

I did not review your logs(again) but if you do a compassmot, the output
will show the truth :slight_smile:

ok, so one more thing before I switch to weekend-mode:
yes: you have significant magnetometer interference:
see how it’s data changes with current, yet you have barely any change in heading thru the flight…

Right, thanks for the help Andre. I’ll extend the mast and run a compassmot. With all three magnetometers working. The two internal ones are a magnitude of interference around 10x that of the external so fairly useless.

Increased the mast height to maximum allowable with the supplied here cable, about 10cm more. Also raised the pixhawk 4cm higher away from the esc and wires right beneath Not getting the same veering issue on straight flight. Still getting yaw calibration during flight, but flies much better. Might be worth investing in some mu metal to shield the fc from mag interference below, I guess the ac current from the nest of esc to motor wires might have something to do with the erratic interference seen on mag2 and mag3. Will perform a compassmot later.
What log viewer are you using by the way?

You can’t sheild your flight controller
from.magnetic interference (from any direction) without also shielding it from the earth’s magnetic field that you need it to ‘see’…

It’s used on smaller quads take a look here. https://www.youtube.com/watch?v=bOf6zfDSO6E A small footprint just covering the FC should allow plenty of earth mag to flow around, it’s not light after all.
compassmot results seem very good. I take it the graph just shows compass1.

The magnetometers we use to determine orientation in the horizontal plane uses the direction of the relatively weak magnetic field of the planet. This field is fairly constant at any given location which is why it can be used
as a reference point. If you make this field ‘flow around’ anything then you are artificially altering its orientation and unless your influence on it can be accounted for in all orientations, it becomes less useful as a reference…

Interesting, I’m guessing, don’t know much about magnetic fields. What I got from this video https://youtu.be/OHEzD7uP6hI . He doesn’t loose north with shielding. Any weakness it has would be proportionally less than the effect on the electronic generated field. But yes only trying to mitigate a frame design that has flaws, an extra 5cm FC separation would do wonders.

You may well configure such a system to reliably find a single direction such as North, however the inconsistent field through changing orientation means that you will not get reliable readings in general use. More accurate calibration would be possible for such system’s but the procedure would be much more elaborate than that required currently.

@jimovonz if your FC plate is made out of electronics copper board that you ground to your battery. Wouldnt that shield only the interfierence away and still leave the FC operating as supposed to?

Was looking at your layout.
If I may suggest:

  • Raise your external GPS/compass by 10 to 15 centimetres. Cable can be extended (i did so without any problem)
  • Place a 10 cm diameter copper/pcb/alu plate under your GPS/Compass. (ground these to the FC ground)
  • Hopefully you are using a separate voltage regulator and batteries for all your on-board electronics (receiver, FC, GPS) to avoid maxi noise coming from your ESCs.
  • Place your batteries below instead of above the frame. Your CG will be lower and flight stabilisation will be better. (This will diminish magnetic field generated during high current demands through the wiring)

Then you’ll have far less problems… :slight_smile:

Henri

Thanks. Increased GPS height by about 10cm resolved it. Batteries would be wise but can’t fit this build