class wpilib.ADXRS450_Gyro(port=None)[source]

Bases: wpilib.GyroBase

Use a rate gyro to return the robots heading relative to a starting position. The Gyro class tracks the robots heading based on the starting position. As the robot rotates the new heading is computed by integrating the rate of rotation returned by the sensor. When the class is instantiated, it does a short calibration routine where it samples the gyro while at rest to determine the default offset. This is subtracted from each sample to determine the heading.

This class is for the digital ADXRS450 gyro sensor that connects via SPI.


Parameters:port (SPI.Port) – The SPI port that the gyro is connected to

Delete (free) the spi port used for the gyro and stop accumulating.

kCalibrationSampleTime = 5.0
kDegreePerSecondPerLSB = 0.0125
kFaultRegister = 10
kHiCSTRegister = 6
kLoCSTRegister = 4
kPIDRegister = 12
kQuadRegister = 8
kRateRegister = 0
kSNHighRegister = 14
kSNLowRegister = 16
kSamplePeriod = 0.001
kTemRegister = 2