kostakis52 / ardupilot-mega

Automatically exported from code.google.com/p/ardupilot-mega
0 stars 0 forks source link

Self training PID's #119

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Feature that you'd like us to add or change you'd like us to make:

This is more of a query. Have you considered a self training PID mode?

Thanks,
Logan

Original issue reported on code.google.com by logan.gr...@gmail.com on 19 Sep 2010 at 8:20

GoogleCodeExporter commented 9 years ago

Original comment by DrZip...@gmail.com on 27 Sep 2010 at 5:28

GoogleCodeExporter commented 9 years ago
We are looking at this now and are studying proposed implementations for the 
roll and pitch servo loops.  

If anyone comes across any literature on adaptive control algorithms applied to 
navigation control, altitude control, or airspeed control, please post links 
here.

Original comment by dewei...@gmail.com on 18 Oct 2010 at 1:49

GoogleCodeExporter commented 9 years ago
well I found this (not sure of any help)---> 
http://en.cnki.com.cn/Article_en/CJFDTOTAL-WDJZ200304003.htm  and this one ---> 
http://www.idc-online.com/technical_references/pdfs/electrical_engineering/Adapt
ive%20Tuning%20-%20Expectations%20and%20Limitations.pdf

Original comment by ruicravo...@gmail.com on 20 Jul 2011 at 12:22

GoogleCodeExporter commented 9 years ago
I found some easy to read atricles on the subject and wanted to share:

These three includes formulation and also implementation. later ones are from 
references of the first one:
http://www.mstarlabs.com/control/self-tuning-pid.html
http://www.mstarlabs.com/docs/tn031.html
http://www.mstarlabs.com/control/selftune.html

This a blog post with c implementation:
http://navneetvk.blogspot.com/2009/08/self-tuning-pid-algorithm.html

This one is academic paper showing implementation on 8-bit motorola. But I 
couldnt find the source code.
http://www.naun.org/journals/m3as/19-425.pdf

These are a little bit hard to follow. For me at least.
http://med.ee.nd.edu/MED7/med99/papers/MED113.pdf
http://ece.eng.wayne.edu/~flin/Conference/AI-PID.pdf
http://med.ee.nd.edu/MED9/Papers/Adaptive_control/med01-134.pdf

Original comment by bekiryen...@gmail.com on 21 Aug 2011 at 7:57

