Skip
# Gyrosopic sensor question for engineers (kinetics, etc.)

Post

# Gyrosopic sensor question for engineers (kinetics, etc.)

January 7, 2014 3:38 PM Subscribe

Can a gyroscopic sensor (such as the type that are typically used in smartphones) embedded in this black object that is rotating around the X axis measure the number of rotations around the X axis if the object may or may not also be rotating at the same time in random ways (number of partial or full rotations, speeds, and directions) around the Z axis?

If so, is the Z axis rotation irrelevant, or is there special mathematics involved in filtering out the affects of the Z rotation on the measurement of X axis rotation? If the latter, what type of mathematics is that? Also, what is the impact of using a 2-axis vs. a 3-axis gyroscopic sensor for this measurement?

Thank you.

If so, is the Z axis rotation irrelevant, or is there special mathematics involved in filtering out the affects of the Z rotation on the measurement of X axis rotation? If the latter, what type of mathematics is that? Also, what is the impact of using a 2-axis vs. a 3-axis gyroscopic sensor for this measurement?

Thank you.

As Johnny Assay says, a thought experiment will show that you can't just ignore an axis. The reference frame that you care about (i.e. the observer or 'inertial' frame) is not the same as the frame in which the measurement is taking place (that of the object), so axes kinda end up mixing with each other. One way of dealing with this systematically is to use Euler angles; more elegant but perhaps more arcane are the quaternions. This robotics company page has a pretty good intro to Euler angles.

I've played with gyros but not really done anything with them. I suppose your first step is to integrate the gyro data, which gives you a time sequence of the absolute orientation. From there you can figure out how many times it rotated around the axis of interest. Dunno if there's an easier way.

posted by Standard Orange at 5:05 PM on January 7 [1 favorite]

I've played with gyros but not really done anything with them. I suppose your first step is to integrate the gyro data, which gives you a time sequence of the absolute orientation. From there you can figure out how many times it rotated around the axis of interest. Dunno if there's an easier way.

posted by Standard Orange at 5:05 PM on January 7 [1 favorite]

Johnny Assay and Standard Orange talked enough about gimbal lock, but I think there's another problem--that of numerical drift. The accelerometer only knows about relative motion. You can integrate, but you're going to end up with some error as you turn.

One way to combat this is to use the compass direction and gravity vectors to reframe your rotations, and remove the error when they can. For example, if you've rotated 360 degrees around the up vector, but your compass values are different, you may want to offset your rotational vector accordingly, when the error becomes too great. (alphanerd provides a better explanation below)

posted by hanoixan at 5:12 PM on January 7

One way to combat this is to use the compass direction and gravity vectors to reframe your rotations, and remove the error when they can. For example, if you've rotated 360 degrees around the up vector, but your compass values are different, you may want to offset your rotational vector accordingly, when the error becomes too great. (alphanerd provides a better explanation below)

posted by hanoixan at 5:12 PM on January 7

I have a degree in CS and an iPhone. I think the answer is yes provided there is software that keeps a record of each sensors' orientation with respect to its absolute reference vector over time.

For the x and y axes, the reference would be gravity. For the z vector, the reference could be north since the iPhone has a built in compass.

The iPhone has three sensors, one for each axis. I guess what you would do is look at the curves of the iPhone's orientation with respect to each one when plotted vs. time and look for intervals where it went from 0 to 0 passing through the entire range of values. You could look at whether it approached 0 from the positive or negative direction to determine whether the rotation was clockwise or counterclockwise relative to a frame of reference.

I think my answer is different from Johnny Assay's because I'm proposing that you use software to record things continuously and he was looking just at a before and after picture. Also, I'm appealing to reference vectors that are external to the iPhone.

posted by alphanerd at 5:15 PM on January 7

For the x and y axes, the reference would be gravity. For the z vector, the reference could be north since the iPhone has a built in compass.

The iPhone has three sensors, one for each axis. I guess what you would do is look at the curves of the iPhone's orientation with respect to each one when plotted vs. time and look for intervals where it went from 0 to 0 passing through the entire range of values. You could look at whether it approached 0 from the positive or negative direction to determine whether the rotation was clockwise or counterclockwise relative to a frame of reference.

I think my answer is different from Johnny Assay's because I'm proposing that you use software to record things continuously and he was looking just at a before and after picture. Also, I'm appealing to reference vectors that are external to the iPhone.

posted by alphanerd at 5:15 PM on January 7

It's possible that a magnetomoeter (a compass) would be more suited to your particular application than a gyro.

posted by aubilenon at 5:34 PM on January 7

posted by aubilenon at 5:34 PM on January 7

You are not logged in, either login or create an account to post comments

I think the answer to your question is "no", sort of. Try the following experiment: take a book and put it on the table in front of you. Let's define the X to be aligned left-right, the Y-axis to point away from you, and the Z-axis to point parallel to the table. Now do the following:

- Stand up the book. This is a 90° rotation about the X-axis.
- Rotate the book 180° around an axis pointing away from you (i.e., the Y-axis.)
- Lie the book back down, opposite the direction you rotated in the first step. This is a -90° rotation about the X-axis.

If you've done this right, the net result is that the book has rotated 180° around the Z-axis. But you never rotated it about the Z-axis; you only ever rotated it about the X- and Y- axes. In other words, you can't distinguish between a straight rotation around the Z-axis and the combined effects of the rotation around the X- and Y- axes.Just to forestall a possible counterargument: there's no such thing as "rotating about the X-axis and the Z-axis" only. Once you have two axes, you have to allow for the possibility that it'll be rotating about the third, because of the arguments above. It's well-defined to rotate about one fixed axis, but once you start allowing for rotation about two different axes you get the effects of rotation about the third axis automatically.

posted by Johnny Assay at 4:16 PM on January 7