... | ... | @@ -60,13 +60,20 @@ Use the idea and structure of the BlackWhiteSensor to program a class ThreeColor |
|
|
- 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 The extended application can be seen in <<<<<<indsæt ref til kode FOR BEGGE FILER, eller indsæt kode>>>>>>.
|
|
|
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.
|
|
|
|
|
|
Having done this, 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.
|
|
|
|
|
|
**White** | **Black** | **Green**
|
|
|
--- | --- | ---
|
|
|
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.
|
|
|
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>>>>>>.
|
|
|
|
|
|
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 ###
|
|
|
|
... | ... | |