Elevator Gain Tuning

One of the most challenging aspects of autopilot setup is tuning the gains for a particular airframe. When the gains are tuned poorly, the aircraft my oscillate excessively, it may lag way behind the target pitch angle or roll angle or velocity, it may never reach the target values. Poorly tuned gains could destroy an airframe in a worst case scenario, but often people just live with non-optimal gains that aren't great but work well enough to get the aircraft around the sky. It's hard to know what gains to tune and why and a person could play with the numbers all day and only manage to make things worse. It's easy to spot a problem; often the aircraft will look like it is fighting itself even though it does make it's way to where it should be, or it just may not do what you ask it to do.The first half of the attached movie shows an example of badly tuned elevator gains, I make some simple improvements and then show the results. It's a windy day so don't expect perfection, but at least from the ground it looked rock solid.I have some more details and a link to PID controller tutorial I wrote a few years ago. Included in the tutorial are some different strategies and tips for tuning PID controllers.http://www.flightgear.org/blogs/curt/uas/telemaster/elevator-gain-tuning/
E-mail me when people leave their comments –

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

Join diydrones


  • Hi Chris, the core of the code I'm running is MicroGear.


    This requires something like a gumstix (linux/unix) to run. On top of that I've married a 15-state kalman filter (and a nice high end IMU -- vectornav).

    For the ardupilot portion of the hardware, I severely hacked the ardupilot code and added some of my own code for packet IO on the serial port.
  • Curt,

    You have done a very nice job there. Do you use Ardu code or your own?
  • Hi Chris: I'm flying a Senior Telemaster. My flight computer is a gumstix, I just use the ardupilot board for servo control and the manual fail safe features.
  • Moderator
    Here's a nice page on the PID algorithm for those who are more interested. http://www.jashaw.com/pid/tutorial/pid3.html
  • What airframe are you using? Very nice and stable. Ardu is looking great!
  • Aww, thanks for the long post. Sorry if I wasn't clear. I am aware of what the different components do, just wondered aloud why most guides mainly address the proportional part.
    What are your thoughts on using fuzzy logic?
  • Hi Maik,

    (P)roportional control is a good starting point for getting your feet wet, and in some circumstances, that's exactly what you want. For instance, a wing leveler: you know that you want zero aileron deflection when the bank angle is zero. You can simply drive the ailerons opposite the actual bank angle and proportional to the error ... so as you get closer and closer to level, your aileron deflection gets closer and closer to zero.

    But in the real world, airplanes are never rigged *exactly* straight and for a single prop, thrust is asymmetrical, so if you add an "I" component, you can zero out any of those biases. And with an "I" component on your wing leveler, you could keep your wings level even if you have substantial rudder input or your aircraft is off balance.

    For instance, I tape my camera a ways outboard on the wing so that I don't have to look through the prop. This puts the aircraft out of balance side-to-side. The "I" component on my controller zeros out this imbalance and keeps the wings level anyway.

    And in the case of the elevator, the neutral position you need to hold to keep the nose at a fixed pitch above or below the horizon will change substantially depending on your speed, so in for elevator you definitely need an "I" component if you want to be able to hit your target pitch exactly across a range of "trim points".

    The "D" component will react against too much change ... the idea is that if approach your target value too quickly, you will over shoot it and not arrive smoothly. So the "D" component of your controller will try to slow things down if you are approaching the target too quickly (or will add additional compensation af you are diverging from the target too quickly.)

    But you have to be careful with the "D" component. For instance, i was using throttle to hold airspeed, but my airspeed is noisy. As I get into more turbulent air, the airspeed bounces around more and more this can cause my throttle to not converge because the "noise" in the airspeed sensor makes it's looking like I'm converging or diverging too quickly and the controller tries to slow down the change in throttle position.
  • Why do pretty much all practical guides only address the P part of PID controllers? Is it that setting them up gives a good-enough response in real life?
    Curt, I like your sim a lot and have been toying around with an autopilot (coupled to FlightGear via a socket interface) based on fuzzy logic. That, in theory, allows even finer control, but my reason to do so was more because it's easier to implement advanced behavior. Say, advanced altitude controls for a glider, or using pitch for tight turns, etc.
  • In the first half of the video, the bobbing was actually quite noticeable from the ground. Once the gains were improved (second half of the movie) the aircraft looked like a steady rock in the air (from the ground-based perspective) despite fighting 23 mph sustained winds. I like putting a camera on board though because it shows every little nuance of what is happening that you wouldn't see from the ground. My telemaster continues to be a work in progress. :-)
  • Nice to see tuning tips from an experienced person.
    How noticable was the "bobing" from the ground? It looks bad in the video but at that height and "bob" it was probably only a degree movement.
This reply was deleted.