Arducopter 2 stability patch

Hey, I had a little brainstorm last night after watching the DJI Wookong video. It's a sweet little system, but I wondered if AC2 could do that? So I put a battery on the end of one arm and it couldn't hold level. It came close but 3-4° error meant that it couldn't fly perfectly still. So during the ride in to work I thought of a way to rework the controller so it replicates my hand on the stick rather the the PI>PI rate controller we have now. 



I've never been happy with the Outer I term. It never really seemed to be very effective. I started thinking that my hand is putting a constant bias to the stick to get the perfect stability, so I could easily replicate that with the outer loop's I-term. I re-routed the Integral to directly sum with the rate controller output. I flew it tonight and it does work. I can hold perfectly level with a 22003S battery dangling from the arm. I think this is exactly what is needed for better Hexa/Octa redundancy.


Enclosed is the patch that works with 2.0.54. Just replace attitude.pde with the linked file. Then set your STB_PIT_I and STB_RLL_I to .1, and your limit to something high like 30° or 40°


Let me know how it goes for you and please let me know how you might improve it.





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

Join diydrones

Email me when people reply –


  • I installed 2.0.55 on my copter, downloads section says that it have stability patch already applied. But when i try to fly my quad-copter with small digital camera not in center it begin to drift to camera's side a lot. 

    Seems like it don't try to compensate this imbalance at all. Why it happens? Do 2.0.55 already have stability patch applied?

  • This is very nice,,
    Copter what is still using the remote or automaticfor landing and tagoff?
    I am also still trying to make Copter can be automated landing and tagoffandkeeping at an altitude altitude_hold 1m,,,
    to complete my final projectbut are still experiencing a difficulty bnyak ...
    if anyone can help me?

    thank you ..


  • I thought that the log issue was resolved now.

    But it isn´t, is it?


    Just tried 2.0.55 stability patch. MP 1.1.1:


    This after a total reset to factory settings, uppload with arduino, erase logs multiple times, reboot etc, etc...

    I am struggling with multiple issues and having reliable logs would certainly help...


    Meanwhile I am using telemetry logs but their usability is limited.

  • I think I will go back to the .55 regular version. I had two light crashes today in heavy grass so no damage. In both cases the crash was the same. The motors did a few quick surges like it was freaking out. I kept the log if you can make anything of it. I never had a crash like that before. I re-armed without even restarting and it was fine. About 4 flights and 2 crashes. Hopefully you can make out something from my log.

    2011-12-05 10-45-50.tlog

  • Stab Roll and Pitch I should be .1 and Stab Roll and Pitch P should be 4.6 and IMAX 40? I'm using 3DR frame with stock motors.

  • I installed the 2.0.55 alt hold zip and can feel the difference in flight characteristics. First I tried changing modes because I've been having problems since .50 with not being able to change modes in the air. Today I tried again and it's still the same.

    I held it in my hand and gave it about 30-40% throttle and changed modes and it worked perfectly. I could see the different modes change and the copter trying to do it's thing even though inhibited by me. I immediately set it down without disarming motors and took off. Tried to change modes and nothing. Pulled up the APMSetup/mode and it doesn't show that I'm changing the modes at all.

    I just don't know enough about it to know if it's a problem with the receiver or APM. It flies perfectly and today I tried simple mode for the first time. I had simple checked as flight mode 6 and I could see the effect right away while flying.

    Except I almost crashed because even though it was oriented away from me it first wanted to come at me and when I pushed the stick forward (not it was in normal forward orientation) it came at me faster so I switched quick out of simple mode and saved it. Tried it again at safer distance and it did the same. Is that because I just reset my APM after installing the update and the mag was not calibrated yet since it was the first flight? I had been flying around about 5 minutes before trying but not sure when the settings are saved. I have my declination set to 22.3 but maybe I forgot the negative sign?

    Well I would really like to solve this issue with the mode change refusing to happen unless I'm holding it. I can't see at all what would be the cause of that. Any clues on where to look for track down the problem???

    And yes I have solid blue on gps and solid red on IMU.

  • Developer

    I'm going to be doing these "patches" moving forward because I think the dialog is really helpful. I've been plodding along by myself far too long and people are a little wary of the multiple versions. The patches concept lets us all debate the merits and propose better solutions for each area. If it works, then it's included in the next revision.

    I just refactored the PI loop controller to make it more flexible to do these kind of changes to any loop. I've updated the Yaw as well, which I'll push out as a patch once I fly it tomorrow night.


  • I'm assuming this includes this patch?Arducopter 2.0.55 Alt_hold_patch

  • waiting for stability patch number x

  • Jason, how hard to apply "the patch" idea to the actual GPS loiter control loop?  I think it would also help with a persistent wind. 

    Also, does this patch apply to the yaw control as well?  Not sure if quads need it, but I think it would REALLY help tradhelis with the tail control.  Reason is, tradhelis have a persistent requirement for tail rotor thrust to counteract main rotor torque when trying to "heading hold".  It's not an issue with the tail velocity, but with angle hold.  So it's exactly analogous to pitch and roll angles.

    I noticed some slight tail waggling that I couldn't tune out with the PID, and I wonder if this is why.

This reply was deleted.