... | @@ -54,13 +54,8 @@ After taking this approach, the robot ran as expected and followed the line. The |
... | @@ -54,13 +54,8 @@ After taking this approach, the robot ran as expected and followed the line. The |
|
Use the idea and structure of the BlackWhiteSensor to program a class ThreeColorSensor that can detect three colors: black, green and white. Make a test program that investigate the usefulness of the class.
|
|
Use the idea and structure of the BlackWhiteSensor to program a class ThreeColorSensor that can detect three colors: black, green and white. Make a test program that investigate the usefulness of the class.
|
|
|
|
|
|
#### Execution ####
|
|
#### Execution ####
|
|
3)
|
|
|
|
- Grøn har en værdi meget tæt på sort (37)
|
|
|
|
- Programmerede programmet ved at tilføje nye thresholds så de stemte overens med grøn. Vi erstattede sort hvid med sort-grøn + grøn-hvid idet vi antager at sort<grøn<hvid. I disse lysforhold stemmer dette overens, men der kan være tilfælde hvor denne antagelse ikke stemmer overens. I så fald kan man tilføje yderligere et threshold black-white.
|
|
|
|
- Vi udnytter thresholds ved at bruge < og > til at sammenligne over thresholds (mindre end black-green -> black, mindre end green-white -> grøn, større end green-white -> hvid)
|
|
|
|
- Da det er Integers rundes der altid ned. Der er altså en tendens til at favorisere mørke værdier. Vi kunne anvende raw values i stedet. I så fald ville vi have 1023 værdier at gå ud fra, og ville derfor kunne bedømme edge cases bedre.
|
|
|
|
|
|
|
|
We extended the behaviour of *BlackWhiteSensor.java* to calibrate for green as well as the black and white. In this application, thresholds between black-green and green-white were used instead of black-white. This happened under assumption that any color would always have a value between absolute white and absolute black, meaning that ambient light would have no difference. The extended application then defines green as any value between the two thresholds (non-inclusive) and uses this to classify colours. This behaviour worked in our current environment, but given different ambient light, the read values might be lower, minimising differences between thresholds.
|
|
We extended the behaviour of *BlackWhiteSensor.java* to calibrate for green as well as the black and white. In this application, thresholds between black-green and green-white were used instead of black-white. This happened under assumption that any color would always have a value between absolute white and absolute black, meaning that ambient light would have no difference. The extended application then defines green as any value between the two thresholds (non-inclusive) and uses this to classify colors. This behaviour worked in our current environment, but given different ambient light, the read values might be lower, minimising differences between thresholds.
|
|
|
|
|
|
We installed the program on the robot and started classifying black, white and green. The green color was dark green and was thus very close to black for the light sensor.
|
|
We installed the program on the robot and started classifying black, white and green. The green color was dark green and was thus very close to black for the light sensor.
|
|
|
|
|
... | @@ -69,18 +64,23 @@ We installed the program on the robot and started classifying black, white and g |
... | @@ -69,18 +64,23 @@ We installed the program on the robot and started classifying black, white and g |
|
51% | 33% | 37%
|
|
51% | 33% | 37%
|
|
|
|
|
|
A final observation is that the light value class uses percentages to define the amount of light<<<<<indsæt ref!!!!>>>>>>. This value is returned as an integer, which means that any value will be rounded down.
|
|
A final observation is that the light value class uses percentages to define the amount of light<<<<<indsæt ref!!!!>>>>>>. This value is returned as an integer, which means that any value will be rounded down.
|
|
As many colours lie in the value space between 30% and 50%, this functionality reduces the effectiveness of classifications. An option would have been to instead use the raw values which percentages are calculated from, as these have values between 0 and 1023<<<<<<REF>>>>>>.
|
|
As many colors lie in the value space between 30% and 50%, this functionality reduces the effectiveness of classifications. An option would have been to instead use the raw values which percentages are calculated from, as these have values between 0 and 1023<<<<<<REF>>>>>>.
|
|
|
|
|
|
The extended application can be seen <<<<<<indsæt ref til kode FOR BEGGE FILER, eller indsæt kode>>>>>>.
|
|
The extended application can be seen <<<<<<indsæt ref til kode FOR BEGGE FILER, eller indsæt kode>>>>>>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Line Follower that stops in a Goal Zone ###
|
|
### Line Follower that stops in a Goal Zone ###
|
|
|
|
|
|
#### Description ####
|
|
#### Description ####
|
|
Use the ThreeColorSensor to make a line follower that stops in a green goal zone.
|
|
Use the ThreeColorSensor to make a line follower that stops in a green goal zone.
|
|
|
|
|
|
#### Execution ####
|
|
#### Execution ####
|
|
|
|
This exercise combines the previous two exercises to both follow a black line on white background and register the color green as an event causing the robot to stop.
|
|
|
|
|
|
|
|
|
|
|
|
##### Creating the track #####
|
|
|
|
We started off by finding a circular track with a black line on white background. On this track, we placed a light green post it note to indicate the goal zone. An interesting observation here is that the light green color is different to the dark green color which was used in previous exercises. This causes the sensor to make different readings.
|
|
|
|
|
|
|
|
|
|
### PID Line Follower ###
|
|
### PID Line Follower ###
|
|
|
|
|
... | | ... | |