Gyro gets lost

We are new at using gyro, but have tried to read up on them. We are using C++ and are reading back the angle from a gyro. We are using the KoP gyro that is half of the am-2067 board.

Our problem is that when moving the gyro around (twisting it), it will measure to 90’ fine and then back to 0’, but after twisting it a few time it will lose track of where it is pointing. After twisting it around and back for 20 seconds or so, it will read ~20’ at the origin (0’) position. Is this normal? This does not seen to be related to drift. We have 2 gyros and they both do this same thing.

If this is normal operation, then how do you keep orientation on the field while using a mecanum drive? If this in not normal, then any suggestions would be greatly appreciates!

Sometimes, drift occurs. Our gyro has an integrated temperature sensor, which is supposed to be used for calculations making it more accurate, but we haven’t used it yet. What we use is a function which resets the gyro every time we make a turn. That way, it minimizes drift.

Thanks for the quick reply!

We can observe the drift with the gyro not moving and it drifts about 1’ per minute. Will gyro movement amplify the drift to this extent? We are seeing about 20’ in less then 20 seconds and it is worse with the more movement.

A couple things come to mind on why you might be seeing more “drift” when moving:

  • The movement is saturating the gyro. Gyros have a maximum rotation rate they can measure - make sure your movements are slower than that (or get a gyro with a larger range. The tradeoff is usually larger range means less precision for the same price point.) The am-2067’s max rate is 250 deg/sec. If you’re twisting the gyro with your hand or using an unloaded drivebase, you can easily move faster than this.
  • Your integration timescale is too large. The gyro outputs rate information which is then integrated over time. If you wrote your own integration routine, the sampling rate might be too low. If you’re using WPIlib’s Gyro class, that uses one of the RoboRIO’s FPGA accumulators to do the integration, which is about as fast as you can get.
  • Make sure you keep the gyro flat when turning it. The gyro will only measure in-plane rotation, so if you change the angle, it might read different measurements for the 0->90 and 90->0 movements.

We’re using the am-2067, and we’ve found it to only have drift of about 30’ after 2:30 of crazy rotation and haphazard driving.

The documentation of the am-2067 that says it needs 5 seconds after first activating to calibrate. Are you letting it do that?