Pages: [1]   Go Down
Author Topic: Gyro 3d rotational displacement using 2D polar coordinates?  (Read 722 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.   smiley-roll-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.
Logged

0
Offline Offline
Shannon Member
****
Karma: 162
Posts: 10496
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good intro to DCMs here - definitely better than Euler angle approach IMO:
http://gentlenav.googlecode.com/files/DCMDraft2.pdf

You fail to realise the importance of the rotation group being non-abelian.  This means composing rotations doesn't commute (it matters which rotation comes first, and you have to integrate all 3 axes together, not separately.  You compose the delta-rotations with the current DCM at each integration step and periodically re-normalise the DCM.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the link! The rotation order is not a big deal apparently if you are using small angle approximation because the angles are so small that the approximation rounds them to nothing. I think my max speed will be less than .2 radians for each of the periodic integrations. This apparently is a good time to use the small angle approximation. Time will tell . . .
-Noah
Logged

Pages: [1]   Go Up
Jump to: