2.0 ALT PID Tuning

2.0 ALT PID Tuning

Postby hwurzburg » Tue Apr 17, 2012 10:37 pm

anyone have some suggestions on how to best tweak this setting?
I have a heavy quad, and I have had to increase the P values on the gyros and ACC functions from default by 50-100% to get optimum results...the ID terms are pretty much the defaults...

but I don't have a clue as to how to adjust the PIDs for ALT....right now its very "mushy" and slowly varies +/- 6feet in hover...just marginally better than just autolevel only....haven't done much FF with it yet...I understand that it should be possible it get it to be +/- 2 feet or so...I have the baro chip covered with a cotton ball to eliminate drafts and light...

I did increase the deadband to 40 since my left hand yaw control tends to move the throttle slightly...this seems to help keep it in the deadband more ;) ...

I haven't experimented much with large hold changes...ie I understand that raising throttle out of deadband increases the "hold" altitude until returned to initial position when hold was activated, and vice versa...my concern right now is getting the tighest hold operation I can...

thanks
hwurzburg
 
Posts: 75
Joined: Sun Jan 01, 2012 3:28 pm

Re: 2.0 ALT PID Tuning

Postby hwurzburg » Fri Apr 20, 2012 5:49 am

anyone?
apparently no one has any experience with tuning the altitude hold in V2.0....hard to believe given the amount of work that went on in the code discussions on it!
hwurzburg
 
Posts: 75
Joined: Sun Jan 01, 2012 3:28 pm

Re: 2.0 ALT PID Tuning

Postby mlebret » Fri Apr 20, 2012 8:01 am

Hello,

+- 6 ft is quite fine. If variations are smooth it's not so bad, if you have quite violent up and down, PID tuning is needed.

I have three Quads: light one at 700g, a medium one at 1050g and a quite heavy at 1700g. All with differents boards.

The small one is quite tuned and I'm happy with it unless someone demonstrate me better performance.http://vimeo.com/40504035

I have some work in progress with the others as I cannot manage to get smooth correction to maintain altitude.

Marc
mlebret
 
Posts: 17
Joined: Thu Jan 26, 2012 9:12 am

Re: 2.0 ALT PID Tuning

Postby hwurzburg » Fri Apr 20, 2012 12:47 pm

thanks for the response....but it does not address my question....ie methodology for adjusting the pid to optimum....
and your video demonstrates much better hold than +/- 6ft...

for the gyros its documented for each term pretty well: P till it oscillates, back off, increase D until responsiveness to disturbance is too slow, increase P again, then adjust I for hold of attitude for FF..... for autolevel, not as well, but there is some guidelines...P until it slowly oscillates, D as above, I to eliminate wobbles in fast descent in downwash...

nothing I can find addresses alt hold

what is the effect of too high a P term? I term? D term?
what order is best to tune them and how to determine when to stop increasing?



adjusting three independent variables without any guidlines is kind of like asking someone to tune an old style car ignition without any idea of what timing addvance and mixture does to the engine....
hwurzburg
 
Posts: 75
Joined: Sun Jan 01, 2012 3:28 pm

Re: 2.0 ALT PID Tuning

Postby hwurzburg » Fri Apr 20, 2012 12:48 pm

thanks for the response....but it does not address my question....ie methodology for adjusting the pid to optimum....
and your video demonstrates much better hold than +/- 6ft...

for the gyros its documented for each term pretty well: P till it oscillates, back off, increase D until responsiveness to disturbance is too slow and backoff some, increase P again, then adjust I for hold of attitude for FF..... for autolevel, not as well, but there is some guidelines...P until it slowly oscillates, D as above, I to eliminate wobbles in fast descent in downwash...

nothing I can find addresses alt hold

what is the effect of too high a P term? I term? D term?
what order is best to tune them and how to determine when to stop increasing?



adjusting three independent variables without any guidlines is kind of like asking someone to tune an old style car ignition without any idea of what timing advance and mixture does to the engine....
hwurzburg
 
Posts: 75
Joined: Sun Jan 01, 2012 3:28 pm

Re: 2.0 ALT PID Tuning

