View Single Post
  #3   Spotlight this post!  
Unread 19-01-2011, 01:50
Dfontana Dfontana is offline
Registered User
AKA: David Fontana
FRC #3039 (Wildcat Robotics, Team Predator)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Destrehan, LA
Posts: 9
Dfontana is an unknown quantity at this point
Re: LabVIEW Autonomous Cases

Quote:
Originally Posted by Wolfgang View Post
Can anybody give me an explanation of all the cases in the LabVIEW autonomous code. Thanks!
This is all from memory. I just took a look inside the autonomous VI today.

Description from left to right:

Starting out, you should see a DriverStation-GetDigital VI or something of the sort. This basically fetches and returns the status of all digital inputs hooked to the driver station (switches, most likely.. possibly buttons). This is then compiled into a boolean array and converted into a numeric byte.

The example provides for two switches. Essentially you are counting in binary.

Switch 1 | Switch 2 | Byte Value
OFF | OFF | 0
OFF | ON | 1
ON | OFF | 2
ON | ON | 3

This numeric byte is then used as an index selector for the enumeration array (located just above, I believe). The resulting enumeration selects one of the following cases: LEFT, STRAIGHT, or RIGHT.

LEFT will follow the left branch of the "Y" formation in the line.
STRAIGHT continues forward (used for starting positions which do not have a "Y")
RIGHT.. self explanatory.


There are three Double-Precision arrays inside the subsequent loop. These have hard-wired inputs on the front panel.

One of these controls the speed of the motors, gradually decreasing as the elapsed time of the autonomous period grows. I think this was done to avoid overshooting.

I honestly cannot remember what the other two are for.

There is another boolean to binary array structure inside this loop which fetches and returns the state of each IR sensor. Again, it counts in binary, returning either a 0, 1, 2, 4, or 7 (If I recall correctly).

This number is then attached to a case structure inside the loop which has a shift-register attached. This basically keeps track of what the previous case was, compares it to the new one, and provides the appropriate action to take in each instance.

For example, if the previous case represented the robot being completely on the line, but the new one represents the robot veering to the left of it, the code provides appropriate motor inputs to correct this.

The conditions represented by each numerical case are listed in the VI as comments.


I believe that's the jist of it. Again, this is purely from memory, so don't crucify me if anything is missing or incorrect.
__________________
FIRST Team 3039 - Wildcat Robotics, Team Predator - Destrehan, LA.