HobbyKing.com New Products Flash Sale
Reply
Thread Tools
Old Aug 27, 2013, 01:43 AM
Registered User
Belgium, Flemish Region, Geel
Joined Jun 2013
329 Posts
Discussion
Multiwii Level PID settings

Im confused about MW level PID values.

The default settings on my quad fly okay, but not stellar. So I tuned my roll/pitch PIDs in acro mode using methods read on several places and found values around 7-8 for P and 0.05 for I (up from P 3.3 I 0.030). That resulted in my quad flying pretty sharp in acro mode with no oscillations.

However, when I engage angle (level) mode with those settings for roll PID, it flies terribly. Very sluggish and hover is all over the place. With all around default PID settings, in level mode is fairly decent.

Now I read that you are supposed to decrease level P and I values if you increase roll P and I values. But that only makes matters worse. So I tried the opposite, increasing level P and I even further, from P 9 I 0.01 to P 11 and I 0.03, which seemed to help a bit but still no where near good. ANd since I dont understand what Im doing here, I thought Id rather ask.

Can someone explain level PID settings for multiwii or point me to a good explanation?
Vertigo72 is online now Find More Posts by Vertigo72
Reply With Quote
Sign up now
to remove ads between posts
Old Aug 27, 2013, 08:52 PM
Registered User
Joined Feb 2013
920 Posts
There are numerous tutorials here and on the web in general. Search around. As an engineer with stabilized platform experience I found it easy to understand how PID controllers work, others, maybe not. A word to the wise, though, some of these on-line documents contain several conceptual errors and will lead you astray. If you encounter one document that contradicts another, one of the two is probably wrong. Read at least three to counter this issue. Also be aware that the axes have to be tuned in order as one depends on the previous one being correct in order to behave as desired. Gyros first (roll/pitch rate), accels second (level), then mag hold, etc.
Electro 2 is offline Find More Posts by Electro 2
Reply With Quote
Old Aug 28, 2013, 04:10 AM
Registered User
Belgium, Flemish Region, Geel
Joined Jun 2013
329 Posts
Quote:
Originally Posted by Electro 2 View Post
There are numerous tutorials here and on the web in general. Search around. .
My searching skills must be lacking, because I cant find them. Care to link some? Please keep in mind Im taking specifically about level PID values. The wiki contains only this:

Quote:
This will influence the flight characteristic with an accelerometer : this is Level Mode
P is the dominant part of autolevel mode.
I will tell how much force must be applied when the mesured angle error persit
D is used to clamp the maximum correction for autolevel mode
Increase value for P will make the autolevel mode stronger
for smoth operation the sum of P axis + P level should stay near the default value : if you decrease P for Roll and pitch axis you can increase P Level
Which isnt very helpful to put it mildly. Especially the last sentence makes little sense to me, as it would imply Id have to put my level PI values to near zero and any decrease only seems to make it worse, not better.

BTW, next step is tuning Pos, PosR and NavR and there is even less info on those settings. I dont even know for sure what they are for.
Vertigo72 is online now Find More Posts by Vertigo72
Reply With Quote
Old Aug 28, 2013, 08:10 PM
Registered User
Joined Feb 2013
920 Posts
Try and search RCG to start, several posts on this and other forums, addressing this. Level is the accelerometers, don't forget to cal them in the GUI with the aircraft on a dead-level surface, first off. "P" is the amount of corrective feedback. More will make it snap back to level with more force than lower numbers. If turned waaay too high, the corrective loop will oscillate, making the aircraft "shiver". Before you reach this value, the aircraft will become much too "stiff" for really fluid flight motion, stop here. Even with this value, the aircraft may still shiver occasionally with high incedent wind conditions. "I" is the integral or damping of this corrective loop. Raising this value will s-l-o-w d-o-w-n the "seek a level condition" correction action. The stock MW value is almost always very close to correct, maybe 20% either way, max. "D" is the derivitive or rate of this loop. Amounts to an acceleration or "speed up" of the correction loop. Too high makes the aircraft "jumpy", or overly responsive to control inputs. It feels "too hot", if this is high. The stock MW values are usually too high for anything but fly-weight sport aircraft. FWIW on my 4.2 lb/585mm quad with big props I run, P=12, I=0.12, D=43 on the level loop.
Electro 2 is offline Find More Posts by Electro 2
Reply With Quote
Old Aug 29, 2013, 05:35 PM
Just Keeping UP
United States, ID, Moyie Springs
Joined May 2004
1,724 Posts
Electro 2, I'm sorry, but your explanation of the I & D terms is wrong.

