LegoAgent-Eve
|
Klasse feur die Scan-Funktion des Roboters Alle Interaktion mit der Hardware (außer Display) findet in dieser Klasse statt Motoren werden angesprochen und Sensoren ausgelesen Von Außen wird die Methode scanNewDataPoint angesprochen, welche einen Datenpunkt mit den benoetigten Merkmalen, aber unbestimmten Figur-Typ zurueckliefert. More...
Public Member Functions | |
Scanner () | |
IDataPoint | scanNewDataPoint () |
scan whole image and calculate the characteristics of the objects More... | |
Static Public Attributes | |
static final int | resolution = 4 |
static final int | yMax = 900 |
static final int | xSpeed = 200 |
static final int | xAcceleration = 200 |
static final int | ySpeed = 500 |
static final int | yAcceleration = 500 |
static final int | minYAngle = 18 |
static final int | minXAngle = 3 |
static final int | startYDir = -1 |
static final int | startXDir = -1 |
static final int | sensorSamples = 5 |
static final double | rgbThreshold = 0.08 |
Private Member Functions | |
int[][] | readImage () |
scan the whole picture. More... | |
int | getPixelColor () |
read in sensor value and filter it More... | |
int | getYIndex (int i) |
calculates the y Index for the image buffer Depending on the direction the index must be calculated different because of the meander shape of scanning More... | |
void | turnXMotor (int xAnglePerPixel) |
turn the XMotor about given angle More... | |
void | turnYMotor (int yAnglePerPixel) |
turn the YMotor about given angle More... | |
void | returnToHome (int xAnglePerPixel, int yAnglePerPixel) |
return to the origin position after scanning image More... | |
void | invertDirection () |
invert the direction flag 1 means rotate clockwise -1 means rotate counter-clockwise More... | |
String | debugImage (int[][] Image) |
print Image as String as Debug String More... | |
void | printImageOnLCD (int[][] image) |
prints Image on LCD display scale image to fit to the screen More... | |
IDataPoint | calculateCharacteristics (int[][] image) |
calculate the characteristics perimeter (sqared) and area of a given image More... | |
Private Attributes | |
int | pixel |
int | dir |
RegulatedMotor | XMotor |
RegulatedMotor | YMotor |
EV3ColorSensor | Sensor |
SampleProvider | RgbSample |
SampleProvider | RgbFilter |
Klasse feur die Scan-Funktion des Roboters Alle Interaktion mit der Hardware (außer Display) findet in dieser Klasse statt Motoren werden angesprochen und Sensoren ausgelesen Von Außen wird die Methode scanNewDataPoint angesprochen, welche einen Datenpunkt mit den benoetigten Merkmalen, aber unbestimmten Figur-Typ zurueckliefert.
Scanner | ( | ) |
References Scanner.startYDir.
|
private |
calculate the characteristics perimeter (sqared) and area of a given image
image | int buffer of the image |
References Logger.log(), and Scanner.pixel.
Referenced by Scanner.scanNewDataPoint().
|
private |
print Image as String as Debug String
References Scanner.pixel.
Referenced by Scanner.readImage().
|
private |
read in sensor value and filter it
References Logger.log(), and Scanner.sensorSamples.
Referenced by Scanner.readImage().
|
private |
calculates the y Index for the image buffer Depending on the direction the index must be calculated different because of the meander shape of scanning
i | current position y Motor |
Referenced by Scanner.readImage().
|
private |
invert the direction flag 1 means rotate clockwise -1 means rotate counter-clockwise
Referenced by Scanner.readImage().
|
private |
prints Image on LCD display scale image to fit to the screen
References Scanner.pixel.
Referenced by Scanner.readImage().
|
private |
scan the whole picture.
This is done in a meander shape. See the following illustration (s is a scan, -> symbolize movement): s->s->s->s \/ s<-s<-s<-s \/ s->s->s->s \/ s<-s<-s<-s
This shows that for the reading of a line are one scan more is necessary than movements.
References Scanner.debugImage(), Scanner.getPixelColor(), Scanner.getYIndex(), Scanner.invertDirection(), Logger.log(), Scanner.pixel, Scanner.printImageOnLCD(), Scanner.resolution, Scanner.returnToHome(), Scanner.turnXMotor(), and Scanner.turnYMotor().
Referenced by Scanner.scanNewDataPoint().
|
private |
return to the origin position after scanning image
References Scanner.startYDir.
Referenced by Scanner.readImage().
IDataPoint scanNewDataPoint | ( | ) |
scan whole image and calculate the characteristics of the objects
Implements IScanner.
References Scanner.calculateCharacteristics(), and Scanner.readImage().
|
private |
turn the XMotor about given angle
xAnglePerPixel | angle to rotate |
References Logger.log().
Referenced by Scanner.readImage().
|
private |
turn the YMotor about given angle
yAnglePerPixel | angle to rotate |
References Logger.log().
Referenced by Scanner.readImage().
|
private |
|
static |
|
static |
|
private |
Referenced by Scanner.calculateCharacteristics(), Scanner.debugImage(), Scanner.printImageOnLCD(), and Scanner.readImage().
|
static |
Referenced by Scanner.readImage().
|
private |
|
private |
|
static |
|
private |
|
static |
Referenced by Scanner.getPixelColor().
|
static |
|
static |
Referenced by Scanner.returnToHome(), and Scanner.Scanner().
|
static |
|
private |
|
static |
|
static |
|
static |
|
private |
|
static |