public class Robot extends Object
NxtOperation
,
NxtCommand
Modifier and Type | Class and Description |
---|---|
protected static class |
Robot.Arm
Represents the motor responsible for holding and flipping the cube
|
protected static class |
Robot.ColorDetector
Represents the color detector unit, both motor and sensor
|
protected static class |
Robot.ProximitySensor
This class represents the proximity sensor unit
|
protected static class |
Robot.Tray
Represents the motor which controls the cube tray
|
Constructor and Description |
---|
Robot() |
Modifier and Type | Method and Description |
---|---|
(package private) static void |
delayMillisec(int delay)
Delay wrapper
|
static void |
finishSolve()
Show off routine, called once the cube is solved
|
static void |
flipCube(FlipMethod method)
Flip the cube
|
static int[] |
getCalibratedWhiteRgb()
Get the calibrated white threshold
|
static void |
init()
Initialize robot (open connection to NXT, load calibration
data from previous calibrations and reset motors location)
|
private static void |
reset()
Reset motors location
|
static void |
rotateCube(Direction direction)
Rotate entire cube
|
static void |
scanFace(ArrayList<RawColor> allColors,
Orientation orientation)
Scan cube's face
|
static void |
setTrayDefaultSpeed()
Set robot's tray to default speed
|
static void |
setTrayScanSpeed()
Set robot's tray to scanning speed
|
static void |
turnFace(Direction direction)
Rotate the face currently facing down
|
static void |
waitForCube()
Wait for cube to be placed on the tray
|
private static final int SHOW_OFF_TIME_MS
private static final int ARM_MOTOR_DEFAULT_SPEED
private static final int ARM_POSITION_HOLD
private static final int ARM_POSITION_HOLD_EXTRA
private static final int ARM_POSITION_TACKLE
private static final int ARM_POSITION_REST
private static final int ARM_FLIP_DELAY_MS
private static final int SENSOR_MOTOR_SPEED
protected static final int SENSOR_LIGHT_THRESHOLD
private static final int TRAY_MOTOR_ROTATION_FACTOR
private static final int TRAY_MOTOR_DEFAULT_SPEED
private static final int TRAY_MOTOR_EXTRA_ROTATION
private static final int TRAY_MOTOR_SCAN_SPEED
protected static final int SENSOR_NUMBER_OF_SAMPLES
private static final int SENSOR_CENTER_DEFAULT_DEGREE
private static final int SENSOR_OUTER_ALLIGN_DEFAULT_DEGREE
private static final int SENSOR_OUTER_CORNER_DEFAULT_DEGREE
private static final int TRAY_SCAN_STEP_DEGREE
private static final int PROXIMITY_SENSOR_THRESHOLD
private static final int PROXIMITY_SENSOR_ERROR
private static final int[][] COORDINATE_SCAN_ORDER
private static final int[] DEFAULT_WHITE_CALIBRATION
protected static final String CALIBRATION_FILE_COLOR_SENSOR
protected static final String CALIBRATION_FILE_COLOR_MOTOR
public static void init()
private static void reset()
static void delayMillisec(int delay)
delay
- Delay time in millisecpublic static int[] getCalibratedWhiteRgb()
public static void setTrayScanSpeed()
public static void setTrayDefaultSpeed()
public static void scanFace(ArrayList<RawColor> allColors, Orientation orientation)
allColors
- List of all scanned colorsorientation
- Current cube orientationOrientation
public static void flipCube(FlipMethod method)
method
- Flip methodFlipMethod
public static void turnFace(Direction direction)
direction
- Turning directionDirection
public static void rotateCube(Direction direction)
direction
- Rotate directionDirection
public static void waitForCube()
public static void finishSolve()