Developer

RESOLVED: ArduCopter 2.5.3 Yaw Issues

3689449977?profile=original

I just finished a long debugging session with Andrew Tridgell and he has discovered the cause of my yaw (and attitude) issues. In case you don't know Andrew Tridgell, he is the genius developer who made the the latest release fly so well with his DCM improvements.

I think the majority of people out there are experiencing this issue can fix the problem very easily.

"So, what is it?!?!"

It turns out that the automatic compass calibration code on the APM does not work so well. I suspect it is working even more poorly under 2.5 because of the improvements to the DCM, but that correlation has not been confirmed. Like most of the users out there, I have never given more than a moments thought to compass offsets because they have been set automatically for as long as I have been a user, but it turns out they have an enormous impact on the performance of one's copter.

First, what are compass offsets? The offsets are three values that account for the difference in the magnetic field of the earth and the magnetic field that your copter experiences due to interference created by the ESCs, motors, etc. So, the magnetic interference can't possible effect heading that much, right? Wrong. If you don't believe me take a look at this graph:

3689449977?profile=original

You can see that towards the beginning of the flight when I am not doing much, the red and green lines are not that far off. As the flight continues and I start using more throttle, they are way off. At about 5:20:20 my heading is off by about 250 degrees. That is massive!!!! So why does it change throughout the flight? The more throttle that is applied the more current is flowing through one's electronics which increases the magnetic interference. Normally this field offset is accounted for, but recently I suspect that some users have bad offsets like I did. My offsets were essentially 1,1,1 when they should have been -180,3,52. Check out the next graph which shows the effect throttle has on the magnetic field:

3689450007?profile=originalThis is a log from another user, Marco Robustini. The green line shows the throttle and the red line shows the magnetic field. You can see that as the throttle increases, the magnetic field more than doubles.

So how do you fix it? There is a new feature in the latest Mission Planner that allows you to use a telemetry log to determine the offsets OR you can calibrate your compass in real time by holding and spinning your copter 360 degrees. It is highly recommended that you use the telemetry log method. The reason is that when you are holding your copter and spinning it, you are not accounting for the amount of mag interference from the motors (because they are hopefully not running :-D ). Follow these steps:

With Telemetry Log (recommended)

1. Connect to your copter via telemetry.

2. Take off and fly around for a few minutes like you would normally fly. At this point we are collecting data about the magnetic fields during flight.

3. Land and disarm.

