Class IntersectionChooser

java.lang.Object
  extended by JavaRCX
      extended by IntersectionChooser

public class IntersectionChooser
extends JavaRCX

IntersectionChooser.java
 Given a spoke number, the robot when determining it is at an intersection
 will turn left, rotate clockwise starting(inclusive)at 12:00 counting spokes and when it 
 hits the nth spoke resume execution of intersection finder.

Since:
1.0

Field Summary
static int SPOKE
          Which spoke to take when getting to an intersection.
 
Fields inherited from class JavaRCX
ALL, CENTER_ONLY, CENTER_RIGHT, DARK, L_ROTATION, LEFT_CENTER, LEFT_ONLY, LEFT_RIGHT, NONE, POWER, R_ROTATION, RIGHT_ONLY, state, watcher
 
Constructor Summary
IntersectionChooser()
           
 
Method Summary
static void chooseSpoke()
          Given the value of SPOKE above and that the robot is at an intersection it will rotate to SPOKE and it thread safe from main, so no new calls to isIntersection() will be fired here.
static boolean isIntersection(int triggerState)
          Determines whether at an intersection or not.
static void main(java.lang.String[] args)
          Runs forever taking appropriate motor actions for each state it is in.
 
Methods inherited from class JavaRCX
initialize, lost, powerOff
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPOKE

public static final int SPOKE
Which spoke to take when getting to an intersection.
 Change only this variable to take different spokes.

See Also:
Constant Field Values
Constructor Detail

IntersectionChooser

public IntersectionChooser()
Method Detail

main

public static void main(java.lang.String[] args)
Runs forever taking appropriate motor actions for each state it is in.
 While loops within some statements attempt to fine tune the robot so it is back on the line in the CENTER_ONLY state.

Parameters:
args - a String[] value, command line arguements, none in this case.

isIntersection

public static boolean isIntersection(int triggerState)
Determines whether at an intersection or not.  This method is thread safe because it is called from within main.
 The watcher thread has no effect on anything here, it only goes back into effect when execution returns to the main.

Parameters:
triggerState - an int value
Returns:
a boolean value

chooseSpoke

public static void chooseSpoke()
Given the value of SPOKE above and that the robot is at an intersection
 it will rotate to SPOKE and it thread safe from main, so no new calls to isIntersection() will be fired here.