Calibrate Gyro

Does anyone know how to calibrate the gyro on the fly and not just at the begin?

To calibrate the bias, your robot needs to be sitting still. If it is moving, then that value that will map to zero rotation, and that is not what you want.

The bias calibration takes place in Open. You can copy that code and do it at any point, or you can call Open someplace other than Begin. If you don’t really want to recalibrate, but instead just orient to the field, you can simply call reset so the current orientation will return zero.

Greg McKaskle

Thanks for your advice. I have been running into problems with gyro drift and i am wanting to reduce it some. So my plan was to have a button on the driver station that i could push right before the match start to calibrate the gyro to the current temp. Is that possible?

If the robot is disabled, like it will be before the match starts, it runs the code in the Disabled VI. Which is mostly empty.

You can of course read the joystick there and close and then reopen the gyro and store its refnum in the registry. You can also measure the drift and show it on the dashboard so that the drive team will know how much it is drifting while disabled and presumably sitting still.

Greg McKaskle