Go to Post I am sorry if something was missed at your regional, it will be checked at this event. - Al Skierkiewicz [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 28-03-2004, 19:38
gnormhurst's Avatar
gnormhurst gnormhurst is offline
Norm Hurst
AKA: gnorm
#0381 (The Tornadoes)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Trenton, NJ
Posts: 138
gnormhurst will become famous soon enoughgnormhurst will become famous soon enough
Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)

I think the RC is doing something very strange.

We noticed this while repeatedly running autonomous on a tether. The first phase of our auton. is a timed run for about 5.5 seconds. After running two or three times properly, we again reset the controller (press the reset button on the RC) and throw the "Autonomous" switch on the competition port, but this time it runs for about 11 seconds before going to the next phase. Note that 11 = 5.5 * 2.

It does this occasionally, every now and then.

What's more, when it does this, the trackers scan much more slowly (my own tracker code, but see below).

We have special LED blinkers on the robot (for telemetry) and they blink about half as fast when it does this.

Then we reset, unplug the tether and plug it back in, turn around two times and throw salt over our shoulders and try again. And then it runs normally (5.5 second run, normal tracker scan speed and blinker speed.) But I have seen it run in "slow mode" more than once in a row.

I remember when I had Kevin's tracker code and there was no beacon to see, the trackers would just scan and scan (as expected). Then, by themselves, they would start scanning at half speed. I think it was the same problem I am seeing now.

My guess is that the RC is missing every other 26 ms cycle, but I don't know why. If the code didn't run in less than 26 ms it might do this, but I would expect it to do this the same way every time, not just sometimes, nor run fine for awhile and then start running half speed. This behavior seems to appear randomly -- I can't correlate it to anything else.

Has anyone else seen this? Any ideas? Seems like a half-fast controller!

-Norm
__________________
Trenton Tornadoes 381
2004 Philadelphia Regional Winners
2006 Xerox Creativity Award
---
My corner of the USPTO.
My favorite error message from gcc: main is usually a function
My favorite error message from Windows: There is not enough disk space available to delete this file.
  #2   Spotlight this post!  
Unread 28-03-2004, 22:36
Random Dude Random Dude is offline
Oregon State Head FTA
AKA: Chris
no team (Oregon Robotics Tournament & Outreach Program)
 
Join Date: Aug 2002
Rookie Year: 1998
Location: Oregon
Posts: 142
Random Dude will become famous soon enoughRandom Dude will become famous soon enough
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)

Any chance your code is taking too long?
  #3   Spotlight this post!  
Unread 28-03-2004, 22:40
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)

do you have printf statements in your code?

I havent done any testing with them this year, but with previous years RCs debug statements would slow you way down

they are a serial output - so its possible that after you run auton a few times they get so backed up they slow the loop down?

once we get our bot running right we comment out ALL the printf statements.
  #4   Spotlight this post!  
Unread 28-03-2004, 22:42
Max Lobovsky's Avatar
Max Lobovsky Max Lobovsky is offline
Fold em oval!
FRC #1257 (Parallel Universe)
Team Role: College Student
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Scotch Plains, NJ
Posts: 1,026
Max Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant futureMax Lobovsky has a brilliant future
Send a message via AIM to Max Lobovsky
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)

im not sure what your trackers are, but if they involve interrupts based on outside effects, then you may get varying amounts of interrupts thereby causing your code to take longer. Also, the radio modem's interrupts may cause some discrepancies but i think this is handled by a seperate computer so i dont know...
__________________
Learn, edit, inspire: The FIRSTwiki.
Team 1257


2005 NYC Regional - 2nd seed, Xerox Creativity Award, Autodesk Visualization Award
2005 Chesapeake Regional - Engineering Inspiration Award
2004 Chesapeake Regional - Rookie Inspiration award
2004 NJ Regional - Team Spirit Award
  #5   Spotlight this post!  
Unread 28-03-2004, 23:03
10intheCrunch's Avatar
10intheCrunch 10intheCrunch is offline
Who's John V-Neun?
AKA: Alex Baxter
None #0254 (Cheesy Poofs)
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2004
Location: San Jose, CA
Posts: 129
10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough10intheCrunch is a jewel in the rough
Send a message via AIM to 10intheCrunch
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)

