Ardupilot compass issue: Desyaw variation

I am using Ardupilot v4.1.1 and upgrading may solve the issues. But, some custom features developed by our company havent been yet test on later versions of arducopter.

Issue description: We are using an internal compass on a medium size drone (around 25 kgs), and have done compass-mot calibration. However soon after takeoffs, we see sudden jumps in desired yaw without any pilot inputs. Any idea why it may be happening, and how the issue can be resolved? This results in drone yawing without any inputs upon takeoff. RCIN is within trims and deadzone value, so where is the desyaw input coming from?

I believe if it was a compass measurement issue, then actual yaw readings shall have deviated and not DesYaw.
The picture clearly explains the scenario

Please provide me suggestions to debug this issue!

If it happens after takke off at about two meters height, there is nothing to do about it, that is just the automatic inflight yaw calibration.

1 Like

One small jump is normal, with a simultaneous “inflight yaw calibration” text message. If you have more that one jump, that is not normal.

If this continues to happen during the flight, this might be a signal of failing to maintain a given yaw because certain motors saturate. Ardupilot recognizes it cannot maintain that yaw and gives itself some room by adjusting the desired yaw. A symptom of it is PIDY.Limit triggering from 0 to 1 on such events.

I had that in the past with a coax-copter, where the two motors had different yaw authorities because one was in the wake of another. The temporary fix that made it happen much less frequently, if at all, was to increase the yaw’s I-term significantly, and the I-term limit as well. But this generally indicates a vehicle design problem, and in this case you may want to explore a different motor wiring scheme.

Thanks everyone. Turns out I was stupid enough to look at the wrong part of flight. My team had performed an automission, and hence des yaw (commanded from CC) has increased without increase in RCIN. We still have some yaw issues, and I will be going to field to see those flights. Will get back to this thread in case I need further help

This image gives a better description of the issue. It happens generally in takeoff. Our customers prefer flying in loiter, and hence I believe such yaw jumps without inputs may result in toilet bowling. What shall I do? I am using an external compass for yaw currently.

As per my understanding EKF yaw alignment message occurs at 2.5m from takeoff if I use compass as my yaw source. The issue however is that there are significant jumps upto 25 degree at times. Also IMX,IMY, and IMZ are very high.
Why may this happen, and what is intution behind it?

Usialy the jumps are 5 deg max. I belive you have someting else wrong in your build.

Use mavexplorer to do an in flight magfit. But it does require ArduCopter 4.4.0.

1 Like

Okay. we are using 4.3.6 currently. Any clue where this issue may be coming up from?

Just for reference: Appx compass jump is 26 degrees. Variation in ahr2yaw is 15 degrees. Also after the jump att_yaw dips and comes back to des_yaw. However in flight i see rotation in one direction only, which makes me believe that aligned estimate is off by 15 degrees (ahr2 yaw change) and initial yaw prediction is off by 11 degree (26-15 degree)
We are using EK3_MAG_CAL = 4 here. However in flights with EK3_MAG_CAL = 3 (uses heading fusion and magnetometers) the jumps are generally around 10 degrees.

  1. Will it be an issue if i take off with such jumps in loiter mode ?
  2. Why do we have two models for yaw estimation:Magnetometer fusion and heading fusion?
  3. as per my understanding, Heading fusion is :directly taking magnetometer readings and estimating yaw,without using ekf; while 3 axis magnetometer fusion adds magnetometer readings to EKF? Why do we switch? and is my understanding correct?

Additionally in one of the logs I see yaw ground mag anamoly, which led to toilet bowling of vehicle and jump in yaw estimate by 60 deg (from 15 degree to 320 degree). This occurs at a low altitude of about 1m. Why is this happening and how can i prevent it in future?
Attaching logs in this thread 00000038.BIN - Google Drive

Also will this cause issues to control the drone in loiter mode

Have you tried this yet? Do you have an accurate current meter?

I havent tried yet.But does this mean that I am getting this issue because of interference due to current?

If you do not have a current meter and do not provide readings, how can we guess that?

If you have a current meter it’s pretty easy to see if the compass performance is tied to current flow. It’s very common and easy to address by running Magfit. But you need to have a functioning and accurate current meter.

I am using 4.3.5 currently, and also have a current sensor. The plot running magfit is attached.
How can i see if there is any issue now?

I performed a ground test, and this is the variation in magnetometer data, on ground without any change in yaw. Does this help to understand how intense magnetic interference is ?