Page 1 of 1

Call for full PID settings tutorial!!

Posted: Sun Apr 07, 2013 11:11 am
by afaf
I'm looking for a guide on how to set pid values (for all params - not only roll pitch yaw).
Most of tutorial are outdated (use old multiwii gui) and I find just one full tutorial (it's a video-tutorial on yt) but where author speak in french, so I can't understand what he's saying.

I wonder if some multiwii experts here can write an article or a page on wiki with a full tutorial.

It 's very frustrating to have a Quadcopter but not being able to set it properly.

Thank in advance!

Re: Call for full PID settings tutorial!!

Posted: Sun Apr 07, 2013 11:34 am
by Hamburger
Yes, good thinking.
I propose you start asap - then maybe others will join you. That is the wiki way right?

Re: Call for full PID settings tutorial!!

Posted: Sun Apr 07, 2013 11:40 am
by afaf
I'm just a newbie with MultiWii, we need someone with experience to write it. I'm looking for that infos. You seem more expert than me, so maybe you can give a good starting point :)

Re: Call for full PID settings tutorial!!

Posted: Sun Apr 07, 2013 12:54 pm
by Hamburger
Maybe I could but it is not my current focus of interest to start this.

Re: Call for full PID settings tutorial!!

Posted: Sun Apr 07, 2013 1:02 pm
by copterrichie
The issue with PID tuning in my opinion, there is no set way of doing it. I have shared my way of doing it in the past and was ridiculed. So I don't bother any more. I will share this, the major mistake is believing using the default PID setting is some badge of honor, it is not. Each copter is an unique creation and requires its own settings.

Re: Call for full PID settings tutorial!!

Posted: Sun Apr 07, 2013 1:30 pm
by afaf
copterrichie wrote:The issue with PID tuning in my opinion, there is no set way of doing it. I have shared my way of doing it in the past and was ridiculed. So I don't bother any more. I will share this, the major mistake is believing using the default PID setting is some badge of honor, it is not. Each copter is an unique creation and requires its own settings.


I've read some useful tutorials on how to set pid for roll pitch yaw: not a simple list of values, but a way to set them.
If i understand it correctly, for example, a too high value for P on roll/pitch makes quadcopter wobbling when I push on throttle, am I right? It's a very useful information: if my quad wobbles then I know probably it's a problem with P. It is the kind of information we (we = noobs) need.

By the way I can't understand for example why my quadcopter slide to left, or why can't keep altitude level (i have a barometer). I guess is one of tens settings out of there but I can't find anywhere information about them. (Neither a guide to MultiWiiConfGui seems to exist)

copterrichie, gives me (us) your advice on how to set them please. And put the on a wiki please!

Re: Call for full PID settings tutorial!!

Posted: Sun Apr 07, 2013 1:35 pm
by copterrichie
I will attempt to put something together over the next few days. Building a new copter with EDFs and records my steps. I am sure it will requires its own unique PID settings.

Re: Call for full PID settings tutorial!!

Posted: Sun Apr 07, 2013 8:00 pm
by zidlov
Basically I'm having the same problem and have already watched and read far too many descriptions on how to set pids.
Right now I think I start to grasp the process and today played around with some values on the field and managed to get a pretty stable behaviour but I'm still far from doing this in a systematical fashion.
Actually I only wanted to give a hint to the op: Try to watch that french yt video again! It has english subtitles...
I also fou d a pretty good and short description on rcgroups but don't have a link right now.
Today on the field I remembered only: increasing p until it feels good and solid but doesn't oszillate. Increase I slowly 7ntil theres no more drift and no wobbling during rapid descent. As for D , I haven't done it yet, but it should be responsible for speed of reaction to your inputs....
Very happy with the possibility in 2.2 to set 3 different profiles. I will try and make one for chilly cameraflight, one for aerobatics and one for testing. So I won't ruin my settings by the pure urge to "try out something else" anymore....:)

Re: Call for full PID settings tutorial!!

Posted: Mon Apr 08, 2013 7:24 am
by scrat
If P is too high quad wobbles very fast. If I is to high quad wobbles very slow. That's it. So you must play with PID's to make your copter wobble free.

Good video for P and I tunning:
http://www.youtube.com/watch?v=YNzqTGEl2xQ

Re: Call for full PID settings tutorial!!

