... | ... | @@ -135,6 +135,10 @@ The video below shows a demonstration of our PID line follower program[7]. In th |
|
|
[![image alt text](http://img.youtube.com/vi/Qi-XYG67Eiw/0.jpg)](http://www.youtube.com/watch?v=Qi-XYG67Eiw)
|
|
|
##### Video 3: Line Follower with PID controller.
|
|
|
|
|
|
|
|
|
Below you find our implemented code. It is seen that we calibrate the threshold each time the program starts. Our values for the Kp, Ki and Kd are respectively: 2.6, 0.12 and 120. Why tried different values and for that these values worked the best. When increasing and decreasing the values often resulted in oscillation of the robot and weird movement. We tried using the “Tuning A PID Controller Without Complex Math”[2]
|
|
|
|
|
|
|
|
|
```
|
|
|
public class PIDCarController {
|
|
|
private static LightSensor light = new LightSensor(SensorPort.S3);
|
... | ... | @@ -210,6 +214,7 @@ public class PIDCarController { |
|
|
##### CodeSnippet2: The implement code in our PID controlled line follower program.[7]
|
|
|
|
|
|
#### Conclusion
|
|
|
As mentioned the robot in the results, the robot had some troubling following the black line when going from the opposite direction. This could be a result of reflection from the black tape or maybe some problems in the code. However, we going through the code we can’t seem to find where the problems occur. It could also has something to do with P, I and D and the values of these. We tried changing these extensively, but it was hard to reach a middle ground that would solve the problem.
|
|
|
|
|
|
|
|
|
### Exercise 6 - Color Sensor
|
... | ... | @@ -225,10 +230,10 @@ Hereafter we will use these values to make the code for the line follower. Final |
|
|
#### Results
|
|
|
The different values that was shown on the screen on the robot have been set up in a table. Here we both have the raw and the cal values to make sure that we have all the values as possible when writing the code to the line follower. The values of the colors was very different when we tried measuring on different materials. Especially when measuring black, here we saw that when looking on black masking tape (which is the values seen in table 2) and mat black paper, there was a difference in the numbers. We discussed that it could be the masking tape that reflected the light in the sensor, and therefore we tried darken the room to reduce “noise” from the environment.
|
|
|
|
|
|
![Screen Shot 2015-03-10 at 14.25.14](http://gitlab.au.dk/uploads/u4099/legolabtimadala/f16db3e28c/Screen_Shot_2015-03-10_at_14.25.14.png)
|
|
|
![Screen Shot 2015-03-10 at 14.25.14](http://gitlab.au.dk/uploads/u4099/legolabtimadala/0b901d4f6d/Screen_Shot_2015-03-10_at_14.25.14.png)
|
|
|
|
|
|
##### Table 2: Color sensor data
|
|
|
-
|
|
|
|
|
|
|
|
|
We then used the values to make the robot follow a black line and stop when observing a green color. Here we first tried using our homemade lane (made of black masking tape on a mixed color linoleum floor), this was not optimal at all and we could not make the robot follow the line when using the color sensor. We went to use the pre-made robot lane in Zuse, where the lane is made of clear white, black and green. Instantly the robot followed the black line and stopped when reaching the green color on the lane as seen in video below [8]. The code for the program can be found in [9]
|
|
|
|
... | ... | @@ -249,4 +254,5 @@ We have tested if the color sensor can be used to follow a black line and stop w |
|
|
6. [CodeSnippet1: Implemented code for the three color sensor + line follower that stop in green zone.](https://drive.google.com/file/d/0B9rkiUWl5k_kbnNUX29qaDBrcVk/view)
|
|
|
7. [CodeSnippet2: The implement code in our PID controlled line follower program.](https://drive.google.com/file/d/0B9rkiUWl5k_kbnNUX29qaDBrcVk/view)
|
|
|
8. [Video 4: Demonstration of Color Sensor line follower] (https://www.youtube.com/watch?v=jcXVPVMcbpM&feature=youtu.be)
|
|
|
9. [CodeSnippet 3: Implemented code of the Color Sensor line follower program](https://drive.google.com/file/d/0B9rkiUWl5k_kbnNUX29qaDBrcVk/view) |
|
|
\ No newline at end of file |
|
|
9. [CodeSnippet 3: Implemented code of the Color Sensor line follower program](https://drive.google.com/file/d/0B9rkiUWl5k_kbnNUX29qaDBrcVk/view)
|
|
|
|