The radio interrupts are handled by the Master processors, so that shouldn't actually be interrupting you, and I *really* doubt you have enough interrupt code to stall you that much. Further, if you don't call putdata() often enough (the normal 40hz or faster, I believe) the Master assumes the User is faulty/off and shuts it all down.

A red flag for me is that this is happening under tether...we had a lot of problems working with the tether when we were at Sacramento. The RC would keep resetting itself for no real discernable reason, and values were coming in really screwy-like. We solved most of the issues by ignoring the first few radio packets coming in, but I doubt that's what's going to help you...so weird.
__________________
~Alex Baxter
Programming, Arms operation, Team 254
  #6   Spotlight this post!  
Unread 28-03-2004, 23:59
Jay Lundy Jay Lundy is offline
Programmer/Driver 2001-2004
FRC #0254 (The Cheesy Poofs)
Team Role: Alumni
 
Join Date: Jun 2001
Rookie Year: 2001
Location: Berkeley, CA
Posts: 320
Jay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to all
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)

Try printing out the packet number after every Getdata. It's rxdata.packet_num or rxdata.packetnum or something like that (you want the packet number in rxdata, not txdata). If your packet number keep incrementing by 2, you're missing packets.

If you are missing packets, I don't know what to say other than I wish IFI would reveal more about their communication structure rather than packing everything useful into a library. We've run into several strange errors where more knowledge about the whole setup would have greatly speed up the debug process.

If you are catching every packet and it's still running at 1/2 speed, then I'd definately say it's an issue with how the master processor handles communication over the tether. The rxdata packet number is controlled by the master. Once again, it's hard to investigate these problems without the master code...

Though I would suggest you try to run everything off of timers rather than program counts. It's more accurate and more reliable that way.
  #7   Spotlight this post!  
Unread 29-03-2004, 18:21
gnormhurst's Avatar
gnormhurst gnormhurst is offline
Norm Hurst
AKA: gnorm
#0381 (The Tornadoes)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Trenton, NJ
Posts: 138
gnormhurst will become famous soon enoughgnormhurst will become famous soon enough
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)

Quote:
Try printing out the packet number after every Getdata. It's rxdata.packet_num or rxdata.packetnum or something like that (you want the packet number in rxdata, not txdata). If your packet number keep incrementing by 2, you're missing packets.
Aha! Finally, a test I can do. Thanks, that's very helpful!


Quote:
im not sure what your trackers are, but if they involve interrupts based on outside effects, then you may get varying amounts of interrupts thereby causing your code to take longer.
Yeah, that occured to me, too, but I don't know how to test for it.


Quote:
Any chance your code is taking too long?
Always a chance. But I tested it way back in January with a scope and found the non-auton code taking less than 5 ms. I kind of think the auton code is not 5 times longer. I thought of taking my scope on the plane to Atlanta, but the thought passed (Tek 475 -- about the size of another carry on, but much more fragile than my socks). Besides, I think Kevin Watson's unmodified tracker.hex code had this same behavior, too. I think, but I might not swear to it.


Quote:
do you have printf statements in your code?
Yes. Turning off printf is a good thing to try. I may write a dummyPrintf() function and #define printf dummyPrintf

Code:
void
dummyPrintf( char *s, ... )  // note the var arg "..."
{
  return;
}

// and later:
#define printf dummyPrintf
Do you think that will do what I want (shut down all printfs at once)?

I think printf's are always suspect since I found a strange behavior: I would upload the code, it would start running, flooding the screen with printf output, so much that when I stopped the RC the screen kept going for a second or so. Then the program would not run again after a reset. I had to download the code each time to run it once. I got rid of most of the printfs, and that self-destructive behavior went away. Beware printfs!

Thanks for all your inputs.

-norm
__________________
Trenton Tornadoes 381
2004 Philadelphia Regional Winners
2006 Xerox Creativity Award
---
My corner of the USPTO.
My favorite error message from gcc: main is usually a function
My favorite error message from Windows: There is not enough disk space available to delete this file.
  #8   Spotlight this post!  
