I've just try to tune my quadrocopter because on new soft 1.9 level mode can't be called stable
First of all I will provide my setup and my problem:
KDA 20-22L
Propellers GF 10”
Mystery 20A with quax firmware (fast response)
ADXL345 ACC
L3G4200D gyro
The main problem in new version is that my ACC is not filtered enough. This ACC is good in my opinion but output data need to be filtered. So with standard version (and default PID’s) my acro mode is perfect but stable mode is nervous. Its stays for a while and then fly to random direction but this looks like user input - just like little stick touch. In my opinion this is normal because I have non standard ESC with fast response and every bad value from ACC affected quadro behavior. So I need to filter my ACC data more, but the best If I can do this in fly time.
So I found good idea. First I changed current filter method to known method for LFP
global varioable in main file:
Code: Select all
static float lfpFactor = 0.27;
in IMU.pde
Code: Select all
static float accTemp[3];
….
Code: Select all
accTemp[axis] = accTemp[axis] * (1 - lfpFactor) + accADC[axis] * lfpFactor;
accSmooth[axis] = accTemp[axis];
Then I added two lines to tune this value in flue time and read it leter.
after this line:
Code: Select all
rcOptions = (rcData[AUX1]<1300) + (1300<rcData[AUX1] && rcData[AUX1]<1700)*2 + (rcData[AUX1]>1700)*4
+(rcData[AUX2]<1300)*8 + (1300<rcData[AUX2] && rcData[AUX2]<1700)*16 + (rcData[AUX2]>1700)*32;
I’ve added this
Code: Select all
lfpFactor = 0.0005 * (rcData[AUX2] - 1000);
And I display this line in debug3 window.
So now I can fly and find the best lfpFator value.
Result? I found that my quad is realy flyiable with value 0.27, have no problem with drift and no problem with fast return to flat position.
In my opinion every user should enable Aux2 just for initial setup and then put this into code or EEPROM. After this Aux2-lfpFator relation can be disabled using ifdef.
I think we can’t use hardcoded values or defines in IMU.pde because non expert users can find this and don’t know how to find correct velue. With this method I found best value in 5min and try my quad in nonwind wether and can left my it about 1min without stick input and drift is about 5m!
This method is similar to AeroQuad and I think we should use similar. Every quadro setup: ACC, ESC and motor are different so user should have easy way to find good filter option.
What do you think guys?
Cheers,
Marcin.