In flight compass calibration clarification

I have a problematic boat where I get severe issues with the compass when I power it on. I did standard compass calibration successful upfront. But as soon as I start to drive the boat I get problems. I am allowed to put boat into auto and guided, but the boat drives like it does not have a clue and the boat icon yaw is totally wrong. I know that I need to move the GPS with compass further away from disturbances and do calibration again - problem gone. But I anyway decided to explore in flight compass calibration as an initial step when I was outdoors at a water for several days. I also believe that it may even be a better procedure as disturbances from motors and ESCs are then present. They for sure are not when the autopilot is disarmed.

I tried to read up on in flight calibration before I started (old discussion from the beta test period contained the best info). And I have tried:

  1. Setting COMPASS_LEARN to 3, then reboot, then drive circle and 8 patterns in manual. Checking after a refresh of parameters that COMPASS_LEARN was set back to 0
  2. Using an RC switch, and set the appropriate RCx_OPTION to 62, then drive like in 1)

Both methods seems to work well. And compass quickly gets improved. And also driving missions and guided afterwards without any issue at all. But…: When driving around the next day the problems came back. My suspicion is that the compass setting was improved, but perhaps not stored and retrieved on next power up. At my initial tries I did not check if the message “Compass learn: Finished” was received. Last time I checked this.

As I said I am certainly going to put my GPS/Compass in a better spot and do proper calibration all over. Used hardware is, by the way, a Mateksys M10 L4 3100 connected to a Radiolink Pixhawk (2.4.8) by CAN port. But I still like to understand the in flight procedure anyway. And reading the old discussions I find a couple of things unclear:

Question 1:
Is it neccessary to reboot the Pixhawk between setting COMPASS_LEARN = 3 and doing the manual driving to perform the calibration? The initial discussions were clear this was needed.

Question 2:
Using the RCx_OPTION, and setting the switch high to initiate in flight calibration: Does this do anything else than to set COMPASS_CALIBRATION = 3? It was stated in old discussions that the procedure could be repeated with no need of a reboot in-between. Leading me to think that the reboot I ask about in question 1 may is no longer needed.

Question 3:
When the “Compass learn: Finished” finished is received: is the calibration then permanently saved so I can expect the compass to be good when I use the vehicle later? I assume the absence of this message for sure indicates that I will be back to square one next time I use the boat…

Forget all of that and use Magfit.
Magfit
Drive a couple figure-8’s and then follow the procedure with MAVExplorer using that log.

1 Like

Thanks, Dave. I have the tools installed and will for sure give it a go. The how-to description in the wiki is a bit thin. But I found a 2h video going through log analysis in general with a section about magfit. So I think I will learn what is needed.

But: Using magfit for sure is not for everyone. I assume most “pilots” do not even have the software installed, and that many will also struggle to. So I still want to understand more about in flight calibration. Because it for sure corrected my problems in the field very fast. Maybe not perfect, but more than sufficient for me to continue using the boat.

I think it is. Using MAVExplorer is straight forward. The Video on the Wiki Page is 2 minutes long…

That’s OK, let’s not debate that. As stated I also appreciate the advice to use Magfit.

The questions are still about details of doing in flight calibration where i find the description not precise enough.

Anyone who has the detailed knowledge about the in flight compass calibration, ref questions on top (quote):

Question 1:
Is it neccessary to reboot the Pixhawk between setting COMPASS_LEARN = 3 and doing the manual driving to perform the calibration? The initial discussions were clear this was needed.

Question 2:
Using the RCx_OPTION, and setting the switch high to initiate in flight calibration: Does this do anything else than to set COMPASS_CALIBRATION = 3? It was stated in old discussions that the procedure could be repeated with no need of a reboot in-between. Leading me to think that the reboot I ask about in question 1 may is no longer needed.

Question 3:
When the “Compass learn: Finished” finished is received: is the calibration then permanently saved so I can expect the compass to be good when I use the vehicle later? I assume the absence of this message for sure indicates that I will be back to square one next time I use the boat…

My own findings then after some testing…

In question 1: Reboot needed between setting parameter COMPASS_LEARN to 3? Yes, without the reboot you can drive around for a long time without any effect.
Observed on restart after reboot: Message “CompassLearn: Initialised” appears. This does not happen without a prior reboot. Reboot assumed mandatory.

In question 2: Possible to just use a remote switch and trigger CHX_OPTION to 62 without doing an autopilot reboot? What I observe in my testing yesterday (rover, 4.2.3) is that this does not work. Leading me to believe the switch trigger only sets COMPASS_LEARN to 3 and nothing else. And that the reboot is mandatory. Convenient to do it by a switch, but nothing more.

In question 3: I just have to assume that the calibration is saved. After setting parameter, doing reboot, waiting for a decent GPS quality and then drive around until message “CompassLearn: Finished” appears to be all there is to it.