I am using the ITG-3200 gyroscope and have it calibrated very well with very little drift. I'm building a toy prototype, so pinpoint accuracy is not a huge issue. The gyro is in the center of a ball.

I need to track the position of a single point (P) on the shell of a plastic sphere to trigger programmed actions when it is rotated certain directions relative to the user. I think spherical coordinates are the way to go, because they allow me to know how far it has moved from the starting position and use that as the offset for calculations dealing with the current position. After some research I am still fuzzy on the exact process of turning the gyros digital x, y, and z angular rate into a 2d projection of my point in spherical coordinates.

The whole point of this is to remove the frame of reference of the rotating object and instead, approximate the user's global frame of reference (from the initial conditions) close enough to allow rotations to be mapped relative to the user's body, (not tied to the axi of the sphere). This would mean directions like rotate ball left, rotate ball right, rotate forward, backwards etc. could be followed without reference to the accumulated rotational condition of the sphere. :cold_sweat:

In short I want to integrate the speed of rotation to keep track of the 3d rotational displacement using 2D polar coordinates (dropping the radius because it stays constant)

This is what I think should work. (Any help or conceptual guidance will be appreciated)

A.) Start with x, y, z angular rate B.) Integrate over time to get angular displacement for each axis (some small error will be present) C.) Calculate the single compound angle w and it's arbitrary rotation matrix (and axis) D.) multiply the coordinates of initial point P with the resultant rotation matrix of step C E.) covert displaced point in Cartesian coords to polar coords F.) Use the Azimuth and Zenith of the polar mapping as if it were an x-y plane, effectively projection mapping the point on the sphere into a two dimensional array for driving various actions (like blink this light and make this sound when the point P enters polar region x, y)

I learned projective geometry in art school, but never did calculus. This might be a major over-complication. It seems like more work than I probably need to do. Or it might be yet too simple. I'm going to continue hashing it out but feel free to advise if you are familiar with this math.

I have read the somewhat dated primer document here: http://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-696.pdf but turning those equations into Arduino code is boggling my brain. Thanks.