Unread 29-03-2004, 18:45
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)

Quote:
Originally Posted by gnormhurst
I think printf's are always suspect since I found a strange behavior: I would upload the code, it would start running, flooding the screen with printf output, so much that when I stopped the RC the screen kept going for a second or so. Then the program would not run again after a reset. I had to download the code each time to run it once. I got rid of most of the printfs, and that self-destructive behavior went away. Beware printfs!
Norm,

If you call printf() before the Initialize_Serial_Comms() call in user_initialization() you'll see this exact behavior.

I agree that printf() is a big resource hog and should be used sparingly. I'm working on an implementation of printf() that uses a circular buffer and the Tx interrupt to ease the problem a bit. If it works pretty well, I'll release it when I'm done.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #9   Spotlight this post!  
Unread 29-03-2004, 18:51
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)

on thing thats really useful for debugging your code is to use the user_mode variable on the OI - you only get to see one byte of data, but its there all the time

when we used printf's in our code it would lag about 10 seconds from when the data changed in the RC - I dont know why
  #10   Spotlight this post!  
Unread 29-03-2004, 18:57
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)

Quote:
Originally Posted by KenWittlief
on thing thats really useful for debugging your code is to use the user_mode variable on the OI - you only get to see one byte of data, but its there all the time

when we used printf's in our code it would lag about 10 seconds from when the data changed in the RC - I dont know why
It shouldn't be that extreme.
__________________

  #11   Spotlight this post!  
Unread 29-03-2004, 19:01
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)

yeah I never understood it - the RC was running fine, but the window took 10 seconds to update when you moved an arm or changed a pot position.
  #12   Spotlight this post!  
Unread 29-03-2004, 19:05
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)

Quote:
Originally Posted by gnormhurst
I thought of taking my scope on the plane to Atlanta, but the thought passed (Tek 475 -- about the size of another carry on, but much more fragile than my socks).
Man, I have fold memories of my old 475. Looks like they can be found on ebay pretty cheaply. You know you're a middle aged EE geek when you dream of oscilloscopes past .


Quote:
Originally Posted by gnormhurst
Besides, I think Kevin Watson's unmodified tracker.hex code had this same behavior, too. I think, but I might not swear to it.
The tracker code is pretty efficient; I can't imagine it taking more than a millisecond to execute each pass.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #13   Spotlight this post!  
Unread 30-03-2004, 15:36
Random Dude Random Dude is offline
Oregon State Head FTA
AKA: Chris
no team (Oregon Robotics Tournament & Outreach Program)
 
Join Date: Aug 2002
Rookie Year: 1998
Location: Oregon
Posts: 142
Random Dude will become famous soon enoughRandom Dude will become famous soon enough
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)

Quote:
Originally Posted by KenWittlief
on thing thats really useful for debugging your code is to use the user_mode variable on the OI - you only get to see one byte of data, but its there all the time

when we used printf's in our code it would lag about 10 seconds from when the data changed in the RC - I dont know why

Ya, we had the same problem as well. The lag was actually in the terminal program not being able to refresh quickly enough, due to our slow PC.
We simply modified the printf() function to only spit out less frequently.
  #14   Spotlight this post!  
Unread 30-03-2004, 15:59
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,366
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)

Quote:
Originally Posted by KenWittlief
yeah I never understood it - the RC was running fine, but the window took 10 seconds to update when you moved an arm or changed a pot position.
We've seen the lag as well, and (for us anyway) it's in the IFI terminal program. Switch to a better terminal program (even Hyperterm will do) and the problem should go away.
Closed Thread


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
Future of Autonomous Mode FadyS. Programming 41 24-05-2004 19:45
A better autonomous method.. randomperson Programming 4 24-02-2004 18:02
Flow rate / remaining pressure swabbie58 Pneumatics 5 11-02-2004 12:57
autonomous mode problem on field Chris_C Programming 17 26-03-2003 19:11
Autonomous Kill Switch UCGL_Guy Programming 8 15-01-2003 17:39


All times are GMT -5. The time now is 09:03.

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