... | ... | @@ -73,8 +73,8 @@ |
|
|
>#### Plan
|
|
|
>
|
|
|
>
|
|
|
>We implemented a third possibility in the BlackWhiteSensor class, which is green [1]. 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.
|
|
|
>We implemented a third possibility in the BlackWhiteSensor class, which is green. 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 [1] 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.
|
|
|
|
... | ... | @@ -108,14 +108,14 @@ |
|
|
> else return false;
|
|
|
> }
|
|
|
> ```
|
|
|
> ##### Fig. ??: Insert some explanation of the code here!
|
|
|
>
|
|
|
>
|
|
|
>[![image alt text](http://img.youtube.com/vi/aU9JqzJGzx0/0.jpg)](http://www.youtube.com/watch?v=aU9JqzJGzx0)
|
|
|
> ##### Fig. ??: Here, we are about to write what happens in the movie.
|
|
|
> ##### Fig. 1: The robot follows the line and stops just short of the green zone.
|
|
|
>
|
|
|
>
|
|
|
>#### Results
|
|
|
>As can be seen in the video (??), the ThreeColorSensor program makes the robot follow the black line oscillating in small turns between the black and the white areas untill 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,
|
|
|
>
|
|
|
>---
|
|
|
>
|
... | ... | @@ -123,7 +123,7 @@ |
|
|
>
|
|
|
>#### Task
|
|
|
>
|
|
|
>Implement the PID controller as described in [ref].
|
|
|
>Implement the PID controller as described in [2].
|
|
|
>
|
|
|
>#### Plan
|
|
|
>
|
... | ... | @@ -223,7 +223,13 @@ |
|
|
>This method is not 100 % accurate and some colors close to green may also result in a green interpretation, but it >should still be able to distinguish the three colors apart.
|
|
|
>
|
|
|
> ## Conclusion
|
|
|
>
|
|
|
> Through this lab session we gained experience using a light sensor for black white detection. Readings were collected in different rooms with different light settings and results showed that we were able to distinguish black from white under various light settings.
|
|
|
|
|
|
To extend our work with the light sensor we mounted the color sensor with a goal to distinguish between three colors (black, white and green). When implementing a line follower we encountered some problems with the three color distinction as the car robot’s navigation relies on input from the color sensor. When it detects white it moves in one direction and another when it detects green. The problem occurs when the sensor is between the black and white line. This causes the sensor to read medium values eg. green even though no green space is present.
|
|
|
|
|
|
The three color sensing robot was later modified according to the problem. To deal with the problem of medium values we made the robot count how many green readings were made before it detects it as a goal zone. This means that the robot will only stop when it reads a certain amount of consecutive green values.
|
|
|
|
|
|
Later we implemented a PID control structure on the car resulting in the car driving in a smooth path. Due to lack of time we did not have adequate time to explore and tweak the values of the PID. This means that the PID controlled line follower was not completed to full extend.
|
|
|
>
|
|
|
> ## References
|
|
|
>
|
... | ... | @@ -238,4 +244,5 @@ |
|
|
> Links:
|
|
|
>
|
|
|
> [1] https://gitlab.au.dk/group-22/lego/wikis/home - exercise 1 & 2, table 1
|
|
|
> [?] http://www.inpharmix.com/jps/PID_Controller_For_Lego_Mindstorms_Robots.html |
|
|
\ No newline at end of file |
|
|
>
|
|
|
> [2] http://www.inpharmix.com/jps/PID_Controller_For_Lego_Mindstorms_Robots.html |
|
|
\ No newline at end of file |