Cube Orange+ resetting yaw and jumping EKF lanes

I have a hex that always veers off to the left or right on takeoff. Everything is great after the yaw reset. I dont like this behavior. I have 3 drones that are nearly identical, and only this one exhibits this behavior. This unit is a Cube Orange+ and the others are just Cube Oranges. I imagine this may not be relevant. I tried recalibrating the gyros, accels, and the compass. I also did a compass learn = 3 process. The problem never goes away. Link to the log is below.

I don’t see anything unusual in the log. The position controller appears unaware of any weird veering. How much drift are we talking about here - inches? Feet?
Also, what kind of guided command are you sending for takeoff? Does it do the same thing if you take off in Loiter/PosHold?

I flew in PosiHold mode. When I lifted off, I started to pitch forward and shoot over the trees. in 200 feet of forward motion, I was off about 50 feet to the side. I sometimes receive the yaw variance in the 30 to 60 degrees range. The copter usually autocorrects if I leave it in hover for about 10 seconds after lift off. If I don’t wait for the auto correct, I veer off considerably, with a yaw reset.

Oh, in that case, I don’t think this is the correct log. I don’t see anything like that in there. In this log, the drone hovers for 3 minutes and then does a short 3 waypoint mission.

Rick, I am sorry to have wasted your time. I had the wrong log attached. I corrected the link. Again, sorry.

I did a compass calibration again, and I toilet bowled. I am questioning the Here3 or something in the Estimators. Please let me know if I am missing something. Below is the link to the most recent toilet bowling log. You can see by the battery voltage where I dropped the 2 pound payload when the toilet bowling occurred. The craft weighs 11 pounds, and the pay load was 2 pounds. The craft toilet bowls even worse with heavier loads. Interesting fact: if I let it hover for a few minutes, the toilet bowling starts ever so slightly. It is like an underdamped rotation oscillation. I have attuned all 3 axes twice.

I just looked at the first log. The problem appears to be a very big magnetic interference from your motors. See compass 2 (green) jump as soon as you throttle up:

Interestingly, the compass that you have disabled (compass 1, red) is much less affected by this than the one you’re using. In the new log that you just posted, those compasses are reversed, but the effect is the same.

The solution is most likely to closely examine your build and make sure to move any motor wires away from the compass. Zip-tying the positive and negative leads together also makes a big difference; the magnetic field is generated by the open “loop” of wire and its strength is proportional to the loop area.

Also, double-check that you’re actually using the compass you intend to (the Here3 instead of internal, I assume). Besides that, you could do a compass-motor compensation calibration, but that requires a current sensor which doesn’t appear to be enabled on this copter.

Thank you Rick. Your analysis is spot on. The issue is now resolved. The cause was a poorly designed PDB, with too much loop area in the high current traces, shooting radiated emissions at the Here3. I moved the Here3 away from the being normal to the high current loops, and the issue disappeared. From now on, I will ditch to rubbish PBDs and use Advanced Power Drives PDB/DC-DC converter boards. They are far better built that most others I have used, and they actually understand EMI/EMC.