|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||||
|
|||||
|
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 |
|
#2
|
|||
|
|||
|
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)
Any chance your code is taking too long?
|
|
#3
|
||||
|
||||
|
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
|
||||
|
||||
|
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...
|
|
#5
|
||||
|
||||
|
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. |
|
#6
|
|||
|
|||
|
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
|
|||||
|
|||||
|
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)
Quote:
Quote:
Quote:
Quote:
Code:
void
dummyPrintf( char *s, ... ) // note the var arg "..."
{
return;
}
// and later:
#define printf dummyPrintf
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 |
|
#8
|
||||
|
||||
|
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)
Quote:
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 |
|
#9
|
||||
|
||||
|
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
|
||||
|
||||
|
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)
Quote:
![]() |
|
#11
|
||||
|
||||
|
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
|
||||
|
||||
|
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)
Quote:
.Quote:
-Kevin |
|
#13
|
|||
|
|||
|
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)
Quote:
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
|
||||
|
||||
|
Re: Sometimes autonomous cycles at half rate (19 Hz instead of 38 Hz)
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |