Open orca-hydromancer opened 2 years ago
You mean inclination angle and field strength? These are both used for calibration but not much else.
The compass could work reasonably well with an old calibration even if the inclination and field strength have changed as long as they both remain fairly consistent, so is this your intention for detecting magnetic distortions?
It might be. I want to use those values to indicate 1) if calibration might be bad due to magnetic interference and 2) direction of that interference. For me calibration is not running continuously, I disable it after a decent fit, but I want to have those values during calibration and at the end to be able to determine if calibration needs to be done again and if there is potential interference that should be removed before re-doing it.
Re field strength what do you think about suggestion from Simrad: if the field strength >100% calibration will fail and if >30% look for and remove interference? I see pypilot code is discarding calibration when field strength <7 or >120, which seems pretty different range compared to Simrad (if the values are comparable).
Re inclination how can it be used to determine the direction of interference (as suggested by Simrad)? I see pypilot is discarding calibration when inclination > 82, but my understanding is that (in case of Precision-9) field angle is relative to compass forward (0), and should be only used as indication of direction of interference conditional on field strength indicating strong interference (>30%).
Since I'm disabling calibration after a decent fit (due to CPU limits), I'm unable to detect changes in the field strength/angle. Fine for now, but in the future I'll look into checking these values periodically to understand if I need to re-calibrate.
Basically, it needs to verify that the field strength and/or inclination varies with reading somehow to indicate the bias is actually incorrect.
There is no way to know the direction of the interference for sure because multiple sources of magnetic interference are possible. With a single source, you would have to basically perform a calibration and compare it to the previous calibration.
I dont know what simrad does because there is no source code. The range in pypilot covers the range of magnetic strength anywhere on earth. It is true that very near the magnetic poles pypilot cannot calibrate the compass either but to my knowledge no one has used pypilot there, and it would still steer, just not able to recalibrate.
You can simply compute the magnetic field strength by applying compass bias and scale and computing the magnitude and use the dot product to compute inclination. I suppose I could create imu.compass.inclination and imu.compass.field_strength or something, that basically would not normally be accessed, and could be computed only if someone is watching them...
I'm trying to figure out if there are any metrics/indicators from boatimu or calibration_fit to understand quality of the calibration.
Looking at Precision 9 compass installation guide I found the following
https://www.thehulltruth.com/13476295-post4.html
How it looks like in practice: credit
Can pypilot provide local magnetic field magnitude and direction, or otherwise provide indication of local interference? The goal is provide some indication of reliability and quality of calibration.