The best place to start for learning to tune MulitWii is the Wiki: http://www.multiwii.com/wiki/index.php?title=Main_Page

The explanations aren't always the best, but it's a start.

The effect of the classical PID terms is relative to the 'position error'. The position error is the difference between where the multirotor 'is' and where it should 'be'. That difference can be because a change has been commanded, or because some other force has moved the multirotor away from its static (current commanded) position. The units of E (for error) can be anything: degrees, inches, meters, or whatever.

The P term is a corrective force to reduce E directly proportional to the value of E. The P value we set is a multiplier. The greater the error, the greater the corrective force. This is usually easy to understand. Because the P force reduces as the error goes to zero, P alone will not reduce the error to zero. If the P value is increased to get the error to zero, the velocity of the correction will cause the system to overshoot. To get the error to zero, the I term is needed.

Contrary to what many think, the I term does not slow down the correction. The corrective force from the I term is in the SAME DIRECTION as the P term. The I term is the time-integral of the error. The longer the error persists, the larger the I term grows. As the error goes to zero, the P term also goes to zero, and if the P term is small enough not to cause overshoot, it results in a small, but constant, error. As the error persists, the I term will slowly grow to add enough force to overcome the resistance (friction, if you will) to push the system to an error value of zero.

Too large a value of the P and I terms will cause overshoot and oscillation.

The D term is proportional to the derivative of the error value. It is important to understand that the force applied by the D term is OPPOSITE of the force from the P and I terms. The D force tends to INCREASE as the error goes to zero. The D force acts as a brake to reduce overshoot. If the D term is too large, the resulting force will actually 'repell' the system from reaching a zero position error. This can also cause oscillation.

