I would not suspect a hardware *failure* - as the magnetometer test works.
But I do suspect some kind of APM bug that somehow does not wait for it to init fully - and some take maybe a little longer to get ready ?
Anyway - I reproduced the problem with APM on desk with only USB power connected. - reflashed several times, ane erased config/logs - the APM that is faulty, will always "think" it's booted in North direction..
I tried RMA at some point, but got the "it's open source" answer.
You might be onto something. In AP_Compass_HMC5843.cpp I see the following code:
while ( success == 0 && numAttempts < 20 && good_count < 5)
Maybe it needs more numAttempts or a larger good_count. Another thing to play around with.
I've strangely never had the problem when flying similar missions in an East-West direction.
Is the magnetometer susceptible to the same turn errors as a pilot's whiskey compass? This is the lead/lag when turning toward the east or west from a north or southerly flight. There is no lead/lag error when flying east or west.
Hi droners. After our discussion about the compass possibly being the cause of my woes I did some more test flights. I found that the drone that I've been doing most of my testing on is the one APM I have that has a seemingly faulty compass. My other drones don't have this problem. However, if I boot up with the drone facing north, it _mostly_ works. The compass, even with learning turned on, tends to drift out during the flight, however, so even it RTL works at the beginning, it may not function toward the end of the flight.
This APM has already been RMA'd to the factory (I couldn't get the radio calibration to work) but they couldn't reproduce the problem in the factory and it worked after it came back. Hmmm. Anyhow, it's a known-flakey piece of hardware. It occurs to me that I could put this APM in my plane and use the plane APM on a 'copter as planes don't need the compass.
In the meantime, I've found a workaround involving adding a small piece of apparatus to my drone (see attachment).
I was wondering whether the problem is related to hardware failure (mine has sure taken a couple of big knocks) or just interference. My APM2 also sits in a cramped space under the Ublox GPS such as I see in your photo.
Did your APM also take some knocks? and
Is there an option to mount the compass remotely on the APM2?
You should'nt put hardware with a know problem in any autonomous platform that flies. A rover would be better.
I've knocked my hex around quite a bit. Bent arms, broken motors, a couple of dozen props. I was going to rename it "Lawn Dart" for a while. Slowly but surely, I leaned to fly. Mostly to not overcontrol the hex.
But yesterday's flight was one of the best yet. (Arducopter 2.8.1, Mission Planner 1.2.17)
Here's my stack:
Haha... I tried you fix and... interesting, it didn't work! But when I tried starting the copter facing south it did (2 out of 2 flights). So for me is the opposite but yes, it looks related to direction at startup
Sorry for reviving an old thread, but I can't find anything newer relating to this problem!
I've been having the same problems as you have described. I'm running 2.9.1 on a quad.
I've looked through my logs, and I can see where it goes crazy, but I can't tell whether the compass it working normally or not. What parameters did you look at to verify correct/faulty operation of the compass? When the quad flies away, the compass seems to be just be reading normally.
Anyhow, my symptoms match identically to yours. Seems to be most likely to fly away in RTL mode, just as it's arriving at the home waypoint. Sometimes happens when switching in to Loiter, but less frequently...