View Single Post
  #10   Spotlight this post!  
Unread 31-03-2004, 00:48
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: Despite what IFI says, you can configure autonomous from OI...

Here's how we "saved" the data for switching between autonomous programs this year (its all on the OI, left/right as well as three switches for programs).

First, we set up a new structure to hold all previous data. This is unbelievably useful for many functions on the robot, including switching relays with triggers. All the rxdata is stored in that new structure right before Getdata is called.

In ifi_aliases.h, we #define'd the input bits coming in to something a little more readable, in this case, autoProgSide, autoProgBit0, autoProgBit1, autoProgBit2.

Now, you need to put those data bits into a number you can read, and you need to use the previous ones. When autonomous mode is enabled all the data coming in is set to neutral, so you need the previous values to have useful information. Put them together using bitwise Or and the shifter function, and save the input regarding the side you're on in some manner:

autoProg = prevautoProgBit0 | (prevautoProgBit1 << 1) | (prevautoProgBit2 << 2);
autoSide = prevautoProgSide;

Now you've got a side and and program number that you can use a switch statement on in your autonomous code.

To Ken: the inputs do indeed all go to neutral.
__________________
~Alex Baxter
Programming, Arms operation, Team 254