Quote:
Originally Posted by PhilBot
No wonder my bot corrected in the wrong direction on evey second lap 
|
So I spent some time working on this yesterday, mostly just understanding how everything works (I wrote this code a few years ago). First, a bit of history: My first cut of the gyro code was included in the scripting code Rich Petras and I released in 2005 and the intent was to reset the gyro angle to zero, have the robot perform a turn, drive straight, reset the gyro angle to zero, execute another turn, etc. In this way, all turns are relative and I didn't need to worry about rollover.
Okay, so yesterday I modified the code to gain more headroom (ADXRS150 w/ default settings rolls over in just over five revolutions) and implemented a scheme where complete revolutions are detected, counted, and then subtracted from the total angle. In this way the number of revolutions is accounted for separately from the angle. The downside is that the code is somewhat bloated and convoluted. I guess I'd like to keep the status quo with additonal headroom and dump the loop counting code, but I'd like to get some feedback on what teams want.
-Kevin