... | ... | @@ -261,21 +261,26 @@ Is it possible to use the color sensor for both following the black line and sto |
|
|
|
|
|
#### Execution ####
|
|
|
|
|
|
|
|
|
<img src="https://gitlab.au.dk/martinwp/LegoGroup2/raw/develop/lesson-04/images/blackread.jpg" alt="Figure 5" width="300px" />
|
|
|
*Figure 5: Color Sensor reading 'Green' as seen on the display, eventhough it is actually placed above a black square*
|
|
|
|
|
|
We started out by looking at the code *ColorSensorSensor.java* which was provided, to get an idea of what the program was meant to do. After transfering the program to the NXT, we tested it out on white, black and four different colors. The results from each of the six can be seen in table 5.
|
|
|
|
|
|
**Actual Color** | **Detected Color** | **Red (Raw)** | **Red (Cal)** | **Green (Raw)** | **Green (Cal)** | **Blue (Raw)** | **Blue (Cal)** | **Light (Raw)** | **Light (Cal)**
|
|
|
---------- | --------- | ----------| --------- | ----------| --------- | ----------| --------- | ----------| ---------
|
|
|
White | White | 668 | 227 | 619 | 233 | 587| 288 | 625 | 277
|
|
|
Black | Green | 246 | 60 | 227 | 64 | 176 | 63 | 210 | 73
|
|
|
Black | *Green* | 246 | 60 | 227 | 64 | 176 | 63 | 210 | 73
|
|
|
Blue | Blue | 291 | 97 | 401 | 120 | 454 | 204 | 282 | 155
|
|
|
Green | Green | 360 | 130 | 494 | 222 | 286 | 108 | 329 | 164
|
|
|
Red | Red | 658 | 257 | 310 | 102 | 246 | 60 | 482 | 144
|
|
|
Yellow | Yellow | 670 | 266 | 550 | 234 | 325 | 105 | 512 | 208
|
|
|
*Table 5 : Readings from the display while testing ColorSensorSensor.java on 6 different colors*
|
|
|
*Table 5 : Readings from the display while testing ColorSensorSensor.java on white, black and four different colors*
|
|
|
|
|
|
A strange thing to note is that when we tested the sensor above a black square, the program returned 'Green' as a result. This can be seen on figure 5.
|
|
|
|
|
|
<img src="https://gitlab.au.dk/martinwp/LegoGroup2/raw/develop/lesson-04/images/blackread.jpg" alt="Figure 5" width="200px" />
|
|
|
*Figure 5: Color Sensor reading 'Green' as seen on the display, eventhough it is actually placed above a black square*
|
|
|
|
|
|
We are not quite sure why the program returns 'Green' instead of 'Black'. If we look at the values from the black test (second row), we can see that most of the values are lower than the other color tests. Especially the values for 'Light' are very low compared to the others. Therefore it should be possible to distinguish between black and other colors.
|
|
|
|
|
|
Based on the wrong return value we got from the black reading, it would not be possible to use the color sensor for following the black line and stopping in the goal zone, if it depends upon the *ColorSensorSensor.java* program. But as argued above, the values from the sensor are
|
|
|
|
|
|
|
|
|
|
... | ... | |