Posted: Mon Apr 08, 2013 8:18 am
by afaf
French friend video, has subtitles only for roll pitch yaw pid, not for altitude e mag (there's a video, but no subtitle).
A centralized/official wiki page will be more useful btw :)

Re: Call for full PID settings tutorial!!

Posted: Mon Apr 08, 2013 8:26 am
by afaf
scrat wrote:If P is too high quad wobbles very fast. If I is to high quad wobbles very slow. That's it. So you must play with PID's to make your copter wobble free.

Good video for P and I tunning:
http://www.youtube.com/watch?v=YNzqTGEl2xQ


That's good! But doesn't describe d, and pid for alt and mag.

We need something like this, but more complete and linked on official wiki!

Re: Call for full PID settings tutorial!!

Posted: Mon Apr 08, 2013 1:31 pm
by copterrichie
afaf wrote:That's good! But doesn't describe d, and pid for alt and mag.

We need something like this, but more complete and linked on official wiki!


Awe!! That lets me off the hook, I personally do not use the alt or mag functions. ;)

Re: Call for full PID settings tutorial!!

Posted: Mon Apr 08, 2013 9:21 pm
by backyardflyer
Here is a link to PID tuning.
http://www.multiwii.com/wiki/index.php?title=PID

Personally, using low pass filter is more efficient.
//#define ITG3200_LPF_42HZ
#define ITG3200_LPF_20HZ

I found increasing D term should help with vibration.

Re: Call for full PID settings tutorial!!

Posted: Tue Apr 09, 2013 8:47 am
by scrat
afaf wrote:
scrat wrote:If P is too high quad wobbles very fast. If I is to high quad wobbles very slow. That's it. So you must play with PID's to make your copter wobble free.

Good video for P and I tunning:
http://www.youtube.com/watch?v=YNzqTGEl2xQ


That's good! But doesn't describe d, and pid for alt and mag.

We need something like this, but more complete and linked on official wiki!


Most important are P and I. D is not that important but helps.

Re: Call for full PID settings tutorial!!

Posted: Tue Apr 09, 2013 9:00 am
by alll
scrat wrote:... D is not that important but helps.


??, explain us, helps to do what?

Re: Call for full PID settings tutorial!!

Posted: Tue Apr 09, 2013 11:40 am
by afaf
Still no luck with tutorials :)

Re: Call for full PID settings tutorial!!

Posted: Wed Apr 10, 2013 10:27 am
by scrat
alll wrote:
scrat wrote:... D is not that important but helps.


??, explain us, helps to do what?


http://en.wikipedia.org/wiki/PID_contro ... ative_term

Re: Call for full PID settings tutorial!!

Posted: Wed Apr 10, 2013 3:28 pm
by rbirdie001
Hi!
I installed in my Tricopter with Crius SE board (baro BMP085) firmware MW 2.2 instead 2.1 and now I can't tune up altitude hold. I noticed that there were some changes in altitude hold code, but those should be to better, shouldn't be? ;)
With 2.1 AH wasn't perfect but in calm wather with AH active was the copter slowly "floating" in about 0.5m range. Now with 2.2 the copter is pulsing and jumping in 1-2m range and during first PID tunning "session" I was unable to tune it better.
Was someone successfull with AH at 2.2? Can you share some ideas how to tune Altitude hold PID?
Thanks!
Roman

Re: Call for full PID settings tutorial!!

Posted: Wed Apr 10, 2013 4:03 pm
by tovrin
personally i think that the video posted early in this thread is one of the best PID teaching tools there is. it doesnt get explained any better and its visually informative.

Re: Call for full PID settings tutorial!!

Posted: Thu Apr 11, 2013 9:38 am
by scrat
rbirdie001 wrote:Hi!
I installed in my Tricopter with Crius SE board (baro BMP085) firmware MW 2.2 instead 2.1 and now I can't tune up altitude hold. I noticed that there were some changes in altitude hold code, but those should be to better, shouldn't be? ;)
With 2.1 AH wasn't perfect but in calm wather with AH active was the copter slowly "floating" in about 0.5m range. Now with 2.2 the copter is pulsing and jumping in 1-2m range and during first PID tunning "session" I was unable to tune it better.
Was someone successfull with AH at 2.2? Can you share some ideas how to tune Altitude hold PID?
Thanks!
Roman


