Waypoint tracking failure

I’m having a really hard time troubleshooting the WP tracking on a 3DR Y6B with Pixhawk using Copter 3.2.
It appears to be a compass issue, but not like one I have heard of before. I have a simple test grid with spline turns like this:
[attachment=4]mission with spline.JPG[/attachment]
Everything seems to track well until I get to WP9, when the heading gets messed up. Sometimes this leads to aimless 360 degree turns, like this:
[attachment=3]heading fail at WP9.JPG[/attachment]
(see 36.bin)

Since I had to move my battery to the top of the copter to make room for the mapping camera, I added an external magnometer to the bottom of a leg:
[attachment=2]copter magnometer.jpg[/attachment]
I have done countless Compass Calibrations, and get all single and double digit offsets on Mag 1.
I’ve done a CompassMot and it looked good.
I’ve check vibrations, and they are within tolerances.

What is strange is that the problem always occurs in the same place. Sometimes I get lucky and it tracks much better, but still shows a heading and track deviation in the same spot.
[attachment=1]38bin better tracking.JPG[/attachment]

I was limited to 5 attachments so I will add them here.
38.bin was the more successful of the two flights discussed above.
The .tlog is from the worse of the two flights, and goes with 36.bin in the last post.

Here is an analysis of the better flight, 38.bin.

[quote]Log File C:/Users/USER/AppData/Local/Temp/tmpE86F.tmp.log
Size (kb) 3454.6767578125
No of lines 46236
Duration 0:03:10
Vehicletype ArduCopter
Firmware Version V3.2
Firmware Hash c8e0f3e1
Hardware Type
Free Mem 0
Skipped Lines 0

Test: Autotune = UNKNOWN - No ATUN log data
Test: Balance/Twist = GOOD -
Test: Brownout = GOOD -
Test: Compass = FAIL - Large change in mag_field (64.78%)

Test: Dupe Log Data = GOOD -
Test: Empty = GOOD -
Test: Event/Failsafe = GOOD -
Test: GPS = GOOD -
Test: IMU Mismatch = GOOD - (Mismatch: 0.15, WARN: 0.75, FAIL: 1.50)
Test: Parameters = GOOD -
Test: PM = GOOD -
Test: Pitch/Roll = GOOD -
Test: Thrust = GOOD -
Test: VCC = GOOD - [/quote]

It looks like my Compass is still an issue, even with all that I have done. I can’t find where to plot the mag field, I just see the mag x,y,z, and offsets.

Thank you for any hints you can pass my way.

I also would like to add that my loiter is solid with no toilet bowling.

Something does seem off I think with your compass. Your Mag1 MagZ changes an awful lot, I think it it should remain fairly constant in level with minor changes for maneuvering, yours ranges from 350 to below zero for the period it looks like its flying going of gps alt. Mag2 has very high offset, but guessing that’s the internal one, not too familiar with pixhawk.

Comparing to one of my logs with similar pitch/roll angles my MagZ stays up at between 450 and 350. I know the level will be different for your location in the world, but I don’t think Z is supposed to change as much as it does with yours.

That screw near where your compass is cable tied on is that steel or even stainless steel (some is slightly magnetic I believe). Is the compass properly secure? It moving will affect it. Do the legs vibrate that may affect compass or confuse the brain?

Other thing is have you rejigged your mission so see if the issue is geographic? I can;t imagine it is, but would be odd of the behavior occurred at a certain position. Other thing to watch if not, is it time related?

Agree with Stu.

There is something seriously wrong with your Mags. Both of them. Both show very large changes in the Z-axis field, when these should be much more stable. The X and Y will usually change a lot throughout your flight, and Z will somewhat, but it should not completely invert like that unless you’re flipping the quad. And they are both doing the same thing.

The mag field change is also very strongly correlated with the Roll and Pitch angles which you can see if you plot both together. It is also correlated to the total throttle-output.

It would seem to me that since this affects both mags, there is some sort of very strong magnetic field effect around your quad. Possibly your battery or power wiring.

Also, I notice that you did set your compass orientation to something other than 0, which is good. Are you sure it’s correct though? Hard thing sometimes, those compass orientations. Actually, you probably do have it correct, because the X Y and Z readings correlate well with X Y and Z on the internal mag.

Out of curiousity, do you have the camera on a gimbal? If so, what type?

Rob,
Thank you so much for your valuable time.
I didn’t have a camera or gimbal for these test flights. I used a 5000 3s as ballast. I did a compass calibration like that and got good offsets. I’m baffled as to why my offsets are good, my compassmot is good, my loiter is good, and only the end of my auto mission is messed up.
I’m quite certain the orientation is correct, because I see no compass mismatch.
I’ll post more photos of the copter later today, maybe you can spot something I hadn’t thought of.

[quote=“RabbitStu”]Something does seem off I think with your compass. Your Mag1 MagZ changes an awful lot, I think it it should remain fairly constant in level with minor changes for maneuvering, yours ranges from 350 to below zero for the period it looks like its flying going of gps alt. Mag2 has very high offset, but guessing that’s the internal one, not too familiar with pixhawk.

Comparing to one of my logs with similar pitch/roll angles my MagZ stays up at between 450 and 350. I know the level will be different for your location in the world, but I don’t think Z is supposed to change as much as it does with yours.

That screw near where your compass is cable tied on is that steel or even stainless steel (some is slightly magnetic I believe). Is the compass properly secure? It moving will affect it. Do the legs vibrate that may affect compass or confuse the brain?

Other thing is have you rejigged your mission so see if the issue is geographic? I can;t imagine it is, but would be odd of the behavior occurred at a certain position. Other thing to watch if not, is it time related?[/quote]

@RabbitStu,
Thank you for your response. That screw is stainless steel and appears not magnetized just observing a compass needle. Before I relocated the magnometer to the rear leg, I was using the mag imbedded in the 3DR GPS which was elevated on a mast. The results were much worse then because the 8000 mAh 4S battery lives on top, in close proximity to the gps.
The Mag PCB is attached to the leg with servo tape and backed up with a zip tie. Vibration on the leg is something I hadn’t considered.
However, I think the fact that both the internal and external mag are showing abnormal magZ values points to a common source of magnetic disturbance. I just can’t imagine what it could be.

Here are some photos of my 3DR Y6. It is mostly stock with the following obviously significant exceptions.

  1. The external magnometer is on the rear leg, not in the GPS.
  2. The battery is moved to the top of the copter to make room for the payload.
  3. During testing ballast was used, a 5000mAh 3S Lipo and a Wattmeter.
  4. The strobe on the bottom was just added and was not in place during testing.
    This is the bottom. The Magnometer is hard to see, it’s under the red zip tie. Better photo s few posts back.
    [attachment=0]ImageUploadedByTapatalk1422344967.415186.jpg[/attachment]

[attachment=1]ImageUploadedByTapatalk1422345164.598096.jpg[/attachment]
[attachment=2]ImageUploadedByTapatalk1422344967.415186.jpg[/attachment]

Can anyone guess what might be causing such magnetic interference?