... | ... | @@ -77,16 +77,35 @@ Use the ThreeColorSensor to make a line follower that stops in a green goal zone |
|
|
#### 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.
|
|
|
|
|
|
##### Programming the application #####
|
|
|
We need to program an application which follows a black line on white background on stops immediately when seeing green. We built this application simply by combining the *ThreeColorSensor.java* <<<<ref>>>> class from the previous exercise with the *LineFollowerCal.java* <<<<ref>>>> class. We also added behaviour to stop the robot on button press. The final application can be seen in <<<<ref>>>>.
|
|
|
|
|
|
##### 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 register different readings.
|
|
|

|
|
|
|
|
|
##### Changing the sensor height #####
|
|
|
We made some readings with this light green color and found the results seen in table <<<table ref >>>>>.
|
|
|
|
|
|
**White** | **Black** | **Dark green** | **Light green**
|
|
|
--- | --- | --- | ---
|
|
|
51% | 33% | 37% | 40%
|
|
|
47% | 31% | 37% | 40%
|
|
|
|
|
|
Using these readings as calibration, we tried to run our application. This caused the robot to immediately stop on the white/black line without seeing green. We edited our application a bit to still show the read light value after stopping the robot. This revealed to us that the light value registered on the black/white line is around 41%, which is close to the middle of the zone where the application classifies the color as green.
|
|
|
|
|
|
To fix this issue, we tried different heights for the light sensor, choosing the exact height in which we reached a maximum light value for white background. The new build can be seen in <<<ref til billede herunder>>>.
|
|
|

|
|
|
|
|
|
By lowering the sensor to a height of a few millimeters, the sensor showed the values in table <<<ref til tabel>>>.
|
|
|
|
|
|
**White** | **Black** | **Dark green** | **Light green**
|
|
|
--- | --- | --- | ---
|
|
|
52% | 31% | 40% | 45%
|
|
|
|
|
|
We immediately tried the application again with these values, and managed to have the robot follow the black line closely and stop its movement when sensing green.
|
|
|
|
|
|
A final observation relating to this application is that the robot stopped immediately when reading green, even though it should have waited about 1.5 seconds before doing so, as this corresponded to the amount of samples we needed to verify the green color given the sampling frequency.
|
|
|
|
|
|
### PID Line Follower ###
|
|
|
|
|
|
#### Description ####
|
... | ... | |