Go to Post "Evaluate twice, execute once" - Andrew Schreiber [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 14-02-2008, 13:37
FRC4ME FRC4ME is offline
Registered User
FRC #0339
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Fredericksburg, VA
Posts: 324
FRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant future
Re: KOP Gyro Lag

3Here's an example of what my terminal windows looks like after I get after telling the robot to turn, then go straight. This isn't actually code - it's what prints out into the terminal window. First, it does the turn, and the gyro value reflects that:

Code:
Autonomous State = Turn
Loop Number = 1
Gyro Value = 75
Left Motor = 127, Right Motor = 230
Autonomous State = Turn
Loop Number = 2
Gyro Value = 75
Left Motor = 127, Right Motor = 230
Autonomous State = Turn
Loop Number = 3
Gyro Value = 75
Left Motor = 127, Right Motor = 230
Autonomous State = Turn
Loop Number = 4
Gyro Value = 75
Left Motor = 127, Right Motor = 230
This continues until the robot has turned 90 degrees, as determined by the gear tooth sensors (and I can confirm by watching it that that works):

Code:
Autonomous State = Turn
Loop Number = 32
Gyro Value = 75
Left Motor = 127, Right Motor = 230
Autonomous State = Turn
Loop Number = 33
Gyro Value = 75
Left Motor = 127, Right Motor = 230
Autonomous State = Turn
Loop Number = 34
Gyro Value = 75
Left Motor = 127, Right Motor = 230
TURN DONE
Now that the turn is done, I go into another function that tells the robot to go straight, using the gyro to make corrections to the motor speeds. In that function, the printouts say:

Code:
Autonomous State = Straight
Loop Number = 35
Gyro Value = 75
Left Motor = 230, Right Motor = 230
Autonomous State = Straight
Loop Number = 36
Gyro Value = 75
Left Motor = 230, Right Motor = 190
Autonomous State = Straight
Loop Number = 37
Gyro Value = 75
Left Motor = 230, Right Motor = 160
Autonomous State = Straight
Loop Number = 38
Gyro Value = 75
Left Motor = 230, Right Motor = 140
Autonomous State = Straight
Loop Number = 39
Gyro Value = 75
Left Motor = 230, Right Motor = 127
Autonomous State = Straight
Loop Number = 40
Gyro Value = 75
Left Motor = 230, Right Motor = 127
Autonomous State = Straight
Loop Number = 41
Gyro Value = 75
Left Motor = 230, Right Motor = 127
That continues for about forty loops, when the gyro finally notices that we aren't turning anymore:

Code:
Autonomous State = Straight
Loop Number = 75
Gyro Value = 80
Left Motor = 230, Right Motor = 127
Autonomous State = Straight
Loop Number = 76
Gyro Value = 95
Left Motor = 230, Right Motor = 150
Autonomous State = Straight
Loop Number = 77
Gyro Value = 115
Left Motor = 230, Right Motor = 180
Autonomous State = Straight
Loop Number = 78
Gyro Value = 127
Left Motor = 230, Right Motor = 230
Now, the robot thinks it's going straight and stops correcting the motors. Of course, it's actually way off course, since it "corrected" for 30 tics in which the gyro reported a left turn that wasn't actually happening.

Note that I was putting that into my own words since I didn't save the terminal printouts and can't get new ones right now. The gyro value actually varied between 72 and 78 during the turn.

I can slow down the printouts, but I don't see how that would help. Yes, all of the printouts are delayed. In fact, we get a red light of death if we run autonomous mode for too long with those printouts on (serial buffer overflows). But all of the prinouts should be affected by the same delay. The fact remains that, for forty tics after the turn stops, the gyro reports that we are still turning.

The only way the printouts could be the problem is if they were somehow slowing down the ADC but not the rest of the code. I'll try slowing down the printouts to once every ten loops tomorrow (we're taking today off), but I doubt it will help.

I think the problem is related to us exceeding the gyro's 80 dps range during the turn, but like I said, we don't want to buy the 300 dps version only to find out that it has the same lag.

What exactly happens when you exceed the gyro's range? Will it simply report its maximum range and then go back down when you stop turning? Or will it get "stuck" at its maximum range for about a second?

And no, we aren't using any other loops in our code except the master 26.2ms loop. We used to use a while loop to do atuonomous, but we fixed that. There are a few floating point operations, but nothing too complicated.

Last edited by FRC4ME : 14-02-2008 at 13:40.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Lag Issue bizarospooky Programming 7 08-02-2008 17:31
Some 2007 KOP Gyro Performance Data yoyodyne Control System 3 02-04-2007 20:07
KOP Gyro seems to run-on after turn stops PhilBot Control System 8 05-03-2007 12:43
KOP Gyro John Gutmann Programming 12 12-12-2005 21:59
Lead-Lag Compensator eSouL Control System 0 13-08-2004 03:21


All times are GMT -5. The time now is 20:23.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi