Spontaneous CCW yaw in position control / mission / RTL modes

#1

During the flight tests of our quadcopter (Tarot 650 frame, Tarot 4114 / 320 motors, pixhack FC) we’ve encountered quite strange behaviour with regard to yaw control: in position control mode the 'copter at some point yaws approximately 90 degrees in counterclockwise direction and then rotates back into original position, all by itself (sticks are centered, etc). The rotation takes about 1-1.5 seconds and looks quite smooth. Here’s the flight log of such a flight: http://logs.px4.io/plot_app?log=724f8712-13cc-41a6-b8c1-fcc349a431a9

We’ve tried doing a short autonomous flight in mission mode and this behaviour manifested itself like this: while in flight the 'copter kept rotating in counterclockwise direction at a steady pace. It went through all waypoints and landed itself with acceptable accuracy, though. Here’s the flight log of the flight in mission mode: http://logs.px4.io/plot_app?log=dc7493ea-d359-405d-abd7-7e5c4019954e

I’ve tried flying the 'copter in stabilize mode and I’ve never noticed any problems with spontaneous yaw. Flight log of the flight in stabilize mode: http://logs.px4.io/plot_app?log=540e6335-a755-4707-9538-229c2d5bc823

We’ve calibrated all sensors (including magnetometers) a couple of times with no effect whatsoever.

What’s even more strange, we actually did tests on two different locations on that day (separated by about 10km) and this yaw problem only manifested itself at the second location. The flight log from the first location, when there were no yaw problems, looks like this: http://logs.px4.io/plot_app?log=25f46bfb-4389-40e7-b06d-07f96094121e

What might be the cause of such behaviour and which actions could be taken by us to fix it? It seems, it might be something connected to the magnetometer(s)? We haven’t tried swapping out the GPS/compass yet, could that help?

#2

What’s your hardware setup? Autopilot, GPS/mag, how it’s connected, etc.

#3

Pixhack 2.8.4 (not sure if those numbers mean anything at all), UBlox NEO M8N GPS + compass (something like this: https://www.amazon.com/Hobbypower-NEO-M8N-Compass-Folding-Controller/dp/B00WME95LM). GPS+Compass “puck” is placed on a stand and is quite far away from any electronics. Is there any additional information, that I could provide?

#4

I was wondering if your external compass might have the wrong orientation, but haven’t had a chance to dig into your logs yet. If you have a different unit I’d give it a try. Make sure you do the full mag calibration cleanly away from other objects (buildings, cars, etc).

#5

Not sure if it’s the same thing, but I’ve noticed a strange bug where the drone points due North at the first waypoint of a mission, and then rotates back to fly towards the next waypoint. It might be a bug on my waypoint generation though (custom software), so it might not relate to this.