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

  • Yeah, Olivier on the dev list wrote:

    I think that AC interferences are not a problem for the compass. All AC
    stuff after the ESCs should not have a great influence on the compass
    (to be verified) because we should have here a null DC magnetic field
    for each motor cabling.


    I think that the problem is located in the DC power cabling, between
    ESCs and batteries. Batteries alone as well can generate strong DC
    magnetic fields according to their internal geometry.


    This DC power cabling and battery powering can be optimized for low
    magnetic field generation, this work has been done i think on commercial
    project like Mikrokopter.


    DC variation are slow and depends only about global throttle and motor
    delivered to each motor.


    Fast variations should be filtered anyway by the compass inertia and
    digital filtering.

    The discussion is in "magnetic field strength and throttle" on the list. 

  • Developer

    Robert: Hm... I think both would cause interference. Maybe someone with more experience with that could comment. I am not qualified to give an authoritative answer. ( Maybe I should have held my tongue in the first place :-D )

  • Adam, I thought it was stated that it is the DC wires between the batteries and the ESC that cause the compass problems, not the AC wires between the ESC and motors.  Wouldn't that mean that it's best to keep the DC wires as short as possible?

  • Developer

    Steve: Yes, the further from the APM the better, but that isn't practical for all frames out there. If you are able to do that it will improve the compass reliability. The new learning algorithm should prove to be quite reliable even with the noise, but reducing the noise is a better solution. I fly a large octo (http://sentientdrone.com), and mounting the ESCs that far from the center would be more trouble than it is worth.

  • Also it sounds like for the magnetic compass, it could be advantageous to mount the ESCs near the motors instead of directly under the APM. It sounds like the range of errors that need to be corrected for would be reduced in that configuration. True?

  • I love this stuff. It is absolutely amazing what we get to play with! When I was in college (a long time ago) I did an internship with General Dynamics F-16 division and they were so proud of their inertial navigation avionics box. It was a big heavy FRU (Field Replaceable Unit) full of circuit boards. Now we have the equivalent of that FRU on a 4x4x0.9 mm chip. It just keeps getting better. This is the coolest hobby ever.

  • Developer

    Steve: The heading is the result of a mix from the compass and the gyros. There is an algorithm that checks one against the other and determine a reliable heading. If it weren't for this mixing, the heading would be just as sporadic as what you see in that graph. Good thought!

  • Steve, gyro will drift over a period of time, and for this same reason you cannot achieve autoleveling with just gyro but you also need accelerometer. You can't calculate absolute orientation position with it - it only gives you the speed of rotation (angular velocity) around 3 axis and if you keep the rotation constant it will drift back to no rotation reading.

  • Noob question - since the MPU-6000 has a 3-axis gyro, it seems like that type of "inertial compass" would be a better real-time compass (since it is unaffected by magnetic fields) than a magnetic compass. It seems like when you first started up, once magnetic north is determined, the gyros could track orientation after that. With all the smart people working on this then obviously it's not that simple. I'm just wondering why it's not that simple. Thanks!

  • Developer

    Angel: Sounds good. Just use whichever method you think works better. Updated compass calibration is coming after it passes some rounds of testing. The new calibration routines are expected to perform even better than what is available now. Good luck!

This reply was deleted.