... | @@ -90,8 +90,12 @@ |
... | @@ -90,8 +90,12 @@ |
|
>## Exercise 4: Line Follower that stops in a Goal Zone
|
|
>## Exercise 4: Line Follower that stops in a Goal Zone
|
|
>
|
|
>
|
|
>
|
|
>
|
|
>#### Task
|
|
> #### Task
|
|
>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.
|
|
|
|
>
|
|
|
|
> #### Plan
|
|
|
|
> We now intended to use the colour thresholds made in exercise to distinguish between black,
|
|
|
|
> white and green.
|
|
>
|
|
>
|
|
> Code snippet from ThreeColorSensor class:
|
|
> Code snippet from ThreeColorSensor class:
|
|
> ```
|
|
> ```
|
... | @@ -115,7 +119,9 @@ |
... | @@ -115,7 +119,9 @@ |
|
>
|
|
>
|
|
>
|
|
>
|
|
>#### Results
|
|
>#### Results
|
|
>As can be seen in the video (Fig. 1), the ThreeColorSensor program makes the robot follow the black line oscillating in small turns between the black and the white areas until it enters the green area. >The movement is not very smooth however,
|
|
>As can be seen in the video (Fig. 1), the ThreeColorSensor program makes the robot follow the black line oscillating in small turns between the black and the white areas until it enters the green area. >The movement is not very smooth however, and only the sensor of the robot enters the green area and then the robot stops.
|
|
|
|
>Our issue was that our code could not distinguish between the light sensor reading half black and half white, and the colour green. This was the same issue as we encountered in exercise 3. >We therefore still ran the risk of halting at the edge of a black line instead of going into the green zone and stopping.
|
|
|
|
>We implemented a simple integer that was increased by one when the threshold was between the thresholds determined as “green”. Unfortunately we now got the problem that the light sensor would internet the edge of the black/white line as the light value for green. This means that it will drive off from the line at an angle, instead of following it like it should. We still need to find a better way of distinguishing between white/black and green with the light sensor, but we are not sure that such a thing is possible without a more advanced colour sensor.
|
|
>
|
|
>
|
|
>---
|
|
>---
|
|
>
|
|
>
|
... | | ... | |