2.0 ALT PID Tuning

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 271 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 2 guests

cron