4. Download the tlog from that flight. (Instructions here: http://code.google.com/p/arducopter/wiki/AC2_Logs)

5. Connect to your board

3689450031?profile=original

6. Goto the Configuration tab

3689449991?profile=original

7. Click on the Setup tab

8. Click on the Hardware tab in the popup

3689449825?profile=original

9. Click the "Calibrate" button

10. Click "No" when asked if you want to use live data.

3689450040?profile=original

11. Browse to the fresh tlog

12. Your offsets are now saved

Without Telemetry Log

1. Follow the above steps 1 through 9

2. Click "Yes" when asked to use Live Data

3. Rotate the copter 360 degrees

The calibration utility is leagues ahead of the automatic calibration on the board that most of us are relying on. Many thanks to Andrew Tridgell, Michael Oborne, and all the devs who had a hand in the compass calibration utility in the planner. There is some serious brain power behind these features we take for granted.

Andrew Tridgell is working on improving the automatic calibration routines that reside on the board based on the updated (and original) algorithms by Bill Premerlani, but for now the Mission Planner calibration is everyone's best bet for improved flight performance.

If you have any questions just leave a comment.

Thanks,
Adam

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Hi All, Happy New Year and hope you are all well.

    I have an issue with my Hexa that I hope someone can help me with. Looked through the forum, and seemed to be not getting the right info. Hope I am posting this in the right place, and sorry about the long description.

    I've built my Hexa with the APM2.5+uBlox Lea 6 GPS+3DR 433 radio telemetry and JDrones Hexa heavy lift kit (880kV motors, 30A ESC, 12x4.7 props). Setup everything correctly I believe, as the flight seems stable enough.

    But for controller, I am using the cheaper FlySky FS-TH9X and included Rx.

    All connections seem to work fine, and link to Mission Planner works fine as well. On flight, it takes off stable but after a few seconds of flight(Stabilise+Simple mode), the altitude will fluctuate even though there is no movement on the throttle stick. Tends to want to drop more. So I have to punch throttle to lift, but that overcompensates, and the cycle goes on. (All settings on the radio controller is on linear, stock settings) The GPS blue light is blinking regularly, and on Mission Planner, it indicates 3DFix.

    Also, the front/back movement drifts. When taking off, and I move the hexa forward, it does just that, relative to my location. However, after a few seconds, the forward stick drifts to the right by about 30-45 degrees, so forward is not real forward, and the hexa becomes very hard to control.

    One note: I did mount the APM in a plastic name card box with foam underneath, and tied down the APM with cable tie. Tried covering the barometer with cotton as instructed, and it is the same with and without the cotton.

    Also, noted there is unfortunately more vibrations on the motors, hubs and props than a DJI for example. From what I've checked, the hubs seem to be contributing the most to vibrations.

    I hope you can help me or point out where I can find help for this. Thank you.

  • Is there any movement to enable the log calibration to read the onboard logs?  Not everyone uses telemetry (I don't), but onboard logging is enabled by default on 2560-based AC2 firmware.  I'm getting serious compass calibration problems, possibly the cause of this awful bug:

    http://diydrones.com/forum/topics/rtl-error-drone-flies-away-at-hig...


    I'd like to try log calibration but for the meantime I have to use live calibration and I can't trust the auto-learning feature. 

  • Adam:  Thanks for the reply.  Yes I do have telemetry. 

    I should have done the following test sooner.  I just ran the compass test in CLI mode and I'm getting the following message:  "not healthy".  Any remedies to cure an ailing compass?

  • Developer

    Rigel: Do you have telemetry? Tlogs only contain data if you are using telemetry. Regardless, you should update to 2.6.

    Nice Magneto image BTW :-D

  • 3692450776?profile=originalMagneto's messing with my copter!!!

    I've tried all methods in MP and I've been ending up with the following message using the tlog and manual method:

    3692450835?profile=originalEntering the declination manually doesn't seen to work as my compass is close to 90deg off.  Furthermore the bearing slowly drifts both on the ground an in flight.

    I'll try twisting the battery to ESC wires next.

    Any ideas anyone? 

    By the way I am currently flying ArduCopter version 2.5.5

  • I was noticing significant changes in my compass readings as a function of motor drive. I have a current sensor on my quad so it got me thinking that maybe there would be a nice relationship between current and the compass offsets. First thing was to run the compass calibration with live data (with motors off). I then placed the quad on the floor, held it down, and ran up the throttle. Rotated the quad 90 degrees and did the same thing, then another 90, then one more. After extracting motor current, heading and the three mag_x/y/z and dumping them into excel I plotted the result - it is shown here as "Uncorrected Data". 3692391799?profile=original

    I then worked out how much mag_x, mag_y, and mag_z changed as a function of the current - it worked out to +2.28 units/amp for X, -1.36 for Y, and -0.4 for Z. I then modified compass.cpp to make the correction based on the current. 

    I then re-ran the test and got the following results:

    3692392077?profile=original

    The extent of the improvement varies, but I was running at about a 30 degree heading error at a heading of around 240 degrees, and after the correction was below 10 degrees. Seems to fly fine in stabilize mode, but too windy to head out to the field for a real flight. Maybe tomorrow,

    Presumably the errors are also a function of how the quad is being manouevered (different motor currents in each motor), but this is a still a reasonable first order correction. I think that it would be fairly easy to collect the three parameters needed as a setup function - going through tlog to Excel was a bit painful.

  • Thanks Adam,

    Yes I'm waiting for on-board compass calibration indeed. Anyway till today I never had yaw issues since I loaded 2.5.3 version. And now I see the problems of all persons that have written aboutt it.It was really awkward.

    Thats why I tried to do with it something.

    For now I'll try live data for calibration, even if these don't regards noise from ESCs. But better than nothing.

  • Developer

    @palo sestak: No. But you can try to calibrate the compass without the tlog. That can be achieved by clicking "Yes" when asked, "Use live data or log. Yes for live data." Then take your copter and rotate it around all of its axis. That should be better than nothing that this point. As I am sure you have read in this thread, a new on-board compass calibration is coming soon.

  • Is there a way how to convert log files to tlog? Since I have no xbee modules I can't get tlogs from real flight, only store log files from flight. But when I want to calibrate compas there is only tlog option to load ;o( one can't load log file.

  • :p

    Well... let me think about it...

    Ok count me in haha :D I'll PM you soon.

    Cheers! ;)

This reply was deleted.