HI Lauszus,
I finally finished reading the 34 pages of this post! VEry valuable information, but I have not managed to find anyone with the same problems that me.
I have written some doubts in your Kalman filter article comments . I've thought about moving them to this thread so that if someone encounters the same problem, here you can find the information to solve it (if I can ever fix it ... )
First of all, I use your code LPR530AL_LY530ALH_ADXL335. I only modified the data sensitivity to suit my gyroscopes, which are the IDG650 and ISZ650. Here are their datasheets: http://www.roboard.com/Files/G145/Datasheet_IDG650.pdf and http://www.roboard.com/Files/G145/Datasheet_ISZ650.pdf . Instead of the sensitivity data your code, I used 2.27, which I think are the sensitivity data of my gyros ... ((0.00227*1023)/3.3 = 0.7037)
This is your code:
void loop() {
double gyroXrate = -((analogRead(gX) - zeroValue[0]) / 1.0323); // (gyroXadc-gryoZeroX)/Sensitivity - in quids - Sensitivity = 0.00333/3.3*1023=1.0323
gyroXangle += gyroXrate * ((double)(micros() - timer) / 1000000); // Without any filter
double gyroYrate = -((analogRead(gY) - zeroValue[1]) / 1.0323);
gyroYangle += gyroYrate * ((double)(micros() - timer) / 1000000);
This is mine:
void loop() {
double gyroXrate = -((analogRead(gX) - zeroValue[0]) /0.7037); // (gyroXadc-gryoZeroX)/Sensitivity - in quids - Sensitivity = (0.00227*1023)/3.3 = 0.7037
gyroXangle += gyroXrate * ((double)(micros() - timer) / 1000000); // Without any filter
double gyroYrate = -((analogRead(gY) - zeroValue[1]) /0.7037);
gyroYangle += gyroYrate * ((double)(micros() - timer) / 1000000);
Is correct?
Everything works correctly when the imu is static. IF I move the imu, I get the correct values in xAngle and yAngle variables. The problem occurs when the imu is in the airplane for which I am doing the tests. When the airplane takes off and starts flying, readings are totally erroneous.
IN the comments, you say me that :
It is most likely happening because your accelerometer values gets screwed up since I tuned the Kalman filter for my balancing robot and not for something like an airplane which is exposed to much larger g-forces than a balancing robot.
I went back to read the section “The measurement" one more time, and I understood there that is need to adjust the values ??of variance. it Refers to Q_angle, Q_bias and R_measure variables? But, these variables do not affect what you told me to tune the data to adjust the filter for the small g forces that supports your robot or the bigs one that is supporting my airplane… or affects?
I'm not sure these are the values ??I need to change to adjust the kalman filter to the strongest forces g the imu has to endure in the plane.
And, in the comments, you say:
Yes they do. For instance try to increase R_measure and it should trust new measurements less.
I have only tried with the values ??of kalman filter. i´ll try to modify the R_measure. Now, I'll try with the values ??of the complementary filter, to see if the same error occurs also.
Any help will be most welcome.