Compass Calibration "Fit", xyz offsets, Mag xyz, Mag(0)/Mag(1), 3D GPS lock

Cry for Help

Dear Generous and knowledgeable Discourse Contributors and Experts,
I have scoured the web, this forum, logs, documentation, and even performed my own testing…I still cannot confidently determine the answers to these questions. I am hoping that someone out there has a much higher education on this science and can provide some insight…or even some exact/concrete answers. Thank you in advance for offering your time and expertise!!
I’ve never posted here before, so I’m not sure if this is way too much to ask in one post. It is all related, and I’m asking questions very specifically/ broken down into pieces, because I’m trying to get the whole picture. Any answer to any question or pointing me to a good source will be greatly appreciated!!

System Info

• Orange Cube (not +) [not using internal compasses]
• 4.3.3 and 4.5.0-custom (for RID unit)
• Here3 GNSS (M8P) [external compass]
• Custom carrier pcb assembly

Compass Calibration [using only the internal compass]:

  1. What does “Fit” represent in reference to the value that is displayed at the end of a compass calibration?
  2. Is there a formula “Fit” is calculated with? What values are included in that calculation?
  3. What parameters and/or environmental affect “Fit”?
  4. Is higher or lower fit better?
  5. What does the fitness level convey? Is strict best? Why?
  6. What do the compass offsets represent? Are bigger offsets worse?
  7. Are there exact methods for getting a consistent fit value when calibrating the compass? What causes fit to be different between calibrations that are performed back to back? (I’ve been performing compass calibration repetitively for testing and I get large variations)
  8. Do nearby magnets (ex. motors) cause permanent damage? Can they throw the compass off over time?
  9. Can you calibrate a compass too much?
  10. I’ve read in ardupilot documentation that good GPS lock is necessary for compass calibration. Why? Are more locked satellites going to result in better compass calibration or “Fit”?

Analyzing Noise/Interference using Logs

  1. Aside from Mag(0) and Mag(1), is there other data I can look at in the logs to understand interference levels?
  2. Where is Mag(0) and where is Mag(1)? In the cube? In the here3?answered:mag0 is in the cube, mag 1 in the here3
  3. How much “Mag” is too much?
  4. Can I offset mag interference (based on values I see in logs) for better performance of the compass? GPS? (I do know about compass_mot calibration, but I don’t have current sense so I’m not using it)
  5. Can magnetic issues cause the here3 to completely cut out?
  6. If I have nearby noise sources…like an onboard computer, should I calibrate the compass with the computer on for better representation of the state the craft will be in during flight? Or should I have it off in order to reduce noise during calibration?

Thank you from the bottom of my heart for any and all offerings of intelligence!!

Sincerely,

-Val-

The Here3 and Cube Orange both have compasses. The Cube will be considered the interal compass and default as Mag(0) and the Here3 is the external compass Mag(1). There’s no reason not to use both, but sometimes the internal compass is subject to a lot of interference because of the wiring around the cube and there’s not much you can do about it. In that case it’s common to disable the internal compass.

Yes; Motors, ESCs, batteries, radios, and all the other electronics dump out varying levels of interference.

My suggestion:

  1. take the drone outside, away from any external source of interference. Get a good GPS lock.
  2. Perform the normal compass calibration routine. Ideally with both compasses, but if the internal is giving you errors then disable it and try again.
  3. Once you have the drone flying then run the Magfit utility. and it will generate compass calibration values that deal with in-flight variations and current flow. You can run Magfit from any flight log, but what I do is a short 5 minute flight with a bunch of sweeping turns and figure 8s. Depending on the drone, maybe a few high current climbs, but that might be more because it’s fun. Ideally you would do this flight with all the electrical loads running, including telemetry radios and companion computers.

To get the most from Magfit make sure you have battery voltage and current monitoring enabled and accurate.

The best way to run Magfit is to install Mavproxy and that will include MavExplorer. Magfit can be accessed as function in MavExplorer. If that get’s to be too much, just post a log here and somebody can run the numbers for you. There’s also talk of a Magfit webtool coming soon, but I don’t know when that will be live.

@Allister thank you for this info!

Yes, I am calibrating outside, trying to avoid interference sources.

Thanks for the answer on the mags. That helps. Do you know what magnitude of mag is too much?

Internal compass was disabled years ago.

Wondering if motors being in close proximity over time (because when the arms of the copter are folded, two motors are very close to the compass) will cause the compass calibration to be thrown off?

Thanks for the tip on the MagFit utility, I’ll try that. But I don’t have a current sensor so…?

You can still run magfit and use the calibration without a current sensor. Leave of CMOT in the calculations. You just won’t get the most from it. The CMOT values will actually adjust the calibration as the current flow increases in flight giving a better overall usability. In many cases it will also make things like the internal compasses useful when they otherwise may have not been.

Personally, I recommend setting up current measuring whenever possible regardless of the compass. You’ll have a much better idea of overall battery health if you have that data.