Have the same problem. With dev version I think it was r1122 with baro code from mahowik...this was the best AltHold for me. Yeah copter did fell down for about 50cm when althold was turned on but then copter stayed at same altituted all the time.

Re: Call for full PID settings tutorial!!

Posted: Thu Apr 11, 2013 2:33 pm
by rbirdie001
scrat wrote:Have the same problem. With dev version I think it was r1122 with baro code from mahowik...this was the best AltHold for me. Yeah copter did fell down for about 50cm when althold was turned on but then copter stayed at same altituted all the time.

Does it mean that in final 2.2 there isn't baro code from Mahowik? I'm not following all the changes (it's probably impossible ;) ) so I'm confused. I thought that it's implemented 2.2 :?:
Does anyone know more about it?
Roman

Re: Call for full PID settings tutorial!!

Posted: Thu Apr 11, 2013 2:48 pm
by afaf
I still can't understand how to set pid for altitude and mag :) No reply in first 20 posts...

Re: Call for full PID settings tutorial!!

Posted: Fri Apr 12, 2013 7:46 am
by scrat
afaf wrote:I still can't understand how to set pid for altitude and mag :) No reply in first 20 posts...


Let me google that for you :)

http://lmgtfy.com/?q=multiwii+altitude+pid+tuning


For Althold PID tuning: http://www.multiwii.com/wiki/index.php? ... titude_PID

For MAG leave default.

Ok?

Re: Call for full PID settings tutorial!!

Posted: Fri Apr 12, 2013 7:48 am
by scrat
rbirdie001 wrote:
scrat wrote:Have the same problem. With dev version I think it was r1122 with baro code from mahowik...this was the best AltHold for me. Yeah copter did fell down for about 50cm when althold was turned on but then copter stayed at same altituted all the time.

