|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJavaRCX
public class JavaRCX
JavaRCX.java Contains basic methods and variables common to all robot objectives.
Field Summary | |
---|---|
static int |
ALL
All sensors dark. |
static int |
CENTER_ONLY
Center sensor dark. |
static int |
CENTER_RIGHT
Center and right sensors dark. |
static int |
DARK
The level at which readings are considered black by the light sensor (<=DARK) |
static int |
L_ROTATION
Counter variable used to estimate how far the robot should turn left when lost |
static int |
LEFT_CENTER
Left and center sensors dark. |
static int |
LEFT_ONLY
Left sensor dark. |
static int |
LEFT_RIGHT
Left and right sensors dark. |
static int |
NONE
No sensors dark. |
static int |
POWER
Power level of the motors. |
static int |
R_ROTATION
Counter variable used to estimate how far the robot should turn right when lost |
static int |
RIGHT_ONLY
Right sensor dark. |
static int |
state
Which state the sensors of the robot are in - possible values are constants below. |
static LightWatcher |
watcher
A separate background thread that reads values from the light sensors and updates the state variable. |
Constructor Summary | |
---|---|
JavaRCX()
|
Method Summary | |
---|---|
static void |
initialize()
Precondition: State must start at CENTER_ONLY . |
static void |
lost()
When the state NONE occurs this method will scan to the left for L_ROTATION
then scan farther to the right R_ROTATION . |
static void |
powerOff()
Exit program with 5 second delay. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int state
public static LightWatcher watcher
public static final int NONE
public static final int LEFT_ONLY
public static final int CENTER_ONLY
public static final int RIGHT_ONLY
public static final int LEFT_CENTER
public static final int LEFT_RIGHT
public static final int CENTER_RIGHT
public static final int ALL
public static final int DARK
public static final int POWER
Power level of the motors. Try More experimentation with power levels and how much better light sensors are able to read at different speeds of the motor.
public static final int R_ROTATION
public static final int L_ROTATION
Constructor Detail |
---|
public JavaRCX()
Method Detail |
---|
public static void lost()
When the state NONE occurs this method will scan to the left forL_ROTATION
then scan farther to the rightR_ROTATION
. This will ultimately cause the robot to do a 360 unless it hits a black line at some point.
public static void initialize()
Precondition: State must start at CENTER_ONLY
.
Activates the sensors, sets up motor power,starts light sensor thread.
public static void powerOff()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |