Does the compass need to be calibrated necessarily with a gps fix?

Hi all,

on my copter i moved the gps compass from the stylus, to the 3d printed support placed on the back. To do this I rotated the GPS 180 degrees. I then proceeded to calibrate the compass (at home without gps fix) which ended correctly and correctly set yaw 180 (on the stylus it was yaw none).

The copter works well (kakute F4 1Mb FW 4.3.5 RC1) in stabilize, althold, loiter. When I try a simple mission in auto mode, the copter instead of reaching the waypoint, gains altitude uncontrollably, I have to activate the loiter to take control otherwise it would continue to climb. Why this behavior? Why does in loiter work well? The problems started when I moved the gps to the rear of the copter, everything worked on the stylus, so I think it’s a problem related to the compass. What checks can I do?
In many other builds I have never changed the yaw of the compass and never had a similar problem.

Just keep far as much as possible the compass far from electrical wires… frame and antennas.
Gps and compasses can suffer magfields if too close to the frame… antennas and wires

Thanks Dave, but I don’t think it’s an interference problem, otherwise it wouldn’t fly in loiter and it wouldn’t keep the position perfectly leaving the radio sticks.

Loiter work properly when you have a good gps lock… low interference on the compasses etc.
Check the offsets of your compass… vibrations

1 Like

Hi Alberto-Let’s take a look at the flight log. Have you calibrated with Magfit? But I’m not sure how a compass problem would cause that climbing in Auto issue.

I going off the reservation a tad but placing a long mast is not what i do, I think your adding more issues. You will see frames like the DJI are only a few mm away. I do the same as DJI and normally have the GPS very close to the body this will reduce any movement.

1 Like

Hi Dave,
yes I also calibrated the compass with magfit but nothing seems to have changed. I’ve put logs here and I don’t think the lidar and sonar sensors are the problem (it happens even if I disable them). I’ve never had this happen to me in 7 years of ardupilot builds. While I was looking at the advanced settings of the compass in the wiki, I noticed that it is indicated to do the calibration of the accelerometer first and then that of the compass. When I moved the gps to the 3d printed support, I did NOT do the accelerometer calibration again. Could this be the problem?

While I agree that the unwieldy mast presented in the first image is likely overkill, I’d also caution against using DJI products as a point of comparison. DJI likely spends a lot of time analyzing interference and shielding so they can achieve their compact form factors. Users here probably shouldn’t simply copy DJI’s physical appearance/design attributes without understanding that much.

I’m re-tuning a small Copter this week. Here’s where the Matek module I’m using resides and performs without much issue, though it is admittedly very close to both the battery and motors. I’m considering re-printing the tiny mast to move it up, even with the top of the battery to improve low-elevation satellite reception.


To answer the OP’s question more fully, GPS lock is recommended during compass calibration for determining the scale factor parameters. If you calibrate without GPS lock, you’ll notice that COMPASS_SCALE remains at 0, and your calibration likely has room for improvement. It might be good enough to get flying and perform a compass learn or MagFit procedure, but I wouldn’t leave it alone after an indoor calibration without GPS lock. However, lacking the scale factor parameter would not do much to explain a fly-away situation as you describe.

1 Like

I don’t see anything in the log to suggest a mag problem. I don’t use rangefinders so I’m not sure how to analyze the results but there seems to be something funny going on with the Bendy Ruler data. You have it set for vertical and it’s switching between active and inactive (OABR>ACT) during this event. I could be way off base here though.

1 Like

Someone recently posted a photo of a DJI product mainboard. There were shield boxes around almost all the components.


I think you’re onto something with vertical OA behavior, Dave. I’ve experienced some ugly behavior with BendyRuler in Rovers that is likely analogous.

1 Like

I was going to ask you about that in another thread. When I’m back home with all my RC stuff at hand I want to check into that.


I don’t know if there is some problem with the arducopter code, however when I had the gps on the stylus I was able to reproduce exactly what is visible on the wiki. The copter flies the route between two waypoints, but if it encounters an obstacle, the copter jumps the obstacle and then resumes the mission. Since I moved the gps the problems started. The misbehavior happens even if I disable lidar and sonar (auxiliary aux functions), I can try to physically disconnect them. However even with the GPS on the rear, the loiter works well (the copter is stuck in the sky) and the lidar and sonar behave as expected.

My copter behaved like this with the gps on the stylus:

here you see the lidar sensors as altimeter and sonar as obstacle avoidance working

Not sure then. But it does seem to be trying to avoid something that presumably isn’t there during that Auto Mission. Got a log from before when it was behaving normally w/o an obstacle?

unfortunately I don’t have any videos during the mission (if I don’t solve it I’ll make a video it could be useful to solve a bug). I had placed the waypoints at an altitude of 8 meters and the copter instead climbed autonomously to about 38 meters above a free field with no obstacles in front.

I’m looking to see if I have a GPS log on the stylus

Shifting the conversation to your new thread, since it seems we can rule out compass issues.

Strange behavior in auto mode - ArduCopter / Copter 4.3 - ArduPilot Discourse

1 Like

Just a simple comparison and is relevant. I just flew a DJI 250 and it’s on my brain.
Here is my placement if better served…

1 Like