Is the complimentary filter making the system laggy?

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
do335maomao
Posts: 4
Joined: Fri Jun 06, 2014 4:27 pm

Is the complimentary filter making the system laggy?

Post by do335maomao »

Hello,

Recently I am testing the code of IMU of MWC2.2 alone.

I just turn the mpu6050 board 90deg CCW and then turn it back to see if the angle[ROLL] output is correct.

I found that, after the accADC[axis] is about (0,0,512) which indicates that the ROLL should be 0 deg,
it takes some time for the angle[ROLL] to drop to around 0.

I can understand the filter is used for adding new acc data into Acc Vector slowly.
But since the GYR_CMPF_FACTOR is 600, which means it is (oldData*600+newData*1)/601,
would it rely too much on the oldData?

EstG.A[axis] = (EstG.A[axis] * GYR_CMPF_FACTOR + accSmooth[axis]) * INV_GYR_CMPF_FACTOR;

I added a few lines of code to test how much time would the angle[ROLL] take to drop to 0 after the accADC[0] and accADC[1] have been around 0.

The result is about 2000 ms.

And if I reduce the GYR_CMPF_FACTOR to 100, the time it takes would reduce to about 300ms.

Is the delay of angle really happening during flight or I did something wrong?

Sorry for my English

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Is the complimentary filter making the system laggy?

Post by Alexinparis »

Hi,

But since the GYR_CMPF_FACTOR is 600, which means it is (oldData*600+newData*1)/601,
would it rely too much on the oldData?

What is really important here is that "oldData" is also updated regarding the instantaneous gyro rotation at each cycle.

The purpose is precisely to not rely too much on acc data on each computation
acc data is here to correct the reference over long time basis.

Post Reply