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

  • Hey Guys,

    First of all a big thank you to all of you that are participating in the development of this amazing project. I really got sucked into this big time and it has been an extremely steep - but fun - learning curve for me so far. It's absolutely amazing to read and learn about this, so thank you!

    Now as many of us I have difficulties of getting my Y6 airborne. When I increase the throttle the back arm of the "Y" stays behind as the front arms want to go up. I can't figure out how to stabilize it via my RC as the Yaw is  intense. In other words its not flying.

    I tried the Manual Calibration as well. This gives me the following values:

    COMPASS_OFS_X: -55.170036

    COMPASS_OFS_Y: 30.484236

    COMPASS_OFS_Z: 33.275005

    But still it hasn't been successful. Please help! :)

    Cheers,

    Paul

  • Developer

    @Jason Wise: Awesome! I'm glad to hear this worked for you. There is an even better compass calibration routine coming soon. ArduCopter is only getting better... :-)

  • I must say, this info/tweak has been a god send!

    Prior to the calibration option, all Ive done is grown a few more grey hairs due to my hexa flying wildly! I tried the calibration option manually and there are no more extreme yaw/banking/flipping/bouncing issues

    My faith has come back to APM!

    Well done to the collective effort of the developers and all us testers who make this hobby what it is!

    Genius Stuff!

  • Developer

    @Dani Saez: I don't think so. Without offsets your flight control could be quite awful. It is enabled by default because if you forget to manually calibrate your offsets, at least this is there to make sure some offsets are entered. I think you are concerned because the on-board automatic calibration is currently not working very well, but that is going to change with the next release. At that point, users will not have to use the manual calibration at all and this is how it has been for quite some time. This recent need for the manual (Mission Planner) calibration is a transitional solution until the automatic calibration is back to operating at its full potential.

  • Adam,

    shouldn't this be disabled by default, and let whoever wants to use it, enable it??  if people don't know this is activated, is it going to affect their flights?

  • Developer

    @Dani Saez: Yes. Compass learning is on by default. You need to set that to zero to disable it.

  • Developer

    @John Stuart: NICE! Very happy to hear that! There is even better compass calibration coming down the pipe soon so stay tuned...

  • Adam Rivera posted:

    @John Stuart, No problem. I hope it helps you. If it doesn't though, please post logs back here for me to look at. Thanks!

    I've just test flown a new quad setup using an APM1.4 (2560) and the latest firmware via the MP. This uses an xAircraft quad frame, xAircraft 3s motors (provisionally) and jDrones ESCs. The APM is mounted using vibration-dampening mounting screws. All the electronics fit under the black plastic hood, which makes it nice and neat, as well as protected from rain and impacts. The ESCs are mounted on the arms, beneath the prop wash. Had to modify the ESC bays to contain the larger ESCs. Will post pics and write up in a blog next week.

    Anyway I did the compass calibration using live data and very happy to report no random yawing! Not only that but in general the quad flies beautifully with the default settings in the firmware. This is the happiest I've been with my AC in a long time - thanks AC team!

  • Hi,

    keep an eye on the COMPASS_LEARN value, I just load 2.5.3 for my Y6, and it came enabled by default (value 1), that means that for everyone not knowing about this parameter, it will keep "learning" on every flight, is it so??

  • Developer
    Robert: Awesome. Thanks for posting that!
This reply was deleted.