GoogleCodeExporter commented 9 years ago
This request is a year now :(

I'm totally new to ArduPilot(Mega) but was surprised to see that not only must 
the PIDs be tuned for an airframe, but they also depend on a cruise speed (and 
I suppose, an altitude, a temperature, a center of gravity etc). So if you get 
them working ok for speed "A" they probably will not work as well at a 
radically different speed. In the end no matter what you can do, there will be 
snaking or oscillation of one kind or another.

Yet obviously all the data is right there, from the IMU, to work out what kind 
of effect a certain output has. So it could be made self-learning: if a certain 
amount of rudder is applied for a given aileron input and slip is detected, 
adjust the rudder. If a certain amount of throttle is applied for a turn, and 
it is noticed that altitude is lost or gained, adjust that factor to 
compensate. etc.

self-tuning PIDs (or self-tuning anything) in an auto-pilot must work first on 
low level ones first before tuning the PIDs that depend on them: so if the low 
level PIDs are un-tuned, such as throttle compensation for pitch, rudder for 
ailerons, or servo input, there is no point (or it could make things worse) 
trying to tune the more complex black boxes like navigation PIDs.

Perhaps self-tuning could therefore be introduced slowly: for example, 
eliminate the +throttle aileron config and make just that a constantly self 
tuned value. That way it works decently well after the first auto-piloted turn 
is made, and always adjusts itself according to the current situation. If this 
improved over a fixed factor, then move on to the next like auto-rudder for 
aileron.

Original comment by justinbe...@gmail.com on 28 Aug 2011 at 11:09

GoogleCodeExporter commented 9 years ago
Meanwhile waiting for my replacement parts, I am digging up some info on the 
implementation. 
http://www.das.ufsc.br/~aarc/ensino/graduacao/DAS5901/PID_DAHLIN_GPC_FUJI.pdf
This link have some useful info on generalized predictive control. Might be 
helpful.

Original comment by bekiryen...@gmail.com on 1 Sep 2011 at 5:43

GoogleCodeExporter commented 9 years ago
Here is a forum post that links to an article on automatic PID tuning as well:
http://www.diydrones.com/forum/topics/automatic-pid-tuning

Original comment by mike.ben...@gmail.com on 25 Oct 2011 at 4:07

GoogleCodeExporter commented 9 years ago
I just finished implementing a C++ based self-tuning PID. Currently, I and 
doing testing to confirm it works, no promises. I don't have hardware yet, but 
I don't want to fly without this :P 

Basically, it will allow you to set initial PID gains and then self-tune if any 
disturbances or changes in operation conditions occur. I think this works 
better because you don't want to waste the first 10 seconds of flight hoping 
your PID tunes fast enough before you crash. In other words start in a known 
operation condition with tuned PID, then you can expand you flight envelope.

Original comment by lith...@gmail.com on 28 Mar 2012 at 1:04

GoogleCodeExporter commented 9 years ago
I got a library implemented at my cloned repo 
http://code.google.com/r/litho23-ardupilot/ I added it to the libraries/PID 
location I kept the same format as the original PID control and just expanded 
on what was previously written with a more sophisticated algorithm. I left the 
option to turn off the self learning function. I couldn't get it implemented to 
test because I wanted to add another parameter to the EEPROM table and I 
couldn't figure out how the make files were generating the param_table.h and 
associated files. I really like how it turned out. I tested in MATLAB SIMULINK 
before I coded it and I found it slow. However, I found that is you give it a 
good guess to start with it is actually magnitudes faster in optimizing. I 
could go on, and would love to work more on this. Let me know what you think.

Original comment by lith...@gmail.com on 1 Apr 2012 at 1:24

GoogleCodeExporter commented 9 years ago
I figured out the param table code and generated new param_table.c files. I 
only implemented the SLPID change in the ArduTracker.pde file. I can't test it 
on hardware because I have none at the moment.

Original comment by lith...@gmail.com on 2 Apr 2012 at 3:18

GoogleCodeExporter commented 9 years ago
Thanks for persisting with this. I'd like to help test it out but I'm totally 
swamped with an interesting issue.
perhaps another member of the dev group is interested in helping you trial it.

It sounds like if you got the ArduPlane SITL working with JSBSim on your PC, 
you could trigger a "tune PID" phase that would do the step-response changes 
while flying back and forth over home, and see how it might work in practice.

Original comment by justinbe...@gmail.com on 2 Apr 2012 at 3:29

GoogleCodeExporter commented 9 years ago
Self training PID is definitly the way of the future.
I suppose in the mean time, this could be done in a crude manner to extend the 
flight envelope. Something like this:
-Tune the basic PID settings for flight speeds in or around approach speed (the 
most critical phase of any flight) then set something in the code that says 
that if airspeed increases, reduce the rate by which the PID acts on the 
controls, some sort of percentage. Essentially, this would be like automatic 
dual rates for the autopilot.
For every airframe, we know roughly what the stall speed is and what speed it 
becomes a little too freaky to fly. With that in mind, it should be reasonably 
easy to induce a PID percentage or rate system in the programming to have a 
basic self adjusting system. Until some code Guru comes up with the real mccoy!
Just a thought. Will post this in ArduPlane forum as well.

Original comment by olivierd...@gmail.com on 21 Oct 2012 at 11:50

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
one nice day..PX4 we beleive in you..

Original comment by ine...@gmail.com on 22 Apr 2013 at 10:38