Since I moved from APM to PIXHAWK, I’ve never had a good flight with COPTER. Always the same: ERROR COMPASS VARIANCE. I am pretty desperate with this issue.
I am now in Copter V3.4, and still the same. After so many hours researching, trying to understand the new EKF and EK2 procedure, my only conclusion (and to be honest, not 100% sure), the error comes from discrepancy in the internal and external compasses reading. My suspect comes from the fact that no matter how I calibrate the compasses, I have never accomplished to have mx,my,mz and mx2,my2,mz2 reading to be consistent.
So ok, it does not matter, I have been flying happy all my live with just one compass. I dont want an internal compass anymore !! I just want to live happy with just my external compass, far far far away from any interference source (looking at the log and after compass mot, interference is less tahn 8%).
But no matter how I disable the internat compass, the error persist !!! It is like the EK2 algorithm is still considering the internal compass measures. So my question is simple: How I can tell the EK2 no to use the internal compass measurements?
Thaks in advance,
I’ve had plenty of compass issues including the ERROR COMPASS VARIANCE one a few years back. If I remember correctly I just deactivated the compass check in the ARMING_CHECK paramenter (eg set ARMING_CHECK = 4, see details here: http://ardupilot.org/copter/docs/parameters.html#arming-check-arm-checks-to-peform-bitmask)
If that works that’ll allow you to get the copter in the air but this is kind of a dirty trick as this doesn’t solve the underlying compass measurement issue.
To solve underlying compass issues I’ve had good success taking a series of measurements of the compass readings and putting them on a graph (mx vs my). You should get a nice circle of points centered on the origin. If the circle is not centered then your offsets need to be tweaked (you can change them directly in the config/tuning screen in Mission Planner).
The measurement protocol I use is this: put the copter on the floor while connected to Mission Planner and read the mx and my values off the “Flight data” tab. Rotate by 10 degrees and take another measurement. Repeat until you’ve covered 360 degrees. Then you can graph the data.
Hi Clement !
First of all, thank you for your response. It really helps ! As you proposed, it is better to solve the underlying compass issue. The method that your suggested seems very promising so I’ll give it a try. But let me first ask you some questions:
1 - I understand that what you are doing is setting the offsets manually, i.e, not relying on the on-board calibration nor in the live calibration from mission planner. Why do you think those methods are not reliable?
2 - Do you apply this for both, internal and external compass?
3 - What happen with the offset in the z- axis? How do you set this guy?
4 - After applying your method, the EKF message “Error compass variance” always dissappear? (Oh man, I am dreaming with the day in which I erase this message for the rest of my live). If that is the case, why do you think your method works and make this error dissappear?
Hopefully, I can get these questions answered soon because I am planning to fly again next wednesday !!
Thank you in advance,
To answer your questions in order:
1 - you might have some metal in the frame that distorts the magnetic field. If that’s the case your magnetic field shape will look like an ellipse instead of a circle. I believe the Mission Planner live calibration assumes a circle which might be why its results could be off in your case. There is a second type of calibration available in AC 3.5 (onboard calibration I believe) that compensates for metal in the frame but haven’t tested it much (I use AC 3.4)
2 - I usually apply it the external compass but you could apply it to both.
3 - I usually do a live compass calibration with Mission Planner first to get a rough value of the x y and z offsets. That’s where my z offset value comes from. I usually don’t touch it after that.
4 - Yes. After graphing the measurements it was clear my magnetic field was potato-shaped rather than circle-shaped. On top of adjusting the compass offsets I also modified the COMPASS_ODI_X and COMPASS_ODI_Y which reshape the potato into a circle to account for soft iron in the frame. Once that was done all my compass and toilet bowl issues went away.
I hope that solves your issue. Let me know the results!
Hi Clement !!
Thank you again for your answer.
Just to mention, I think that the on-board calibration is available in AC 3.4, at least in revision 3.4.6.I had used it but that did not solve my compass issues, so, as I said, I will try your procedure.
I thought that the ERROR COMPASS VARIANCE source was discrepancy between internal and external compass measurements, but if you are saying that you managed to solve your compass problems by only touching the external compass parameters, I dont think in that way anymore. Unfortunately, the documentation about this misterious error is very poor…
And to finish. You are saying that to fine tuning your compass parameter, you also change the COMPASS_ODI_X and COMPASS_ODI_Y. It makes a total sense to me but… in the same way you have a very straight forward procedure to set manually the X and Y offesets… which procedure you follow to change the ODI?
I am almost ready to follow your instructions. I’ll keep you posted,
Hi JM, to change the COMPASS_ODI_X param I do some calculations manually but that’s a complicated process. Hopefully, setting the COMPASS_OFS_X and COMPASS_OFS_Y manually will be enough to solve your problem.
This is the result from my current setup (Pixhawk1 + 3DR Gps Module):
But this was taken on my office in the city, where the interference from the environment may affect.
So my plan is going this wednesday to the field, perform the on-board calibration there, and using those results as starting point to apply your procedure.
As you say, maybe by just changing the offsets my problems are gone, but just in case I get an elliptical shape, I would like to know how to set the ODI parameters. I understand that in order to do that, as you said, I have to performs son manual calculation. Would you please just reference any document or paper or wathever for me to know how to do that.
I really appreciate your help with these references,
Thanks in advance,
Wow that’s one non-centered circle!
If the compass was calibrated, the circle would be centered on the origin (0,0).
Here it’s centered on (50,-260).
Add (or substract? I’m not sure) those values to the X and Y compass offsets to center that circle back on (0,0).
Also your graph looks like an ellipse but if the scales on both axis were the same, your graph would look like a perfect circle so you won’t have to worry about the ODI parameters.
Let me know if that solves your problem