... | ... | @@ -28,7 +28,7 @@ |
|
|
>
|
|
|
> ![1](http://gitlab.au.dk/uploads/group-22/lego/974492fb01/2.jpg)
|
|
|
>
|
|
|
>#### Result
|
|
|
>#### Results
|
|
|
> We decided to test the light sensor under different settings. First we tested how it reads black and white values at different surfaces (plastic and paper) and under different light settings (dark and bright). As further investigation we tested how the sensor is able to detect dark green and light green. The findings from the light sensor tests are presented in the table below:
|
|
|
>
|
|
|
> | Black reading | White reading | Black White Difference | Black White Threshold| Dark Green reading | Light Green Reading | Green Difference| Green Threshold |
|
... | ... | @@ -56,8 +56,10 @@ |
|
|
>#### Task
|
|
|
>Try the LineFollowrCal.java. The program uses the simple class Car.java to move the car.
|
|
|
>
|
|
|
>#### Plan
|
|
|
>
|
|
|
>#### Result!
|
|
|
>
|
|
|
>#### Results
|
|
|
>After running the LineFollowerCal.java we observed that it runs fine along a black line but as soon it encounters a different color eg. green or grey it starts spinning uncontrollably. This is partly due to the program only distinguishing between black and non-black colors. This means that whenever the robot encounters a color different from black it will diverse from its course. From this point it might not detect black colors even though it drives over a black line due to its sample interval of 10ms. This interval makes the robot detect colors once every 10ms and all other time it is blind to it's surrounding meaning that we cannot be sure that i makes a reading as it drives over black.
|
|
|
>
|
|
|
>---
|
... | ... | @@ -68,15 +70,17 @@ |
|
|
>#### Task
|
|
|
>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.
|
|
|
>
|
|
|
>#### Plan
|
|
|
>
|
|
|
>
|
|
|
>We implemented a third possibility in the BlackWhiteSensor class, which is green (ref?). The program is still using the light sensor to determine the values of light from the table. With the corrections to the code, we had the possibility to sample black, white and green.
|
|
|
>In Lab session 1 (ref?) we used the light sensor to figure out the values of different colors - Green had a value between black and white. We used these findings to determine that we needed two new thresholds in the code. To distinguish between the three different colors we changed the thresholds in the code between white & green and black & green. The white’s values are the highest and the black are the lowest, so in order to determine green, we know that it has to be between black and white. By calibrating the colors before the cars starts running it is possible to find the median between the colors to create a threshold which leaves room for some error. We also rewrote some of the code to give us the raw values of the lightsensor, as the results between black and green were pretty close when using the readValue() method, this left us with a bit more precise readings and a slightly larger error margin.
|
|
|
|
|
|
>#### Result!
|
|
|
>#### Results
|
|
|
|
|
|
>During the initial testing, we found that the program would work as intended with the robot driving right when the light sensor read a low (dark) value and left when the light sensor read a high (light) value. The problem occurred when the light sensor settled on the border between the black line and the white space around it within a few seconds. This meant that the reading it got was a median value between the high and low color thresholds. The resulting combined value was too similar to the light value for the color green. This meant that the robot saw this value as green in the code and stopped as was intended when it read a similar light value for the real color green.
|
|
|
> ![3](http://gitlab.au.dk/uploads/group-22/lego/a4841d7341/3.png)
|
|
|
|
|
|
>
|
|
|
>From this exercise we can conclude that the light sensor is not very useful for navigating based on following specific lines of specific colors, as the way that the light sensor works
|
|
|
>
|
|
|
>---
|
... | ... | |