Postby ronnieang » Wed Apr 25, 2012 11:58 pm

Hi,

Try this, I use this method.

Set P and I to 0.

Slow increase D from 0 in 0.2 increments until you start to get a slow yo yo movement. Reduce D a littleuntil yo yo movement stops. At this point the multicopter will start to hold altitude with drift.

Increase P slow now, and you will find that the multicopter will start to hold, until it starts the yo yo movement, reduce P until it goes away. The multicopter will now hold altitude with less drift.

I is now increased to reduce the drift when the battery runs down and the throttle needed to keep the copter at hover changes.

My PID for a 1kg quad is P-1.1 I-0.010 D-9.

Hope this helps.
ronnieang
 
Posts: 1
Joined: Fri Mar 09, 2012 3:37 pm

Re: 2.0 ALT PID Tuning

Postby mlebret » Thu Apr 26, 2012 12:54 pm

Thanks for the tip. I'll try it next occasion,

Marc
mlebret
 
Posts: 17
Joined: Thu Jan 26, 2012 9:12 am

Re: 2.0 ALT PID Tuning

Postby Bledi » Tue May 01, 2012 1:02 pm

It's work great ! really easy to tune.
User avatar
Bledi
 
Posts: 187
Joined: Sat Sep 10, 2011 6:36 pm

Re: 2.0 ALT PID Tuning

Postby Cronalex » Wed May 02, 2012 5:27 pm

ronnieang wrote:Hi,

Try this, I use this method.

Set P and I to 0.

Slow increase D from 0 in 0.2 increments until you start to get a slow yo yo movement. Reduce D a littleuntil yo yo movement stops. At this point the multicopter will start to hold altitude with drift.

Increase P slow now, and you will find that the multicopter will start to hold, until it starts the yo yo movement, reduce P until it goes away. The multicopter will now hold altitude with less drift.

I is now increased to reduce the drift when the battery runs down and the throttle needed to keep the copter at hover changes.

My PID for a 1kg quad is P-1.1 I-0.010 D-9.

Hope this helps.

ALT works very well ... pid tuning tips on how to LEVEL? :p
Cronalex
 
Posts: 51
Joined: Tue Mar 20, 2012 8:41 pm

Re: 2.0 ALT PID Tuning

Postby Crashpilot1000 » Thu May 10, 2012 10:39 pm

Hi !
I am using the most recent MultiWii_dev_20120504. My hardware is: Original GAUI 330 Frame + ESC + Motors (my other quad is powered by Hacker/Robbe/Naza). My Multiwii Hardware is DIY (no i2c errors!): Arduino pro mini, orig WMP+, BMA 020, BMP085 (FrSky baroboard connected to LLC of BMA Board), Ext Pullups 2K2. First of all my Quad flies perfect with this setup. The Inflight acc calibration is doing absolutely great - never got it trimmed so well before. My actual PIDs are: Roll/Pitch PID=3,5 0,025 35, Yaw: 7 0,045 0, Level:7,0 0,010 100. Now i did the PID Tuning for the ALT/Baro (default PID: 1,6 0,015 7) and ended up with P=0,3 I=0,001 D=1. My PID seem to be close to nothing! what are your values with light copters and weak motors?
User avatar
Crashpilot1000
 
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: 2.0 ALT PID Tuning

Postby Crashpilot1000 » Sat May 12, 2012 10:59 pm

Ok I did another test with the setup already described.
My findings: The PID controller is weird concerning Baro.
This time i put D & I to 0 and experimented with P alone. A P=2 gave me a good result! When i add a D >0 (range 1 - 10 tested) the quad oscillates like hell. Ok so D back to 0. A low i=0,002 seems to be beneficial.
So whats the story here? Just take a P and let the rest be zero? This contradicts to the D method.
What is going on?
User avatar
Crashpilot1000
 
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: 2.0 ALT PID Tuning

Postby bobbyperu » Wed Jul 25, 2012 10:00 pm

