I cannot believe that I'm the only one who noticed that! I would write it off as a faulty device but I've got two brand new once here that produce identical output with the same unmodified firmware (V1.9)
Here is the description of the problem:
1. Initialize IMU level
2. Slowly turn 90 in roll
3. Return to horizontal orientation.
4. Slowly turn -90 in roll
5. Return to horizontal orientation.
6. Repeat for pitch and yaw (yaw rotate 360 in 90 deg increments)
Each axis output should correspond to the number of degrees turned. Instead I get the following:
Roll reading: actual roll: - 90 deg -> RLL output: - 120
+ 90 deg -> RLL output: + 120
Pitch reading: actual pitch: -90 deg -> PCH output: -50 (goes from 0 to -89 and then decreases to -50)
+90 deg -> PCH output: +50 (goes from 0 to 89 and then decreases to 50)
Yaw reading: actual yaw: 0 deg -> YAW output: 180
90 deg -> YAW output: 108
180 deg -> YAW output: 45
270 deg -> YAW output: -40
360 deg -> YAW output: -180
I just verified my values again on a tilt platform with a digital protractor. My unit tracks angles (both pitch and roll) within a degree of the protractor. So it is something in your setup, software or possibly even hardware. Make sure you tilt along main axes (not diagonally), make sure your unit initializes flat when you turn the power on and it is perfectly stationary while the LEDs are flashing.
I just wanted to confirm that the two simple changes (GRAVITY=8192 and the two gain changes) are all that is required for you an ArduIMU 1.9.8 (neglecting YAW improvements - I don't use a GPS). I will retest my measurements - do you go all the way near 90 deg or just to maybe 45 deg.
Do you have any expectations of whether it will drift much as long as the rotation rates are low?
I appreciate your expertise in this - don't you think that whoever is responsible for the code should make your changes and release it.
Those are the only two changes I made as far as pitch and roll go. Today I tested it again to 60 degrees both pitch and roll but previously I went all the way to 90.
At rest pitch and roll should not drift at all. Accelerometer takes care of that. If it still doesn't work look at the raw output of the gyro and accelerometer.
I posted the bug report about this issue at the ArduIMU development page on June 28th. It is still sitting there in new issue category among a couple dozen other issues. I don't think this "project" has an owner. Somebody wrote the original code a long time ago and since then moved on. Later on somebody tried re-write the code for the new hardware and botched it. The reason Sparkfun and 3D Robotics get away with that is because it is just an "example" code. You are buying hardware and you are free to do whatever you want with it.
Did you ever get this working? I'm experiencing the exact same symptoms as you are with the scaling of roll and pitch values.
I am not using DCM algo for arduIMU v3 cause it is not giving me correct anglular orientation.
I have used only MPU6000 for orientation calculation.
The function for used for calculation gyro angle is as below:
void Get_Gyro_Rates(unsigned long dt)
byte_H = MPU6000_SPI_read(MPUREG_GYRO_XOUT_H);
byte_L = MPU6000_SPI_read(MPUREG_GYRO_XOUT_L);
gyroXRaw = ((byte_H8)| byte_L) - GYRO_XOUT_OFFSET;
// Read GyroY
byte_H = MPU6000_SPI_read(MPUREG_GYRO_YOUT_H);
byte_L = MPU6000_SPI_read(MPUREG_GYRO_YOUT_L);
gyroYRaw = ((byte_H8)| byte_L) - GYRO_YOUT_OFFSET;
// Read GyroZ
byte_H = MPU6000_SPI_read(MPUREG_GYRO_ZOUT_H);
byte_L = MPU6000_SPI_read(MPUREG_GYRO_ZOUT_L);
gyroZRaw = ((byte_H8)| byte_L) - GYRO_ZOUT_OFFSET;
gyroXRate = (float)gyroXRaw/gyro_xsensitivity*dt*0.001;
gyroYRate = (float)gyroYRaw/gyro_ysensitivity*dt*0.001;
gyroZRate = (float)gyroZRaw/gyro_zsensitivity*dt*0.001;
GYRO_XANGLE += gyroXRate;
GYRO_YANGLE += gyroYRate;
GYRO_ZANGLE += gyroZRate;
here, I am am continuously getting increments or decrements in each angle..
If you can help please suggest me the best way to use arduIMU v3..?
the tan,sin,cos are multiplied by 1.9--- delete this 1.9 so in the last part in DCM
#if (OUTPUTMODE==2) // Only accelerometer info (debugging purposes)
roll = atan2(Accel_Vector,Accel_Vector); // atan2(acc_y,acc_z)
pitch = asin((Accel_Vector)/(double)GRAVITY); // asin(acc_x)
yaw = 0;
pitch = asin(DCM_Matrix);
roll = atan2(DCM_Matrix,DCM_Matrix);
yaw = atan2(DCM_Matrix,DCM_Matrix);
turning off the magnetometer will solve the issue !!!