Fast-track PID lop setup

3689444449?profile=original

Last August I posted a blog "New offer of help with tuning PID loops" putting forward the idea of applying control doublets to a fixed wing aircraft in flight and using the responses to capture stability derivatives and decide autopilot gains. At that time I only had simulation results and was seeking flight test data. I have since got hold of some flightt test data  and analysis confiorms that my processing concept does work.

The first step is to fit a model of the aircraft response to the real data. Once this is done (the software only takes seconds) I've got an airframe transfer function from which I can directly calculate autopilot gains and stability derivatives which I can plug into an aircraft simulation.

Since autopilot gains need to be matched to vehicle aerodynamics, with further development, this scheme could end the era of triasl-and-error autopilot tuning. In the near term, if anyonre is interested, I could act as consultant on individual projects. Over the longer term, I could work with someone to package up the algorithms into existing autopilot software or perhaps and App with a view to bringing something to market.

 

E-mail me when people leave their comments –

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

Join diydrones

Comments

  • George, I think your last question is the most important one in the scope of DIY... The goal of most people will be to just let the plane fly autonomous at all. So some see your offer as a way to make this easier. For this task I´m not sure if its possible to derive a breakdown from the quite complex task we are talking about in the optimization view. To get as much efficiency as possible, parameter identification is the way to go, no question... Probably we should discuss details of theory and methods off thread to keep this one on track ?

  • Hi MarcS

    You make some good points in your comment; I'll try to deal with them in turn.

    Firstly, you are correct - the scheme does involve model identification followed by parameter calculation.

    I too have seen university dissertations where the final model hasn't been a good match to the real world. To achieve success in airframe parameter identification, it is critical to have the right approach. Simply treating it as a modern control problem will probably fail because not all the stability derivatives are observable. What is needed is a mix of modern control and aerodynamic knowledge. I hope you will agree that the gyro output comparison I show in my blog post diagram is pretty good.

    Deciding on the doublet amplitude and timescale is a key issue and there is some trial-and-error required. R/C aircrfat are usually quite stable and respond quite quickly to step inputs. I have found that control deflections of +/- 1-2 degree and switching times of a second or two deliver analysable responses.

    I'm afraid i don't go along with your ideas on gain selection. In a book on Airplane Stability and Control by Abzug & Larrabee there is a whole sub-section devoted to "failed application of optimal control" and another on the deficiencies of adaptive systems. I know about aerodynamics and I have been designing autopilots all my life. My approach is to "pre-design" the autopilot and express gains in terms of the coefficients in the relevant aerodynamic transfer function. This means that once a good model of the aircraft response is obtained, the autopilot gains will immediately be available.Furthermore, they will vary with speed since the coefficients in the aerodynamic transfer functions vary with speed.

    Your last comment that one of the fun parts is doing the tuning is of particular interest to me. Making the aircraft fly under closed loop control is one thing and will be a cause for celebration; making it fly well is quite another. To make an aircraft fly well, everything matters - aircraft static margin,bandwidth of the control surface servos, bandwidth of inertial sensors and the physical location of some of them within the aircraft; last but not least autopilot gains. I can now see that my offer of help with PID loop tuning may only be of interest to those who want to make their aircraft fly well so that they can, perhaps, do something else with it. 

  • Hi Andrew

    In my blog post I didn't make it clear that my baseline design envisages a flight to capture data followed by processing on the ground. We therefore seem to be thinking along similar lines though you don't say whether you envisage injecting doublets during your flight. In my simulation, as an alternative to doublets I have looked at generating random noise on the elevator. I think this could work as well but I need to do more experiments.

  • Developer

    Thanks George, a very good foof for thinking...

    Regards, Jean-Louis

  • Hi, from reading the description this is model identification followed parameter calculation for the PID?

    I know some universities doing or having done research in this field and even when the methods were using more or better sensors (IMU, Alpha/Beta probes etc..) in the planes and quite complex analysis, the models calculated were far from perfect. So I´m a bit sceptic, to be honest... The questions of Saad are correct, its some trial and error to find the inputs fitting the plane for the doublets (my experience...).

    So for a project like APM I think there are approaches which are closer, like adaptive control (no magic, already demonstrated in Paparazzi, but still not finished) or an automated realisation of the "classic" PID tuning strategies (e.g. Ziegler-Nichols)... http://www.mstarlabs.com/control/self-tuning-pid.html

    In the end, I think it´s one of the fun parts doing the tuning. After some time, you don´t need more than one flight to get it done :-)

    Online Self-Tuning PID Controller
    Extends the self-tuning PI controller method to PID control, with a re-introduction of classic tuning rule technology to stabilize convergence.
  • Developer

    Great stuff!

    Ideally what I'd like to do with ArduPilot is have a program that takes a MAVLink log of a flight and estimates the PID values from the flight data. This wouldn't be in-flight tuning, but would instead be ground based tuning, where the tuning recommendations come from an automated analysis of data captured from a real flight.

  • 3D Robotics

    Excellent diagram. Many thanks for posting that!

  • Hi George,

    Very nice post. And very nice idea. May i say that i've been thinking on similar lines too...but haven't implemented anything yet :) 

    Some question that i have in mind.

    1. What do you have in mind to ensure that when the tuning is run, the aircraft doesn't get really unstable (there is a possibility the first input to control surfaces is so big that it puts it into an unstable state and depending on the aircraft characteristics and how high it is flying, might not be possible to recover it)
    2. The idea, from what i understand, is to measure response from the input, thus determining the transfer function...what would you do when there are external factors present...like wind, etc? Would you just make it calibrate in fair weather or do you plan to include some type of statistical methods/filtering to filter out the external factors?

    Regards,
    Saad 

This reply was deleted.