ryowens84 / Ultimate-IMU

Source Code for the Ultimate IMU from SparkFun
16 stars 5 forks source link

Sensor alignment #3

Open asymingt opened 13 years ago

asymingt commented 13 years ago

Hi Ryan

As far as I can tell the axes of the ITG3200 and ADXL345 are aligned on the board. The HMC5843 seems to require a 90 degree clockwise shift about the z-axis in order to meet the alignment with the other two sensors. Obviously, one can account for this orientation change in code. However, looking through your Library folder I notice that the getX() getY() and getX() methods for all three sensors retrieve the values in the individual sensors' coordinate frames. Looking at your fusion algorithm in Main.cpp, it seems as if the 90 degree clockwise shift of the HMC5843 is neglected. Am I missing something here?

Here's an image depicting what I believe to be the sensor layout. http://tinypic.com/r/35381ns/7

Cheers Andrew

turgaykale commented 13 years ago

Hi asymingt,

I have already been aware of the issue you indicate but havent responded untill i focus on the subject again. In the "hmc5843.c" file there is a function called "cHMC5843::getHeading()" which finds the heading angle but i see that ryan does not use this section in the program, he skips it and had written a new part in the main file which finds the heading again including the 90 degree clockwise shift which is;

//Find the heading. if(filter.x_h < 0)filter.heading = 180 - atan2(filter.y_h, filter.x_h)_180/PI; else if((filter.x_h > 0) && (filter.y_h < 0))filter.heading = -atan2(filter.y_h, filter.x_h)_180/PI; else if((filter.x_h > 0) && (filter.y_h > 0))filter.heading = 360 - atan2(filter.y_h, filter.x_h)*180/PI; else if((filter.x_h == 0)&& (filter.y_h < 0))filter.heading = 90; else if((filter.x_h == 0)&& (filter.y_h > 0))filter.heading = 270;

I have still problems with the ultimate imu and am still studying on it. My question is does anyone almost get accurate values from the imu or do they still have problems as i do. I need your help please also contact me at trgykl@gmail.com. Thank you