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

  • Developer

    WHOA! 100 props?! That is epic! :-D  You sound like the perfect beta tester... If you need help pulling from git and getting set up just shoot me a PM and I will try to help you out.

  • :-)

    I just ordered 100 props and an additional frame so as soon as that is in I can do some serious testing. I am just very surprised my current config isn't stable yet.... Any way.. to be continued... ;-)

  • Developer

    @Paul Emous: I think a release is slated in the next couple weeks, but its not officially planned quite yet. If you want to fly the latest code though, you can always pull it from git! :-D Just fly at your own risk; the bleeding edge of development can be risky, but the current git has been tested by the developers.

  • Makes sense. Can't wait for this... What is the roll out plan for this? :)

    Unfortunately I just broke my last prop during the calibration process and have to wait for my shipment of new props. I'll do some more reading in the mean time and will get back on my progress / tlog asap.

    Cheers, P

  • Developer

    @Paul Emous: That isn't surprising. Each flight will have different magnetic field attributes and thus generate different offsets. That is why you should choose a tlog that is representative of your normal flight habits. When the onboard automatic offsets code gets released, you won't have to worry about all this. This is an interim solution.

  • *every flight gives different offsets*

  • Hey Adam,

    Thanks, Yes I figured that out and installed the wireless telemetry kit (xbee). However, every time when I use a tlog after a flight the offsets are way different then the "manual calibration".

    Weird or interference of the cables?

    For example: Manual Calibration (live data) gives me:

    _X -78,40

    _Y 37,64

    _Z 103,84

    I had a "somehow airborne copter" that had a 20 meter radius to correct itself and then landed upside down. Using that tlog gives values that are that are completely different everytime.

    I am back into the field again. Will be back in 30minutes.

    Thanks :D

  • Developer

    I should have been more clear. You need to have wireless telemetry installed/enabled in order for the tlog method to work. The "t" in "tlog" stands for telemetry. If you do not have telemetry, that log will be empty and the calibration will not work properly. @Paul Emous: Is this the case with your setup?

  • Hey guys,

    Ok cool. I did a bunch of (attempts) of fly yesterday. Thing really want to go up so that makes me happy. I haven't been looking at PID tuning but as I can't get anything near a clean lift of I am certainly going to do that right now.

    BTW: Calibrating it with the tlog made my copter go nuts. the compass was of for about 150˚. But then again. I haven't had a every "stable" flight to do a "proper" to compare.

    Thanks again for the support.

    Keep you posted.

  • hi :

    I think the g.rc_2.pwm_out   is pitch   control output, to rear motors  is cos(0 ) =1 ,  to left and right motors  is cos(60) =0.5.

    To get a same  twist angle  , the mortor on  longer virtual arm  need more power.

This reply was deleted.