Servers by jDrones

Disabling internal compass


(Gerber) #1

Hi,

The internal compass of the Pixhawk always gives a yaw offset of +/- 10 degrees. I’m trying to disable the internal compass by setting parameter COMPASS_USE2 = 0, so heading/yaw will be based on the external compass only (COMPASS_USE = 1).

For some reason the internal compass is still used -> heading will only change when rotating the pixhawk itself. Rotating the external compass doesn’t seam to have an effect on the heading or yaw.

Anyone an idea how to disable the internal compass?
I’m using Rover FW 3.2.1.


(rmackay9) #2

Gerber,

It probably is using the external compass but if you rotate the external compass on its own without rotating the flight controller board, the EKF will see that the compass doesn’t agree with the gyros and start ignoring the compass.


(Alberto Cristóbal) #3

Thanks for all the support.
Is it possible to totally disable the internal compass?


(rmackay9) #4

Alberto,

Yes, just set COMPASS_USE2 = 0 and COMPASS_USE3 = 0 (or maybe it’s COMPASS2_USE and COMPASS3_USE)…


(Alberto Cristóbal) #5

Thanks.
I always have the feeling when I want to use an external compass that the Pixhawk is still using the internal one.
When I have compass problems, I use to disable one of the compass, Internal or external but I am still having the message Error compass Variance. I think this error is caused for a discrepancy between compass 1 data and compass 2 data. Or is caused for a discrepancy between compass X data and giro data?
I am a bit concern because I am having problems with compasses and I don´t know if it is a compass error or an strong magnetic field.

Thanks


(rmackay9) #6

Alberto,

So there are two similarly sounding errors that can occur:

  • “compasses inconsistent” means that two compasses are pointing in different directions
  • “compass variance” means that the EKF thinks the compass (it only uses one at a time) does not agree with other sensor data (accelerometers, gyros, GPS).

So the 2nd message, “compass variance” can definitely happen even if only one external compass is being used.


(Alberto Cristóbal) #7

Thanks for the answer.

If I am using just one compass and I am having constantly the same error “compass variance” It could be for two reasons.

  • The place has a very strong magnetic field
  • The magnetometer is broken

Is that right
for more information I can perfectly fly in alt hold Mode


(rmackay9) #8

Alberto,

Ah, we’re talking Copter in the Rover forum :-). You’ve found me! Don’t tell your friends or the Rover forums will turn into a Copter forum (I’m kidding in a way, I’ll be spending more time back in the Copter forums shortly).

yes, you’re right about possible causes. It could also be that the compass is oriented incorrectly (i.e. COMPASS_ORIENT doesn’t correctly match the direction the compass is pointing in).

One addition though is when you say “the place has a very strong magnetic field”, it is most likely the compass’s place on the vehicle or it could be large chunks of metal in the environment (especially if flying indoors). The large majority of cases are caused by having power wires too close to the compass.


(Alberto Cristóbal) #9

Yes, You are right. I didn´t realise.
I am sorry.

Thanks for the answer.
I couldn´t find some wire that could cause this internal magnetic field.


(Alberto Cristóbal) #10

I forget to ask about the other Compass error, BAD COMPASS HEALTH.
what´s the meaning of that error?
Thanks


(rmackay9) #11

Alberto,

Normally this means that the compass is not communicating reliably with the flight controller. This could be caused by bad wiring or some kind of hardware issue. If you’re only seeing it after startup and then it goes away then you probably don’t need to worry too much about it but if it persists I’d look at replacing the compass and/or checking the wiring.