To better understand the D term, consider that the system is a large 'distance' away for the commanded position (large error value) and moving towards the goal at a constant velocity. (This is a simplification, or course, because the velocity won't be constant.) Let's say that it's 100 units away and moving at 5 units/unit time: the derivative is about 0.05 (5%), or quite small. If the error is 10 units and the velocity is 5, then the derivative is about 0.5 (50%), or much larger. If the corrective velocity is non-zero, the derivative of the error will go to infinity as the error approaches zero.

When the system is 'well' tuned, the P term will push towards the goal reducing the error, the I term will grow slowly to give the last 'push' to overcome any resistance, and the D term will act as a brake allowing the P & I terms to be increased, giving faster error correction, without overshoot or oscillation. Ideally, the force from all three terms will reduce to zero just as the error goes to zero.

When tuning the Baro PID's, refer to the Wiki because they ARE NOT classical PID's.

Nick
nfhill is offline Find More Posts by nfhill
Last edited by nfhill; Aug 29, 2013 at 05:42 PM.
Reply With Quote
Old Aug 29, 2013, 07:40 PM
Registered User
Joined Feb 2013
920 Posts
Actually, I think we're saying the same thing within a markedly different framework. I'd be really interested in hearing your run down on the baro loop as I'm having a H*ll of a time getting it to behave itself.
Electro 2 is offline Find More Posts by Electro 2
Reply With Quote
Old Aug 30, 2013, 04:55 PM
Just Keeping UP
United States, ID, Moyie Springs
Joined May 2004
1,724 Posts
While I would change some of the explanations in the MultiWii Wiki for the pitch/roll/yaw/level PID's, the tuning sequence is consistent with my understanding and explanation.

The MultiWii Baro mode PID's are not classical in function. I'm not going to claim any expertise in tuning them because I still can't work them out for myself very well. I can get my quadrotor to maintain a stable altitude good enough when in a stable hover. But, when moving horizontally, my quadrotor tends to decend slowly until horizontal movement stops and then it 'zoom's' back up to the set altitude. If I'm flying high enough, above 20m, it's not so noticeable.

The explanation in the MultiWii Wiki was, I believe, written by the guy that developed the code.

Nick
nfhill is offline Find More Posts by nfhill
Reply With Quote
Old Aug 30, 2013, 05:49 PM
Registered User
United States, HI, Paauilo
Joined Dec 2007
252 Posts
Great explanation on how PID works. I have read here and there, but all of it seemed spotty.
My quad is a bit mushy so I'll be playing with the horizon PID and see where that goes.
jm82792 is offline Find More Posts by jm82792
Reply With Quote
Old Aug 30, 2013, 09:08 PM
Registered User
Joined Feb 2013
920 Posts
Quote:
Originally Posted by nfhill View Post
The MultiWii Baro mode PID's are not classical in function....

The explanation in the MultiWii Wiki was, I believe, written by the guy that developed the code..........
May be, but I've tried that (WiKi) way and the results I get are quite different than he states they will be. Oh well, more tuning ensues. The next aircraft has a commercial FC onboard, yeah!
Electro 2 is offline Find More Posts by Electro 2
Reply With Quote
Old Aug 31, 2013, 04:55 AM
Registered User
Belgium, Flemish Region, Geel
Joined Jun 2013
329 Posts
All the above is a good explanation for acro (roll/pitch) PIDs. There is a lot of info out there on that subject and I I pretty much understand that part, and I think I got that tuned fairly well.

What I (still) dont understand is the interaction with level PIDs (and Pos, PosR, and all the others really). Increasing acro PID seems to cause level mode to behave completely differently. IN my case, I significantly increased both P and I values for acro, and the result was that in level mode, it reacted far more sluggish and unstable. In acro all is well, considerably better than before the tuning.

What little info I can find on level PID suggests I should further decrease level PID to keep the sum of both PI values constant. My brief experiments suggests that only makes it even worse. I cant test any further ATM due to a crash, but would love someone explaining this part, as well as the other PID values for multiwii.
Vertigo72 is online now Find More Posts by Vertigo72
Reply With Quote
Old Aug 31, 2013, 07:41 PM
Registered User
Joined Feb 2013
920 Posts
Quote:
Originally Posted by Vertigo72 View Post
What little info I can find on level PID suggests I should further decrease level PID to keep the sum of both PI values constant.
FWIW, I set both functions independently. Since many flight modes depend on another being correct prior, one is building a house of cards. Gyros (rate-of-roll) first, accels, (level) second. Then, onward to automated flight modes MH, AH, GPS PH, and lastly, RTH. I never used any "magic" formulas involving sums and differences.
Electro 2 is offline Find More Posts by Electro 2
Reply With Quote
Old Feb 22, 2014, 12:56 AM
Registered User
Joined Mar 2013
8 Posts
i hear you vertigo i cant seem to figure this one out either and nobody seems to be answering your question
kclogan2 is offline Find More Posts by kclogan2
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion PID settings for multiwii and areosky jasonsdad Multirotor Talk 1 Aug 23, 2013 02:26 AM
Discussion Rcexplorer 2.5 multiwii megapirate PID settings Brenno Scratchbuilt Multirotors 0 Jun 28, 2013 05:48 PM
Discussion turnigy talon tricopter - multiwii pro , what are you're PID settings ? dubzn1 Multirotor Talk 0 Apr 24, 2013 06:33 AM
Mini-Review Multiwii RTH works, even using default settings/PID for everything tecdux Multirotor Talk 2 Feb 20, 2013 07:39 AM