Quote:
Originally Posted by Mark McLeod
Your autonomous code should also execute in a slow loop. It doesn't help to execute faster than you can deliver instructions to the pwms.
|
At first, I thought that auton WAS a fast loop, but I looked at main() and now see otherwise. This brings up a few questions in my mind. Why is auton a slow loop? I had heard (but not tested) that the values we get from the OI are invalid during auton and to disregard them entirely. Is it that the master processor will only let me getdata and putdata every 26.2ms? Do PWMs update faster if I getdata and putdata every loop instead of only when NEW_SPI_DATA is 1? What will getdata do if there is no new data to get? Also, suppose I have a PID loop. It needs to execute fast (or so the whitepaper says). So I put it in local IO. It changes PWM values in between 26.2ms loops. Are the victors actually getting the updated values in between loops, or are they updated every 26.2ms? And are my sensor reads actually updating in between 26.2ms loops, or are they the same every loop? Sorry about all the questions...I don't really understand the architecture of the rc.
Quote:
Originally Posted by Mark McLeod
If you check the IFI default code you'll see the autonomous section in user_routines_fast.c is really a slow loop by virtue of the line:
Code:
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
You just need to add your camera calls within that slow loop.
I'd advise you to pull all your autonomous code out of the user_routines_fast.c file anyway. The name of that file only confuses the issue and your freshmen programmers, since it's not true for the autonomous code.
|
Wow, my basic assumption (based on the comments in the code...) was wrong.
Quote:
|
Originally Posted by user_routines_fast.c
* FUNCTION NAME: User_Autonomous_Code
* PURPOSE: Execute user's code during autonomous robot operation.
* You should modify this routine by adding code which you wish to run in
* autonomous mode. It will be executed every program loop, and not
* wait for or use any data from the Operator Interface.
|
So that comment is downright wrong? Sure looks like it by the looks of main()...I might shoot off an email to IFI just to let them know.
JBot