Does it mean that in final 2.2 there isn't baro code from Mahowik? I'm not following all the changes (it's probably impossible ;) ) so I'm confused. I thought that it's implemented 2.2 :?:
Does anyone know more about it?
Roman


This is just my opinion - like i see there isn't :(

Maybe some coders will answer.

Re: Call for full PID settings tutorial!!

Posted: Thu Apr 18, 2013 5:56 am
by Newquadandtri
PID mystery simplified.
[url][http://www.rcgroups.com/forums/showthread.php?t=1873603/url]

Re: Call for full PID settings tutorial!!

Posted: Wed May 15, 2013 6:53 pm
by copterrichie


This is an example of how a PID settings will work for one copter and not for another. I plugged in the PID settings for Mini-Mollie and what is seen in the video are the results. This copter is the same physical size as Mini-Mollie and a Bicopter but that is where the similarities ends. The motors have a much higher KV Rating, the props are 9" verse 8" and the AUW is 1.5Kg where as Mini-Mollie is 1Kg. There is no magic bullet when it comes to PID tuning at this stage of the game, the best we can do right now is trail and error testing. However, I do believe it is possible to create a spreadsheet or equation where we can enter variables like AUW, Motor KV, props etc and out pops a baseline PID settings, just no one has taken this task on. The copter was not damaged and I continued on with the tuning process.

Re: Call for full PID settings tutorial!!

Posted: Wed May 15, 2013 9:38 pm
by squid10
Hi,
I'm new in this Multiwii, currently im reading and learning A LOT.
I also have KK2 and APM 2.5 and i have to agree with the author of this post - there are much less tutorials in Multiwii than in other platforms i know (KKMuticopter and Arducopter).
BUT,
I do found basic tutorials and how to calibrate MAG and ACC - the rest is exactly like on other platforms.
PID tuning is the same on all systems, so if you'll search on other platforms you'l find lots of materials.. also we can create tutorials based on other platforms tutorials.
the big advantage on MW is the comfortable tuning way through the bluetooth and the android app, yeah.. other platform mostly comes pre tuned for most common crafts, but in other platforms if you do need to tune its a big mess... you need to connect the board to the PC between params you tune...

Re: Call for full PID settings tutorial!!

Posted: Thu May 16, 2013 6:03 am
by felixrising
Sounds like we all need to get IDs on the wiki and start contributing... There is already a really great base of information there, but more information and more up to date is always a good thing.

Who controls access to the wiki?

Re: Call for full PID settings tutorial!!

Posted: Thu May 16, 2013 8:32 am
by Hamburger
Alex and myself.
It is really only to keep away vandalism. Just contact either one of us if you are interested.

Re: Call for full PID settings tutorial!!

Posted: Thu May 16, 2013 4:18 pm
by linuxslate
Article on wikipedia about PID Tuning:

http://en.wikipedia.org/wiki/PID_tuning#Loop_tuning

I'm not telling anyone to use any of these techniques while a expensive and heavy device with spinning blades is in the air, but the article makes informative and interesting reading.

Re: Call for full PID settings tutorial!!

Posted: Fri May 17, 2013 11:09 am
by hpcre
From the tons of information and posts I read on PID tuning, it seems they all follow the same rule on any axis, just increase P until you see a wobble them decrease a bit.
Then increase D until you see wobbles then decrease a bit. I is the last setting to be set.

The post on rcgroups called "PID thinking theory" is very good if you want to understand how P, I and D relate

Re: Call for full PID settings tutorial!!

Posted: Wed Jun 05, 2013 12:17 am
by ezio
I was looking for a quite some time to good tutorial for PID tuning for Alt Hold. And I haven't found one good enough. So this is my procedure to tune the Alt Hold based on my current knowledge.
-----
Explanation.
Baro sensor is used to detect the altitude. As baro sensor is not very precise and quite noisy, detection of small up and down movements is impossible.
So small up and down movements are detected by accelerometer. Combination of this two sensors gives good altitude hold.

PID settings for ALT works like this:

*P - means how much copter should relay on the baro sensor. Higher the value is, stronger the copter relays on the Baro reading.
*I - is used to compensate drift costed by battery voltage drop during the time. Higher the value is faster the copter will react to voltage drop ( or other factors ).
*D - means how strong the copter should react on data from the accelerator. It is used to react on small up and down movements. Higher the value is copter will react faster/stronger to the small altitude change.

Tuning:

We need to start from settings the Accelerometer.

1. So set the P and I to 0

2. Start to play with D value only. To high D may cause yoyo effect (up and down oscillations). With to low D copter will be not able to react strong/fast enough to hold altitude. Your goal here is to set D to the value when copter don't oscillate up and down and also holds altitude quite well for a not very long period of time. Copter will not hold altitude perfectly at this point during long periods. It will slowly drift up or down, but altitude should be quite stable in short periods.

3. Start to increase P to the point where copter holds altitude over long time period. If the value is to small the copter will drift slowly up and down. If the value is to high yoyo effect may appear. Goal here is to set it to the point where copter holds altitude for quite some time. Copter will still go slowly down due to battery voltage drop over time.

4. "I" is used to compensate the voltage drop. So start to increase the "I" value slowly until you get a perfect position hold during a very long time.
Now your altitude hold should be good enough.

I hope that this approach is correct. If you find a mistake let me know.
I will try to make tutorial like this for GPS soon.
Fly safe.
Bart

Re: Call for full PID settings tutorial!!

Posted: Thu Jun 06, 2013 10:14 pm
by Sac D
Thank you ezio. That seems like a good approach. I'll give it a try after I figure out how to stop mine from spinning in a hard clockwise yaw all the time. Do you think proceeding the way you did would also work with yaw? Or do you have an idea how I could resolve it?

Re: Call for full PID settings tutorial!!

Posted: Fri Jun 07, 2013 2:44 am
by henjo
Ok

Re: Call for full PID settings tutorial!!

Posted: Fri Jun 07, 2013 6:25 am
by felixrising
Ezio, nice.. When looking at the wiki http://www.multiwii.com/wiki/index.php?title=Altitude_PID, I've always been purplexed by this line of text:
When changing PID values begin with I and D values at zero,
which seems to be contradicted three lines down by this one:
Set P and I to 0
. I'd like to update the wiki with your explanation (which doesn't overly differ) but is well worded. ps. !Relay, Rely. ;)

Re: Call for full PID settings tutorial!!

Posted: Fri Jun 07, 2013 6:36 am
by ezio
felixrising wrote:Ezio, nice.. When looking at the wiki http://www.multiwii.com/wiki/index.php?title=Altitude_PID, I've always been purplexed by this
When changing PID values begin with I and D values at zero,
line of text, which seems to be contradicted three lines down by this one
Set P and I to 0
. I'd like to update the wiki with your explanation (which doesn't overly differ) but is well worded. btw. !Relay, Rely. ;)

