I did some research and implemented a self learning PID algorithm. It is located in my cloned repo http://code.google.com/r/litho23-ardupilot/. I really like how it turned out. I hope you all are able to use it with success i'm lacking hardware right now to do further testing.
For those looking at the repo it is in the libraries/PID/ location.
I couldn't figure out how to add a parameter to the EEPROM memory so it is 95% implemented.
Can you tell us more about this? Is it based on ArduPlane or ArduCopter?
My application was ArduPlane, but it can be used on any platform where a PID is needed.
It is based off this paper, http://www.ece.eng.wayne.edu/~flin/Conference/AI-PID.pdf.
I added a diagram to the original post that explains how the algorithm works. The paper doesn't explain it this way, but this is how it basically works.
I based it off the current PID.h/cpp library. The new self learning PID should be plug and play minus the EEPROM additional value I couldn't figure out how to implement.
Here is the self learning PID diagram.
I figured out the param_table.h, c files and generated my new ones that should work with the self learning PID. Located at me cloned repo http://code.google.com/r/litho23-ardupilot/.
Do you have any recommendations on how to test this and what it is supposed to do? Looking at the paper it seems that the code should automatically optimize the control loops for the system, in this case a UAV. This is fantastic if so!
So, should we test this on the ground, fly it, etc (understanding the risk)? Will my quad automatically tune itself? Does the code affect all of the different flight modes directly or just a few modes?
The tuning process right now is hit or miss, and I doubt that many of us ever fully optimize our systems. A true self-learning control scheme would be a giant leap forward, especially considering all of the unique mechanical systems out there!
I'm trying to figure out how to test it myself. I've ordered a APM 2.0 and that is going to take 4-6 weeks to get to me.
In the mean time i'm trying to figure out the software in the loop simulation (SITL) and test it that way. As to what platform it will work with. It should work with any.
A person could:
There are along of advanced control schemes out there with neural networks, but trying to find one that was simple, universal, and small to code was my goal.
As for how you can test it. I'm not 100% sure yet as I haven't been able to upload my build yet and I haven't uploaded a custom build before. I'll keep everyone posted though.
When you say "turn-on", is there a way to enable or disable the auto learning feature in the code? It would be interesting to do a flight test with normal well-tuned parameters and compare to a flight test with this adaptive control turned-on, see which one is better tuned.
I think that the SITL or HIL setup is the way to go at first to work out any bugs. Gotta get more of the devs and alpha testers on this thread! :)
I have a working ArduCopter SITL simulation running on Amazon's cloud.
Would it help to have access to it?
if yes, PM with public ssh key and you will have a server with SITL to play with
Neat! Something is telling me your apm 2 gonna ship much kicker than you think :D
This is super cool! I made a very caveman-like attempt at this a while back... this is much better.
Thanks! I did a lot of researched and I thought this was the simplest and most elegant method. Making a self tuning PID can be done many different ways, but a lot of those are computationally intensive and to be honest confusing unless you have a PhD.
If you could give it a HIL test that would be awesome. I ran the autotest.py and it worked fine. As in didn't crash. I'm trying to come up with a more appropriate test script for it, but I've been busy lately. Maybe i'll finish it this weekend.