Gyro accumulation error

Hello, I’m running an after school club using Vex IQ with Modkit. We were trying to get our robots to do an exact 90 degree turn using the gyro. It seems like after the gyro is running for a while there is accumulation error when getting the angle. I guess this is to be expected (I’m assuming the gyro module truly is just a gyro and doesn’t also include a compass chip?). Any suggestions though on how to use the gyro to get the robot to do a bunch of exact 90 turns in a row without accumulation error?

jgrauman,

Yes, you are correct in that the Gyro Sensor is only a gyro and does not include a compass sensor.

All electronic gyroscope sensors have a small amount of random noise on their signal, which is what causes the Gyro to seemingly drift over time. This noise is somewhat random and somewhat predictable. All Gyro Sensors are calibrated at the factory to eliminate as much of the “predictable” drift as possible. There are two things you can do to improve your results:

  1. You will likely get even better results if you calibrate the Gyro in your own program every time you begin the program. The Gyro calibrate block in Modkit takes about two seconds, during which time the robot must be stationary (if its moving the Gyro will calibrate to the motion, then your Gyro Sensor will think its in a tornado while its sitting still). After this, you should see a very low drift rate (under one degree every minute).

  2. Use an absolute heading rather than a relative heading. For example, turn to 270 degrees instead of turn left 90 degrees. If you use relative turn amounts (such as turn +90 degrees from current position), small errors will begin accumulating very quick. Absolute positions will allow the robot to compensate for small errors in previous turns.

Regards,

  • Art

Do you have a sample program for this using MODKIT? thanks!

hpisherwin,

A sample Gyro Sensor program is shown in the image below. This program will first calibrate the Gyro and then print the angle and current rotation of the Gyro to the Robot Brain LCD.

Regards,

  • Art

Do yuo have sample program of a combination of Gyro and Motors ? thanks!

For the sake of completeness (in case anyone reading this thread wonders) Damien has provided the answer in another thread:

http://www.vexiqforum.com/filedata/fetch?photoid=5171

Would you have an example in RobotC? Thanks.

ROBOTC has got built in examples for just about everything including gyro - just go to “File” then “Open sample program”. ROBOT C will automatically take you to the correct sample programs depending on the mode that you are in (i.e. Cortex or VEX IQ and Graphical or Text).

what about for calibrating it? ROBOTC does not have a sample code for calibration.

There isn’t a calibrate as such I don’t think, just a "resetGyro(portX); where X is the port number the gyro is connected to.