Hi all,
Im very new to arduino and sensors and I want to learn to get a 9DOF to work.
I'm using the 9DOF sensor stick from sparkfun
I've got the Gyro working correctly but I'm having problems with the Accelerometer.
As I turn the Accelerometers X axis to a vertical position the Y axis begins to flip.
If I turn the Accelerometers Y axis to a vertical position the X axis begins to flip.
It is hard to explain so I made a video.
This video shows the problem using an 3d object. (I set the yaw to zero as it cannot be measured with the accelerometer)
At first you see the angle's are correct until I reach the turning point. It happens in both axis.
Then I made this second video where you can see the RAW G values and the calculated X and Y angle.
I use this code to get from G to angle in degrees:
Y = ((atan2(rawY,rawZ)+PI)*RAD_TO_DEG);
X = ((atan2(rawX,rawZ)+PI)*RAD_TO_DEG);
How can I fix this problem? I cant find a sollution
Thanks in advantage!