Class RCXIntersectionChooser

java.lang.Object
  extended by JavaRCX
      extended by RCXIntersectionChooser

public class RCXIntersectionChooser
extends JavaRCX

RCXIntersectionChooser.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 index
           
static int SPOKE
          Which spoke to take when getting to an intersection.
static int[] spokes
           
 
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
RCXIntersectionChooser()
           
 
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 move(int[] directions)
          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 int SPOKE
Which spoke to take when getting to an intersection.
 Change only this variable to take different spokes.


spokes

public static int[] spokes

index

public static int index
Constructor Detail

RCXIntersectionChooser

public RCXIntersectionChooser()
Method Detail

move

public static void move(int[] directions)
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:
directions - an int[] value - takes in an array of spokes to take at each intersection so that it can reach the goal node

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.