Calibrate method for gyro

Hello,

I was wondering what a calibration is, ( gyro.calibrate(); ) how long it takes to complete and where in my robot code should I put it if I have a command bot. should I put it in Robot.java in the RobotInit() method?

The gyroscope is a ADXRS450 gryo from Analog Devices…

From the API documentation (emphasis mine):

Calibrates the gyro by running for a number of samples and computing the center value. Then use the center value as the Accumulator center value for subsequent measurements. It’s important to make sure that the robot is not moving while the centering calculations are in progress, this is typically done when the robot is first turned on while it’s sitting at rest before the competition starts.

And from poking around in WPILib a little, it seems to calibrate for 5 seconds:

Given this information, it would seem that putting your calibration in robotInit() would make sense.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.