View Single Post
  #1   Spotlight this post!  
Unread 27-03-2005, 11:45
dm0ney's Avatar
dm0ney dm0ney is offline
Will Code For Food (Food Optional)
AKA: Deepak Mishra
None #0217 (The ThunderChickens)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Shelby Twp., MI
Posts: 48
dm0ney will become famous soon enough
Send a message via AIM to dm0ney
Re: Setting Autonomous Settings from OI

We use a selector switch on the OI to choose from 8 different modes (2^3).

Because the OI button states arent gotten until AFTER the initialization, we could not populate our autonomous queueing system with different modes.

I solved that problem by going into main.c (the file you should never have to touch) and after the Process_Data_From_Master_uP(); call, inserting this code below:

Code:
...
Process_Data_From_Master_uP(); /* You edit this in user_routines.c */

if(flag)
{
//printf("AUTO FLAG");
tcr_autonomous_fill_queue();
flag = 0;
}

if(autonomous_mode)
{
...
The variable flag is an int that is declared and initialized to 1 at the start.
The flag = 0; means it will only run once.

I believe the same code could be inserted into Process_Data_From_Master_uP however, I did not try it and cannot verify that it works.

The best implementation of that in my mind would be to have a function called in that if statement that reads which mode it is from OI buttons and stores it into memory. Extern that variable over to user_routines_fast and use it with your current code. A switch statement or if statements?

Our autonomous code is a scripting / queue style so the only thing that ever changes is the list of commands in the queue as governed by tcr_autonomous_fill_queue(), enabling us to never have to touch our user_routines_fast.
__________________

Alumni
Team #217, The ThunderChickens



Student, Class of 2009
California Institute of Technology



Last edited by dm0ney : 27-03-2005 at 11:49.