Exactly. I have spotted this bug on the wiki too. That's why I have decided to write my own version.

Bart

Re: Call for full PID settings tutorial!!

Posted: Fri Jun 07, 2013 1:49 pm
by alll
Tuning PID like : set I&D=0, increase P until wobble, reduce a bit, set D to reduce overshoot, finally add some I to keep steady state… is true for a « conventional/classic/standard » PID control loop :
http://en.wikipedia.org/wiki/PID_contro ... d_PID_form

Tuning pid values in multiwii is not that intuitive as we don’t really know how the PID control is implemented, unless you dig in the code.

IMO associating physical units to these PID values in the gui is confusing and sometimes difficult to remember not user friendly. On top, the PID value ranges and precision are quite different for P-I and D.
(eg P=0..20; I=0.00..0.30; D=0.000..0.250)

Could we not “hide” these physical values from the user-interface and only work in % (they can be documented). One would think in increasing / reducing PID values.
(eg P=0..100% (range 0..20), I=0..100% (range.0.00..0.30); D=0..100% (range=0.000..0.250)

manu

Re: Call for full PID settings tutorial!!

Posted: Fri Jun 07, 2013 2:09 pm
by alll
Here a nice apple(s) to play with
http://www.pidstop.com/index.php?r_id=999
manu

Re: Call for full PID settings tutorial!!

Posted: Sun Jun 09, 2013 9:31 am
by alex.khoroshko
Hello!
Let me refresh the thread a bit.
First, I'd like to say - I have no questions how to tune PIDs themselves (I have Russian equivalent of PhD in power electronics).
But! Why there are so many control loops, having no explanation? Ok, roll, pitch, yaw, altitude hold, mag, level - it is explained and intuitively understandable. But why there are 2 control loops for position hold, - ordinary and "rate"? what in fact do they control? I assume not height, because there's separate altitude control loop. And, what confuses me even more - what is navigation loop? Is it for waypoints?
As I see, there should be the loop for horizontal plane correction and for vertical axis control - compare the current position to the desired one and that's it. Why more loops? How to tune them?
P.S. I can write the complete wiki page on these extra loops after understanding the point of this all, assuming someone would revise my English after that. I can even film the full tutorial on all the settings.

Re: Call for full PID settings tutorial!!

Posted: Sun Jun 09, 2013 11:10 am
by carlonb
alex.khoroshko wrote:Hello!
......
P.S. I can write the complete wiki page on these extra loops after understanding the point of this all, assuming someone would revise my English after that. I can even film the full tutorial on all the settings.


+1
I'm waiting for this....
Cheers
Carlo

Re: Call for full PID settings tutorial!!

Posted: Sun Jun 09, 2013 2:00 pm
by alll
I see i am not the only one that has difficulties in guessing how these PID loops are implemented ;)

Take the alt hold for example, here you can't apply the "standard" PID tuning, as far as i understood, the D-term is actually the accelerometer-only error input, P and I comes from the baro sensor?

I would prefer that all PID controls behaves the same, ie:
Error = Setpoint - Actual(got from sensors)
P=current error
I=error over time (gets the error back to 0)
D=error "prediction" (damping)

If each PID loop could be explained in speudo code, would help us better tuni the thing.

manu

PID:
Error = Setpoint - Actual
Integral = Integral + (Error*dt)
Derivative = (Error - Previous_error)/dt
Drive = (Error*kP) + (Integral*kI) + (Derivative*kD)
Previous_error = Error
wait(dt)
GOTO PID

I know this will be simple but im stuck

Posted: Fri Jun 14, 2013 12:57 am
by Stiefel
So ive built alittle micro quad to mess around inside the house with.. Ive got it dialed in enough that im happy with it but since ive got it flying stable , now i notice something else that i didnt before.. Im running the multiwii 328 board and in the multiwii GUI i have the PID settings pretty close to stock except for the roll which i increased alittle...

