A little correction for dynThrPID implementation.

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
marbalon
Posts: 107
Joined: Thu Aug 18, 2011 10:59 am

A little correction for dynThrPID implementation.

Post by marbalon »

Hi,
I think I found a problem with current implementation dynThrPID. I think this parametr is used to reduce osculations when you give more throttle for you multirotor. Lately I build my second quad to learning some acrobatics, so it is light and a lot of power - weight about 650grams and thrust 4x680gram ;) hover with throttle ~1350. All components is new, no problems with bearings and unbalanced propellers. Electronics is dumped with the same dumpers like with my big old quad where it works perfectly. But I had a lot of problems with osculations. To learn acro I need quit high PID values for Pitch/Roll, but If I setup default values with P about 4,0 I get osculations when I give a little more power for my quad. I try to reduce this with dynThrPID value but it was not working. So I browsed the code and found something interesting - this flag is used only when throttle > 1500. So I changed code to this:

Code: Select all

  
#define HOVER_THROTTLE  1350
...
//PITCH & ROLL only dynamic PID adjustemnt,  depending on throttle value
  if      (rcData[THROTTLE]<HOVER_THROTTLE) prop2 = 100;
  else if (rcData[THROTTLE]<2000) prop2 = 100 - (uint16_t)dynThrPID*(rcData[THROTTLE]-HOVER_THROTTLE)/(2000-HOVER_THROTTLE);


And now it fly much better. So correct me if I'm wrong this is correct solutions or I'm wrong and should use other parameters to tune my quad ?

My setup:
Suppo 2208-14
Mystery 12A with wii-esc firmware
8x4,5" GF propellers
weight ~650 grams

Regards,
Marcin.

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: A little correction for dynThrPID implementation.

Post by shikra »

Assumption is made that hover point is fairly near 1500, but for sure can vary. Mine is around 1600
So fair suggestion for tuning to perfection!

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: A little correction for dynThrPID implementation.

Post by ziss_dm »

Hi marbalon,

I have couple of questions:
1) What range are you using (125/250)?
2) What type of ocillations you have (fast/slow/erratic)?

regards,
ziss_dm

marbalon
Posts: 107
Joined: Thu Aug 18, 2011 10:59 am

Re: A little correction for dynThrPID implementation.

Post by marbalon »

ziss_dm wrote:Hi marbalon,

I have couple of questions:
1) What range are you using (125/250)?
2) What type of ocillations you have (fast/slow/erratic)?

regards,
ziss_dm


ad.1. 250
ad.2. fast
ad.3. maybe this is answer for next question - this is my all settings for Pitch/roll 4/0.030/5, gyro is l3g4200.

regards,
Marcin.

User avatar
dramida
Posts: 473
Joined: Mon Feb 28, 2011 12:58 pm
Location: Bucharest
Contact:

Re: A little correction for dynThrPID implementation.

Post by dramida »

My explanation (i had same situation long ago with a too powerful hexacopter on kk controller) is:
Because of high thrust/weight ratio, your engines produces sufficient lift to take of in a low rpm state of motors. In that low rpm, the reaction speed is not so-well as in middle range of thrust.

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: A little correction for dynThrPID implementation.

Post by copterrichie »

Please correct me here if I am wrong, the dynThrPID is disabled by default right?

marbalon
Posts: 107
Joined: Thu Aug 18, 2011 10:59 am

Re: A little correction for dynThrPID implementation.

Post by marbalon »

copterrichie wrote:Please correct me here if I am wrong, the dynThrPID is disabled by default right?

This parametr do nothing in two situations:
-when it is set to 0
-when thtottle is lower then 1500

Dramida:
Interesting theory but modifications above fix most problem, but I want to know if this is right way...

Regards,
Marcin.

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: A little correction for dynThrPID implementation.

Post by ziss_dm »

Hi marbalon,

ad.1. 250

arduino_pwm_250 or fast_pwm_250 ?

maybe this is answer for next question - this is my all settings for Pitch/roll 4/0.030/5, gyro is l3g4200.

Have you tried to increase D?

gyro is l3g4200.


Code: Select all

#if defined(L3G4200D)
void Gyro_init() {
  delay(100);
  i2c_writeReg(0XD2+0 ,0x20 ,0x8F ); // CTRL_REG1   400Hz ODR, 20hz filter, run!
  delay(5);
  i2c_writeReg(0XD2+0 ,0x24 ,0x02 ); // CTRL_REG5   low pass filter enable
}

I would try to increase LPF cut-off frequency, up to 100-200Hz.

regards,
ziss_dm

marbalon
Posts: 107
Joined: Thu Aug 18, 2011 10:59 am

Re: A little correction for dynThrPID implementation.

Post by marbalon »

ziss_dm wrote:Hi marbalon,

ad.1. 250

arduino_pwm_250 or fast_pwm_250 ?

maybe this is answer for next question - this is my all settings for Pitch/roll 4/0.030/5, gyro is l3g4200.

Have you tried to increase D?

gyro is l3g4200.




Code: Select all

#if defined(L3G4200D)
void Gyro_init() {
  delay(100);
  i2c_writeReg(0XD2+0 ,0x20 ,0x8F ); // CTRL_REG1   400Hz ODR, 20hz filter, run!
  delay(5);
  i2c_writeReg(0XD2+0 ,0x24 ,0x02 ); // CTRL_REG5   low pass filter enable
}

I would try to increase LPF cut-off frequency, up to 100-200Hz.

regards,
ziss_dm



arduino 250 with patch witch ext motor range in MWC code.In PID description I made misstake D is 50 not 5. will try to check your suggestion with LFP.

Regards,
Marcin.

ps. I resolved problem with oscilations using different dumpers, but stil have a question from first post, dynThrPid should work for throttle > 1500 or should should be changed for every quad.

marbalon
Posts: 107
Joined: Thu Aug 18, 2011 10:59 am

Re: A little correction for dynThrPID implementation.

Post by marbalon »

Hi ziss_dm,
I'm still fighting with some oscillations...
I tried to increase it to 50 and 110 (this is MAX) but it seems to more oscillate with higher values (only indoor tests so high throttle is hard to test), and I saw in GUI that when I increased cut-off frequency some noisy even it is on flat surface with all motors off.
I read manual for L3G4200D and try to understand how LFP and HPF works in this gyro. By default LFP is 20Hz and HFP 30Hz so only handle values between edges of this filters. So do you think I should change only LFP or maybe I should change booth both LFP and HFP. I have some idea about set ODR to 800 MHz this alows set HFT to 56 (this is MAX) and LFP to 50 so I will still have olny narrow band. Could you tell me more about your idea? Why LFP should be increased in this situation.

Now after some hardware modification - new dumpening method - I have realy stable copter in hover but still oscilate a little with full throttle.

Thanks for help.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: A little correction for dynThrPID implementation.

Post by PatrikE »

Lifting this thread because it's usable on airplanes to.
To move the point where dynThrPID starts from ex. 1500 to 1300.

It would help removing oscilations at highspeed flying and climbing.

Code: Select all

#define Breakpoint 1500
.......
 if(rcData[THROTTLE]<Breakpoint) prop2 = 100;
else if (rcData[THROTTLE]<2000) prop2 = 100 -(uint16_t)dynThrPID*(rcData[THROTTLE]-Breakpoint)/(2000-Breakpoint);
else                            prop2 = 100 - dynThrPID;

Post Reply