PIDs and stabilization

Discussion in 'Newb Guides' started by GJH105775, Dec 23, 2015.

  1. GJH105775

    GJH105775 Avid Linux User, and U.S. Air Force 1C6 Moderator

    I wrote this answer in response to this question("Why are quadcopters so stable?"), and decided I might as well post it here also.



    Multirotors unlike helicopters or planes are inherently unstable like a rock. If you were to power each motor up to the exact same speed it is unlikely you would get a foot off the ground before turning over. The quadcopter's FCB (flight controller board) makes several hundred tiny corrections per second just to hover.

    Most flight controllers use PI and sometimes D algorithms to decide how to make the corrections. If the motor reacts too quickly it will overshoot, and then try to correct it'self again and overshoot once more causing oscillations. if your settings are too low you will get a wobble or drift.


    P: Proportional, this is how fast/hard the quadcopter reacts to being out of level (or from where it should be, which won't be level if you are pitched forward with the stick)
    I: Integral, this is how much time you have been out of level. The longer you were out of level the more power the quadcopter applies to bring you back to level.
    D: Derivative, the derivative slows down the quadcopter's reaction of P and I. If your P and I are good the derivative can be a bit redundant, but it adds a cushion for people setting PIDs
     
    Kabuki and RGJameson like this.
  2. doug micheletti

    doug micheletti Well-Known Member

    Thanks for the clear definitions. I spent a day and four batteries (and several props) playing with these settings to get a handle on them and now my copter is much better. I need to go at it again as I went to 10" props on it and it flies better and longer but now drifts a bit. Worth doing the work for me. For the record - I am playing withmy sk450 with kk2.1.5 with stevis 1.8. It is finally working pretty good....
     
    Kabuki likes this.
  3. GJH105775

    GJH105775 Avid Linux User, and U.S. Air Force 1C6 Moderator

    Hahah, sounds great, does teh drift get worse over time or not? If it does it could be low I gain.
     
  4. doug micheletti

    doug micheletti Well-Known Member

    Not sure what it is. It seems to hold onto whatever the last input was and need to be corrected back to neutral. Then it is pretty stable. If I give it quick inputs - I get one oscillation the other way and then it levels so I am close. Maybe I have things set a bit too strong....
     
  5. GJH105775

    GJH105775 Avid Linux User, and U.S. Air Force 1C6 Moderator

    Hahaha, you have only stabilization enabled, might have to enable auto-level if your FC supports it.
     
  6. doug micheletti

    doug micheletti Well-Known Member

    Kk2 does not I believe. Still getting good flying experience. And stress testing a few props.....
     
  7. GJH105775

    GJH105775 Avid Linux User, and U.S. Air Force 1C6 Moderator

    It does, under settings make sure arm is set to sticks (if you don't have the AUX channel connected, if you do set it to AUX) When set to sticks it changes if you move the right stick across the roll channel all left or all right while arming or disarming..
     
  8. doug micheletti

    doug micheletti Well-Known Member

    I have this on aux and have beeen testing with it on. I guess I need a bit more tuning. Its a bunch closer than it was with the settings from hobbyking. I will give it another tweak next flight. Might be a couple of weeks though with the rain we have predicted now... more time to build on my other projects....
     
  9. GJH105775

    GJH105775 Avid Linux User, and U.S. Air Force 1C6 Moderator

    Make sure the AUX switch is setup on the Tx.
     
  10. Veejay

    Veejay Member

    Really cool thank you
     
  11. doug micheletti

    doug micheletti Well-Known Member

    The switch is setup and working and the mode changes on the display. Thanks for the writeup - I will have a print of this plus my stevis manual next time out.
     
  12. doug micheletti

    doug micheletti Well-Known Member

    Went out to do some tuning this morning and for the first time - I was able to get stable flight without the stabilization on. There is apparently a wide range that the PI settings can be in and get stable flying? Here are the supplied "correct" settings from Hobbyking for the SK450:
    Aileron and Elevator (linked):
    P gain = 50
    P limit = 80
    I gain = 30
    I limit = 30

    Yaw:
    P gain = 50
    P limit = 20
    I gain = 20
    I limit = 10

    Here is where I got to today. I had to stop because I landed rough and bent a motor mount - flipped over really nice after that...
    Aileron and Elevator linked:
    P gain = 35
    P limit = 25
    I gain = 15
    I limit = 20

    Yaw:
    P gain = 28
    P limit = 20
    I gain = 10
    I limit = 15

    Stick Scaling:
    Ail = 40
    Elv = 40
    Rud = 55
    Thro = 90


    I never got to re-setting the self level settings but currently I had P gain and limit at 60 each. I think I was using this to overpower incorrect P&I settings as I could not fly the copter without self level on. Here are settings I was using previously, but only flew with self level on:

    P gain = 35
    P limit = 50
    I gain = 20
    I limit = 30

    Yaw:
    P gain = 60
    P limit = 20
    I gain = 30
    I limit = 10


    I am now using my 9XR-PRO tx and I really like it a lot better. Using 30% exp on everything except throttle makes it much easier to make small corrections, and with the new settings - I can actually do a pretty good level hover even though there was about a 5mph crosswind today. This is by far the most stable I have had this copter and is the first time it would fly with manners with self-level off. Given enough propellers - I might actually learn to tune this thing! Thanks for all the help so far, and please feel free to comment on the settings if you see anything that looks off - I am still feeling my way and the input is welcomed!
    Thanks!
    Doug
     
  13. Altsickeness

    Altsickeness Quad Addict

    Hey guys,

    I got my QAV-R 220 up for its first flight. Overall its very stable, good throttle, pitch and roll response, but the yaw is terribly slow. To make one full revolution, it probably takes about 4 seconds.

    Im in cleanflight and yaw numbers are:
    P- 8.5
    I -.o45
    D - 0.0

    I'm new to pid adjusting but If I want to speed up yaw, I'm figuring that I need to increase these numbers correct? How much or how large of increments should I be increasing and what is the general rule to increasing and decreasing. Is there any general rule to keeping Pid x amount different from each other? I feel like I would need to increase it a lot to get a snappy yaw response, but I obviously don't know how sensitive the rate of change is. Any advise, general or specific is welcome.
    Thanks
     
  14. Altsickeness

    Altsickeness Quad Addict

    I figured it out. Looking at the Rate setting of zero, I thought to myself, "I wonder if 'rate' means the speed at which something moves?" So I turned up the rate to .25 and guess what? It worked! Yaw is quicker and more responsive. This little quad flies nice!
     
  15. Sparliff

    Sparliff Active Member

    So I have a zmr 250 .. 12a afro esc .. emax 2204 3200kv motors and dx8 transmitter with ar8000 receiver ...

    I got my quad second hand and had it flying from the get go but I broke the cc3d board and had to get a new 1.
    now after repairs and building a second quad myself I can't get my quads to fly .... I know nothing about the settings ...totally clueless and wondered if someone knew a set of pid settings to at least get the quads to fly .
    When I throttle either of the quads they flip to the left which makes me think it's setting related .
    Here are my settings and hope someone can help 20160508_192245.jpg 20160508_192234.jpg
     
  16. Altsickeness

    Altsickeness Quad Addict

    I would think the first firmware download would at least get you up in the air, even if it's jerky and wobbly and needs pid tuning. First things I would check is that your motors are turning the correct direction and that your props are on the correct motors. Left front and right rear spins clockwise, right front and right rear spin counter-clockwise. If they are not correct then change any two motor wires on the ESC and it should spin the other direction.
     
  17. Sparliff

    Sparliff Active Member

    Yeah motors r spinning the right way and the props r on the correct motor and the right way up.... all the quad setting have been calibrated in librepilot
     
  18. Altsickeness

    Altsickeness Quad Addict

    So when you got your new CC3D did you go through the set up wizard in Librepilot? Set it up level, Calibrate the ESCs, set motor start rpm etc.... ? The did you do the Transmitter wizard setup?
     
  19. Sparliff

    Sparliff Active Member

    Yeah did all that ... then took it out for a test flight and flip.... tried with the second quadcopter and that did the same.... both r exactly the same board ..esc...motors and receiver .... only thing different is the fpv setup
     
  20. Altsickeness

    Altsickeness Quad Addict

    You know the part in the Librepilot set up where you choose the quad frame you are flying? they have zmr 250, qav 250, emax nighthawk etc.... There's maybe 3 zmr 250 downloads, one with a mobuis cam. I think I tried that one once and it did the same thing. flipped right on take off. I switched to a different one and it was fine. Pick another download and see if it makes a difference.
     

Share This Page