The problem: ill take it to just a little over half stick of throttle so that i can hover,,, which it does, until it starts to loose altitude then when it hits the ground it gains altitude and continues on that road up and down,,,... The pitch roll yaw are all good for my liking but i know it has to be something i have to set in the PID to keep it stable, i also know ive seen a youtube video describing my same problem but for the life of me, i cant find it again and i dont want to start plugging in radium numbers in the GUI. I also thought maybe its something i have to change in the code and re-upload back to the board after compiling.. Any help would be greatly appreciated...

Stiefel,,

Re: Call for full PID settings tutorial!!

Posted: Sun Jun 16, 2013 6:02 pm
by ummagawd
+1 on a PID tuning re-write.... or even better make a video. I've seen a few videos where they show the effects of the P and I... but no one who's made a video with all 3 (P, I, and D). Or one with alt, pos, posr, navr, etc...
I've read (and still continue to read) on different PID tuning approaches and even the way some folks describe things... such as "increase parameter until it "snaps back" etc..." poses a bit of variation as everyone's definition of it is different. So that's where a video would come into play, because i think most of us can agree on the way a multirotor is visually behaving.

Re: Call for full PID settings tutorial!!

Posted: Thu Jul 18, 2013 6:23 am
by alll
Hi there,

Is there currently (ver.2.2) a software update ongoing in the shared trunk for altitude-hold? The current v2.2 is not satisfying. When tuned to stay quite well at a certain altitude, when big external turbulence is applied (push it up or down by hand), it start to make large yoyo's.

manu

ezio wrote:I was looking for a quite some time to good tutorial for PID tuning for Alt Hold. And I haven't found one good enough. So this is my procedure to tune the Alt Hold based on my current knowledge.
-----
Explanation.
Baro sensor is used to detect the altitude. As baro sensor is not very precise and quite noisy, detection of small up and down movements is impossible.
So small up and down movements are detected by accelerometer. Combination of this two sensors gives good altitude hold.

PID settings for ALT works like this:

*P - means how much copter should relay on the baro sensor. Higher the value is, stronger the copter relays on the Baro reading.
*I - is used to compensate drift costed by battery voltage drop during the time. Higher the value is faster the copter will react to voltage drop ( or other factors ).
*D - means how strong the copter should react on data from the accelerator. It is used to react on small up and down movements. Higher the value is copter will react faster/stronger to the small altitude change.

Tuning:

We need to start from settings the Accelerometer.

1. So set the P and I to 0

2. Start to play with D value only. To high D may cause yoyo effect (up and down oscillations). With to low D copter will be not able to react strong/fast enough to hold altitude. Your goal here is to set D to the value when copter don't oscillate up and down and also holds altitude quite well for a not very long period of time. Copter will not hold altitude perfectly at this point during long periods. It will slowly drift up or down, but altitude should be quite stable in short periods.

3. Start to increase P to the point where copter holds altitude over long time period. If the value is to small the copter will drift slowly up and down. If the value is to high yoyo effect may appear. Goal here is to set it to the point where copter holds altitude for quite some time. Copter will still go slowly down due to battery voltage drop over time.

4. "I" is used to compensate the voltage drop. So start to increase the "I" value slowly until you get a perfect position hold during a very long time.
Now your altitude hold should be good enough.

I hope that this approach is correct. If you find a mistake let me know.
I will try to make tutorial like this for GPS soon.
Fly safe.
Bart

Re: Call for full PID settings tutorial!!

Posted: Thu Apr 10, 2014 4:33 pm
by wobbletop
alll wrote:Tuning PID like : set I&D=0, increase P until wobble, reduce a bit, set D to reduce overshoot, finally add some I to keep steady state… is true for a « conventional/classic/standard » PID control loop :
http://en.wikipedia.org/wiki/PID_contro ... d_PID_form

Tuning pid values in multiwii is not that intuitive as we don’t really know how the PID control is implemented, unless you dig in the code.

IMO associating physical units to these PID values in the gui is confusing and sometimes difficult to remember not user friendly. On top, the PID value ranges and precision are quite different for P-I and D.
(eg P=0..20; I=0.00..0.30; D=0.000..0.250)

Could we not “hide” these physical values from the user-interface and only work in % (they can be documented). One would think in increasing / reducing PID values.
(eg P=0..100% (range 0..20), I=0..100% (range.0.00..0.30); D=0..100% (range=0.000..0.250)

manu


Are these ranges correct? I often see D being set to 20-25 (not 0.25).