Hi all, first I would like to thank everybody contributing to this awesome project.
I've been flying Multiwii on an Arduino Uno with WMP for some time and I have to say I'm very pleased with my upgrade to the Crius AIO PRO :-)
I had some slow bouncing (3-4feet in ~10 sec cycles) on the ALT hold, so I went out and did some tuning today. The result was great. I got it down to about 1feet in calm weather now, all I did was actually increase the D value.
ALT: 1.6 0.015 8
I also have throttle expo at 0.50 around hover.
Foam covered baro.
bobbyperu
 
Posts: 3
Joined: Wed Jul 25, 2012 9:30 pm

Re: 2.0 ALT PID Tuning

Postby djvdberg » Tue Aug 14, 2012 5:23 pm

Crashpilot1000 wrote:Ok I did another test with the setup already described.
My findings: The PID controller is weird concerning Baro.
This time i put D & I to 0 and experimented with P alone. A P=2 gave me a good result! When i add a D >0 (range 1 - 10 tested) the quad oscillates like hell. Ok so D back to 0. A low i=0,002 seems to be beneficial.
So whats the story here? Just take a P and let the rest be zero? This contradicts to the D method.
What is going on?


Same here dude, dunno what's going on.. :?
Did you manage to resolve it? A D of anything above 3 yoyo's like crazy!

Oh and full and empty battery is COMPLETELY different??? My ALT PID is currently 1.2 - 0.010 - 2

Cheers
Dion
djvdberg
 
Posts: 3
Joined: Mon Aug 13, 2012 9:42 am

Re: 2.0 ALT PID Tuning

Postby Crashpilot1000 » Thu Aug 23, 2012 5:19 pm

@Djvdberg:
Hi!
I was so fed up with the current Baro implementation, that i rewrote the whole Baro controller stuff. I ended up with something like a P-whatever controller and a configurable ACC Z Part. Now i am quiet happy how the Baro works (tested on MS Baro, but other users report good working results on BMP as well) Here is the Link to the German site: http://fpv-community.de/showthread.php? ... post188839. Please use google translate for now.
Here is a short description:
Alt P = Is what you expect, high values will give you a good swinging copter. Only the P "knows" wich height is the setpoint.
Alt I = Is the strength of a variometer, wich tries to fight fast movements up/dwn. It does NOT know the wanted hight but will slow down P jojo significantly.
Values normally between 0,010-0,050. A strong P can outperform the I. You can think of the "I" making the air thicker, like you would fly in oil.
Alt D = Is the Baro - Accelerometer term now. It is only active in level mode. The "D" also doesn't know the hight at all. But it can fight fast dropping. It is limited to ONLY upcorrection. Values depending of used ACC vary from very low like 2 or so up to 90!
Tuning: Set D and I to 0. Increase P till you get a solid jojo effect (Default Value 10,0!) do steps of 2 or 5 don't bother with 0,x values. Don't decrease P now - let it jojo. Now increase I (default 0.040) from 0.010 to 0.050 in 0.010 steps until you see a good dampening of the P -jojo. From my findings (ms Baro) 0.050 is already to high. Now you can try to increase the P and than the I again.
When this is done increase the "D" Term. Hold the copter in your hand with Baro&Levelmode activated (without levelmode: no effect). Try low values at first like 2 or 5 or so and pull the copter down by hand. You should feel the copter instantly fighting your movement. If you don't feel it fighting increase in steps of 20. I have the Freeimu 3.xx MS and i am happy with a D of 80.
If your copter always has the tendency to drop to much (despite your PID efforts) go to IMU line 272: #define Droppercent 20
and reduce it to lets say 5 or 10. That means only 5% of the calculated downmovement is given to the motors. It is dependent on the throttle when turning the Baroswitch. I kept this parameter out of the config.h to leave the config.h unchanged from the default state. So you can copy your existing 2.1 config.h into my mod and upload it right away.
EDIT: A dropping Lipo voltage can be compensated, if the "P" still gives enough power to the motors.

I hope it helps your Barofunction working as well!

So long
Kraut Rob

EDIT: "Martinez" has done some stunning videos with the modified code on his Copter (WMP,BMA020,BMP085 Baro Alt: P=4.5 I=0.030 D=10)

