I'm trying to use the KOP Gyro to control our orientation during auton, but the angle is drifting a lot without the robot moving.
This makes our robot drive in curves, and not in straight lines.
We're not doing anything funky programming-wise, the drift is observable with barebones code
Code:
from wpilib import SampleRobot, run, Gyro, Timer, SmartDashboard
class GyroTest(SampleRobot):
def robotInit(self):
self.gyro = Gyro(0)
def disabled(self):
while self.isDisabled():
SmartDashboard.putNumber('Gyro', self.gyro.getAngle())
Timer.delay(0.01)
if __name__ == "__main__":
run(GyroTest)
The gyro starts at 0 (as it should) and without the robot moving, slowly starts creeping at a rate of about -1 degree / 5 seconds.
Any ideas? We've already checked our gyro's pwm cable.