public class CubeScanner
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private MeanFilter |
meanRGB
Filter that fetches mean RGB-value.
|
private SampleProvider |
rawRGB
SampleProvider that fetches raw RBG-values.
|
private int |
SAMPLES
Number of samples that are taken per element.
|
private MotorController |
scannerMotors
MotorController object to control motors during scanning process.
|
Constructor and Description |
---|
CubeScanner(MotorController motors)
Constructor initializes used variables.
|
Modifier and Type | Method and Description |
---|---|
private ColorsEnum |
convertToColorsEnum(float[] sample)
Identifies color of one element by analyzing its RGB-values.
|
protected void |
scanCube(RubiksCube cube)
Scans complete cube by using scanTopFace()-method and writes recognized colors as well as raw values to RubiksCube object.
|
private ColorsEnum[] |
scanTopFace()
Rotates cube while scanning its elements on top face.
|
private void |
toDisplay(float[][] sample)
Prints given sample-array of mean values to EV3-display.
|
private void |
toFile(java.lang.String fileName,
RubiksCube cube)
Writes raw RGB-values and mean RGB-value to file (used for debugging).
|
private MotorController scannerMotors
private SampleProvider rawRGB
private MeanFilter meanRGB
private final int SAMPLES
CubeScanner(MotorController motors)
motors
- MotorController object to control motors during scanning processprivate void toFile(java.lang.String fileName, RubiksCube cube)
fileName
- Name of the file that values are written to.cube
- RubiksCube object where values are taken from.private void toDisplay(float[][] sample)
sample
- sample-array of mean values.private ColorsEnum convertToColorsEnum(float[] sample)
sample
- RGB-valuesprivate ColorsEnum[] scanTopFace()
protected void scanCube(RubiksCube cube)
cube
- RubiksCube object to write colors to.