Compas shift when mounted

Hey there

I’m Using Rover 4.0 on a Pixhawk 4.
I calibrated the compass while the Pixhawk was connected to my notebook, and it worked fine.
But as soon as I mount the compass on my rover it starts to shift, and ends up pointing in the wrong direction.
I disconnected all the devices, (RC, powerboard) and so on to make sure it does not interfere somehow.

But it still shifts, when i lift the Pixhawk 4 of my car ~1 m above the compass starts to point correctly again.

Any Ideas?

Thank you
Harry

Did you calibrate with the motor mounted?

See this and this.

No, i calibrated the compass with nothing attached to it, just the pixhawk 4.

Are the 20 cm distance between compass an Motor, mentioned in the Video, only to be kept during calibration, or also when mounted on the Rover?

See videos here, such as this (rover and 3 drones).

On most of them, the car is placed opposite to the first waypoint, and it turns 180º when auto is started. For that to work, with car in that starting position, I had to move manually the rotor slightly, till there were no compass error messages. With a sufficient distance (15 to 20 cm) from motor to external compass (primary) that seems to work well (the car turns) so may be the varying rotor magnetic field is filtered out.

Later, I disabled compass checks for arming.

1 Like

Compass calibration needs to be performed on the vehicle with all components active with a battery. The whole point of compass cal is to correct for magnetic anomalies/interference local to the vehicle.

1 Like

Then, strictly, do the compass calibration with the motor on. I don’t follow that way, and it works (the car turns 180º immediately at start, so compass indication is taken into account very soon). I haven’t tried the motor compensation, although recently I added a current sensor (which strictly should measure for this motor current only).

The Calibration on the vehicle always fails.
The blue bar is filled rapidly and in fails with the error:
“Compass 0 calibration below quality threshold”

Compass Parameters:
COMPASS_AUTODEC Enabled
COMPASS_AUTOROT 2
COMPASS_CAL_FIT Strict
COMPASS_ENABLE 1
COMPASS_FLTR_RNG 0%
COMPASS_LEARN Disabled
COMPASS_OFFS_MAX 3000
COMPASS_ORIENT None
COMPASS_PRIMARY FirstCompass
COMPASS_USE Enabled
COMPASS_USE2 Disabled
COMPASS_USE3 Disabled

This is how the pixhawk is mounted, the distance between motor & compass (pixhawk) is 21 cm

It’s not just the motor it’s any electronics and metal. What’s that big bundle of cable under the Flight Controller for? Do you have an external GPS/Compass module? It’s typoical to disable the internal compass on Flight Controllers and use a external one that is better isolated.

At least set COMPASS_CAL_FIT back to default or even relaxed.

1 Like

That’s the cable from the GPS-antenna, sitting in the front of the controller.

Under the Powerboard is an ArduSimple RTK2B. Because of the later, I can’t (as far as i now) ad an external compass.

I set “COMPASS_CAL_FIT” to relaxed.
Calibration still fails with
“Compass 0 calibration below quality threshold”

OK, I see. If you are going to use the compass(s) integrated in the Pixhawk I think you will need more isolation than you have. You could still add an external compass. The Ardusimple unit doesn’t have one at all right?

That’s right.

How? The Ardusimple doesn’t have any connection for a compass. And for the Pixhawk the Compass needs to be connected to the GPS port, where my Ardusimple is plugged in.

OK.

I made it run so far, whit the COMPASS_USE disabled. The rover then gets the orientation from the GPS heading.

Thanks

Well the Ardusimple isn’t connected to the I2C pins on that port. But in any case there is a 2nd I2C port you could use. There are compass modules available that could possibly be used. I used an external compass board on a craft some years ago. These boards are available. Most of them have the LSM303DLH chip.

There has been some work done on using 2 GPS modules to supply stationatry yaw data. But I’m not sure how that would work with your RTK module as one of them.

You can do this very simple test: take away the Pixhawk, attach to it the external GPS (with compass) you want to use in the same orientation as in car with velcro or whatever, connect it to the PC with MP or QGC with an USB cable and calibrate magnetic free, internal and external.

If success, never calibrate again, and save the values.

If not there is some other problem. Try other GPS.

If your GPS doesn’t have compass, the method is valid (internal compass is calibrated), but you should place the pixhawk far away from the motor, or add a small I2C compass module such as GY-272 that you can place anywhere, attaching it to the pixhawk for calibration as described above.