View Single Post
  #1   Spotlight this post!  
Unread 18-03-2015, 08:57
Aero Aero is offline
consumes pizza, produces code
AKA: Ari Lotter
FRC #0865 (Warp7)
Team Role: Programmer
 
Join Date: May 2013
Rookie Year: 2013
Location: Toronto
Posts: 30
Aero is on a distinguished road
Large amounts of gyro drift

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.
__________________
2014 Waterloo Regional Winner (254 & 2056)
2014 Curie Semifinalist (118, 359 & 4334)
2014 Fall Fiesta Finalist (2056, 4476)
6 X Gracious Professionalism Award Winner