I've been reviewing the latest developments in "Adaptive Control" as opposed to PID control and came across this video of a quad adapting to a broken rotor blade. Hopefully, we will soon use these types of algorithms in our own diydrones projects.
I would love also to see / understand the algorithms that you are using in LabView.
I am very interested in auto-tuning some of the Proportional Derivative (PD) loops for the UAV DevBoard.
My main interest is to make Tuning much easier and quicker for new users of the UAV DevBoard. Even a small amount of auto-tuning could make the process much quicker and simpler.
@Ryan - Just turning the gains up it's not really a good idea. The PID's are designed to control a linear system, and when the blade breaks up the system changes completely. Besides, when you turn the gains up the noise from the IMU would make your system unstable.
@Roy - I think autotuning it's a very feasible solution for the Ardupilot system, in fact I have a labview program that does exactly what you describe... maybe we could adapt it
@Ryan - that's just what I was thinking when I saw the video - if the gains were turned up, the quad would have been fine (except perhaps for the yaw axis).
I'm also designing my own quadrotor (well who isn't :-). While I agree its probably not too difficult for someone who understands feedback control theory to tune PID gains, I don't think the typical hobbyist who just wants to fly their scratch-built quad should have to do this. The alternatives I thought of are:
1) Adaptive feedback. There seems to be a number of papers using adaptive backstepping control for quads.As was said earlier, this may not be feasible on 8-bit processors (although I've been surprised in the past with just how capable they can be)
2) Autotuning: using telemetered data to a groundstation to perform system identification and compute the gains (of course, this is really just a form of off-line adaptive control).
3) Robust control - use modern control techniques to ensure the control system can handle a wide variety of quad configurations.
The implementation was planned for a P-III running an embedded OS with MT-i IMU and a other expensive equipment, but I ran out of time and I could only develop the algorithm and made my tests on a matlab/simulink simulation.
As with any university research program someone else continued the work on the AP but I moved to another city and I don't know the actual state of the implementation... :P
The good thing of a neuro-fuzzy is that simplifies the complexity of the controller and thus it's easier to implement on an embedded environment... Other ways to reduce the CPU effort are to use a table of pre-calculated results...
I'm not an expert in ARM MCU's so I really couldn't tell if the two ARM7's will do... but if you optimize enough I think it's plausible...
Did you implemented it in a real embedded system? I mean, what kind of HW did you use? requirements etc.
I'm very interested in implement a neuro controller to cancel the non-linearity during some phases of the flight. Currently I developed an autopilot with 2xARM7 in parallel, but I guess I will run out out power processing and I will jump to one ARM9 (thinking in video processing as well).
I only was trying to explain with simple words what is an adaptive/robust control :P for people who doesn't know anything about it, don't take them literally.
With a "smart PID" (note the quotation marks), I wanted to mean there are techniques that cancel the non-linearity of the plant, and operating and simplifying (like H_inf technique for example), the control could become a "simple PID". But of course, as you are remarking, it could be complex as you want, there is not unique technique. Maybe I had to explain it more in detail.
With mathematical model, I wanted to mean to know the physical model and work in the state-space. Maybe my physics background is the responsible of this statement :P "forgetting" that a transfer function is actually a mathematical model.
I think the "success" of the tunning process depends on the expectations.
As an engineer I'm used to work until I get an "optimal" or desired response out of the system, but in practical terms, if the plane gets near enough to were you are trying to go, then you can call that a success, specially considering all the limitations of the system.
If you're auto-tuning the outer loop then the process gets a lot easier, because manually tunning one PID is not really that hard, you just need patience :D.
I actually made my master thesis on genetic algorithm tunning of a neuro-fuzzy controller for a UAV so maybe we could exchange ideas! send me a message if you're intrested.
Like I said I'm no expert in this field and my methods are fairly empirical so I might be wrong but in my subjective opinion tuning coupled PID loops isn't really that hard:
Yes, I agree with you that it's more complicated to find the coefficients for coupled PID loops but I really don't think that it's as hard as you describe it. Yes, you have a total of 6 coefficients to set but usually the coefficients for the inner loop aren't critical for system performance and they usually don't need to be changed between systems to gain acceptable performance -- performance in many ways superior to single loop PID controllers.
/*OFF TOPIC*/
Moreover, I've recently been working on an auto-tuning fuzzy logic algorithm for PID loops. I must say that this algorithm uses some assumptions of the system so it's not in that sense a universal PID auto-tuner. It assumes that too high coefficients in a PID loop will cause resonance in the controlled value and that the resonance frequency is characteristic for the term in question. It also assumes that there is constant relation between the resonance frequencies in different systems so that only one value per PID loop needs to be found in order for the auto tuning to work.
Anyways I first tested this algorithm to tune simple stabilization PID loops and it was quite successful in finding the "limit" values for all of the coefficients (limit meaning that the system is on the edge of starting to resonate and occasionally does resonate when the controlled system changes -- i.e. the flight speed changes etc.). Now the occasional resonance might be a nuisance if absolute position was controlled by a single PID loop but if this auto-tuning algorithm was used to find coefficients for PID (or PD) loops that controlled movement rates the occasional resonance wouldn't be a problem.
/*OFF TOPIC*/
Now we come to the actual point: while there might be some absolute optimal coefficients for coupled PID loops (and like you said it's really hard to find these) I think it's safe to assume that there are a multitude of suboptimal combinations of these coefficients. Even single PID loops have many different suboptimal combinations (if you're using high D gain you can't use too high P term and vice versa). Moreover, like I said the inner loop of coupled PID loops isn't (at least in my subjective opinion) usually too critical with its coefficients. So what I'm saying here is that a system with coupled PID loops should be fairly simple to tune if the outer loop was auto tuned and the inner loop was tuned by hand. In the case of a quad stabilization that'd mean that the PD loop that'd control movement rates would be auto-tuned by an auto-tuning algorithm and the inner loop would be hand tuned. In this example case the inner loop would merely dictate how "snappy" or fast the corrections in attitude would be.
I haven't yet got any test data to back up my words yet but I'm going to do some extensive testing on a simulator setup (that I've made for OpenPilot earlier) as soon as I have time for it. My goal is to write a more or less auto-tuning stabilization system that's as platform independent as possible. I do realize that I'm very unlikely in succeeding to a degree that it'd be of any use to anyone (atleast in near future) but it sure has been educating so far.
Comments
I would love also to see / understand the algorithms that you are using in LabView.
I am very interested in auto-tuning some of the Proportional Derivative (PD) loops for the UAV DevBoard.
My main interest is to make Tuning much easier and quicker for new users of the UAV DevBoard. Even a small amount of auto-tuning could make the process much quicker and simpler.
@Roy - I think autotuning it's a very feasible solution for the Ardupilot system, in fact I have a labview program that does exactly what you describe... maybe we could adapt it
I'm also designing my own quadrotor (well who isn't :-). While I agree its probably not too difficult for someone who understands feedback control theory to tune PID gains, I don't think the typical hobbyist who just wants to fly their scratch-built quad should have to do this. The alternatives I thought of are:
1) Adaptive feedback. There seems to be a number of papers using adaptive backstepping control for quads.As was said earlier, this may not be feasible on 8-bit processors (although I've been surprised in the past with just how capable they can be)
2) Autotuning: using telemetered data to a groundstation to perform system identification and compute the gains (of course, this is really just a form of off-line adaptive control).
3) Robust control - use modern control techniques to ensure the control system can handle a wide variety of quad configurations.
- Roy
https://www.youtube.com/watch?v=dGiPNV1TR5k
The implementation was planned for a P-III running an embedded OS with MT-i IMU and a other expensive equipment, but I ran out of time and I could only develop the algorithm and made my tests on a matlab/simulink simulation.
As with any university research program someone else continued the work on the AP but I moved to another city and I don't know the actual state of the implementation... :P
The good thing of a neuro-fuzzy is that simplifies the complexity of the controller and thus it's easier to implement on an embedded environment... Other ways to reduce the CPU effort are to use a table of pre-calculated results...
I'm not an expert in ARM MCU's so I really couldn't tell if the two ARM7's will do... but if you optimize enough I think it's plausible...
About your neuro-fuzzy controller,
Did you implemented it in a real embedded system? I mean, what kind of HW did you use? requirements etc.
I'm very interested in implement a neuro controller to cancel the non-linearity during some phases of the flight. Currently I developed an autopilot with 2xARM7 in parallel, but I guess I will run out out power processing and I will jump to one ARM9 (thinking in video processing as well).
What do you think?
I only was trying to explain with simple words what is an adaptive/robust control :P for people who doesn't know anything about it, don't take them literally.
With a "smart PID" (note the quotation marks), I wanted to mean there are techniques that cancel the non-linearity of the plant, and operating and simplifying (like H_inf technique for example), the control could become a "simple PID". But of course, as you are remarking, it could be complex as you want, there is not unique technique. Maybe I had to explain it more in detail.
With mathematical model, I wanted to mean to know the physical model and work in the state-space. Maybe my physics background is the responsible of this statement :P "forgetting" that a transfer function is actually a mathematical model.
Thank you so much for your remarks.
I think the "success" of the tunning process depends on the expectations.
As an engineer I'm used to work until I get an "optimal" or desired response out of the system, but in practical terms, if the plane gets near enough to were you are trying to go, then you can call that a success, specially considering all the limitations of the system.
If you're auto-tuning the outer loop then the process gets a lot easier, because manually tunning one PID is not really that hard, you just need patience :D.
I actually made my master thesis on genetic algorithm tunning of a neuro-fuzzy controller for a UAV so maybe we could exchange ideas! send me a message if you're intrested.
Can you tell us more about the fuzzy logic algorithm for PID loops ? I'm interested in that.
I recently discovered this paper which seems to be using some of the same techniques.
Like I said I'm no expert in this field and my methods are fairly empirical so I might be wrong but in my subjective opinion tuning coupled PID loops isn't really that hard:
Yes, I agree with you that it's more complicated to find the coefficients for coupled PID loops but I really don't think that it's as hard as you describe it. Yes, you have a total of 6 coefficients to set but usually the coefficients for the inner loop aren't critical for system performance and they usually don't need to be changed between systems to gain acceptable performance -- performance in many ways superior to single loop PID controllers.
/*OFF TOPIC*/
Moreover, I've recently been working on an auto-tuning fuzzy logic algorithm for PID loops. I must say that this algorithm uses some assumptions of the system so it's not in that sense a universal PID auto-tuner. It assumes that too high coefficients in a PID loop will cause resonance in the controlled value and that the resonance frequency is characteristic for the term in question. It also assumes that there is constant relation between the resonance frequencies in different systems so that only one value per PID loop needs to be found in order for the auto tuning to work.
Anyways I first tested this algorithm to tune simple stabilization PID loops and it was quite successful in finding the "limit" values for all of the coefficients (limit meaning that the system is on the edge of starting to resonate and occasionally does resonate when the controlled system changes -- i.e. the flight speed changes etc.). Now the occasional resonance might be a nuisance if absolute position was controlled by a single PID loop but if this auto-tuning algorithm was used to find coefficients for PID (or PD) loops that controlled movement rates the occasional resonance wouldn't be a problem.
/*OFF TOPIC*/
Now we come to the actual point: while there might be some absolute optimal coefficients for coupled PID loops (and like you said it's really hard to find these) I think it's safe to assume that there are a multitude of suboptimal combinations of these coefficients. Even single PID loops have many different suboptimal combinations (if you're using high D gain you can't use too high P term and vice versa). Moreover, like I said the inner loop of coupled PID loops isn't (at least in my subjective opinion) usually too critical with its coefficients. So what I'm saying here is that a system with coupled PID loops should be fairly simple to tune if the outer loop was auto tuned and the inner loop was tuned by hand. In the case of a quad stabilization that'd mean that the PD loop that'd control movement rates would be auto-tuned by an auto-tuning algorithm and the inner loop would be hand tuned. In this example case the inner loop would merely dictate how "snappy" or fast the corrections in attitude would be.
I haven't yet got any test data to back up my words yet but I'm going to do some extensive testing on a simulator setup (that I've made for OpenPilot earlier) as soon as I have time for it. My goal is to write a more or less auto-tuning stabilization system that's as platform independent as possible. I do realize that I'm very unlikely in succeeding to a degree that it'd be of any use to anyone (atleast in near future) but it sure has been educating so far.