http://www.youtube.com/watch?v=kfN3nGYCetI&

http://www.youtube.com/watch?v=sE2CEOab4SI&


EDIT: I summarized the changes from the original 2.1 here: http://fpv-community.de/showthread.php? ... post189820
Attachments
MultiWii_2_1_NewBaroPIDVario2b.zip
(104.84 KiB) Downloaded 273 times
User avatar
Crashpilot1000
 
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: 2.0 ALT PID Tuning

Postby djrm » Sat Aug 25, 2012 9:15 pm

Greetings
I applied your changes to my 2.1 multiwii and can see a noticeable improvement in the alt hold, Thank you.
This mod is helping me learn to fly my quadcopter, its still early days for me with a usable system.
At present I'm using the new default alt PIDs and am about to try tuning them as suggested.
Best regards, David.
User avatar
djrm
 
Posts: 40
Joined: Wed Feb 15, 2012 11:32 pm
Location: North Yorkshire, UK

Re: 2.0 ALT PID Tuning

Postby Crashpilot1000 » Mon Aug 27, 2012 8:02 pm

Thank you very much for your feedback djrm! And happy flying!
I have report of MPU owners, that they can not use the D, because it regulates to strong then. That is due to the fact that the MPU returns high values in Mwii code (like 512, others 64-256). So for now most MPU users will have to set the new "D" to zero to disable the accelerometer part. They still have the benefit of improved Baro Althold.

So long
Kraut Rob
User avatar
Crashpilot1000
 
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: 2.0 ALT PID Tuning

Postby djrm » Mon Aug 27, 2012 8:23 pm

Hello Kraut Bob,
I forgot to mention that I'm using a BMP085 and HMC5883 breakout boards on a Crius lite FC together with iic GPS all on a 600mm frame with 2836 880kv motors and 30Amp Lulin ESCs all powered by a 3600mAh 50C battery.

I'm struggling with tuning the system, it seems I have a vibration problem. Since I've started to apply the LPF to the gyro I've been able to the thing. So now I have some more confidence I'll be adding the camera back after if fell off during a crash.

I also have a STM32 controller ready to test on this frame using a variation of dongs baseflight software, that one will read a simple sonar sensor but it isn't patched into the altitude control code yet.

David.
User avatar
djrm
 
Posts: 40
Joined: Wed Feb 15, 2012 11:32 pm
Location: North Yorkshire, UK

Re: 2.0 ALT PID Tuning

Postby Crashpilot1000 » Tue Aug 28, 2012 7:44 pm

@Djrm: Thank you for posting your config!

@MPU owners with problems with the alt D of my version:
I have a patch ready for the version from the last post so your Acc implementation is usable for you now. I have another acc code in testing wich is independent of the used acc.
Just do this slight modification for now:
Find this line under IMU/void getEstimatedAltitude():
Code: Select all
  ACCZD = accADC[YAW]-acc_1G;                                   // So UPacc is +, DWNacc is -

And replace it with:
Code: Select all
  ACCZD = (accADC[YAW]-acc_1G)/2;                               // So UPacc is +, DWNacc is -


So long

Kraut Rob
User avatar
Crashpilot1000
 
Posts: 631
Joined: Tue Apr 03, 2012 7:38 pm

Re: 2.0 ALT PID Tuning

Postby rizky_p » Mon Sep 17, 2012 5:44 am

Would anyone be kind to shares on how to integrate the code to multiwii 2.1?

thanks.
rizky_p
 
Posts: 14
Joined: Thu Sep 06, 2012 3:57 pm

Re: 2.0 ALT PID Tuning

Postby Ddpemberton » Wed May 21, 2014 9:15 pm

How did you guys cover your baro? I put some pluck and pull foam in a piece of heatshrink tubing and used contact cement on the bottom to stick it to the board. I have 0 faith it will stay on on? Is it OK to have foam directly on the baro? Has anyone just glued foam to the baro?
Ddpemberton
 
Posts: 19
Joined: Fri May 02, 2014 8:40 pm


Return to MultiWii tweaking - flying experience

Who is online

Users browsing this forum: No registered users and 1 guest