... | ... | @@ -56,6 +56,7 @@ We will use the LineFollowerCal.java[1], and place the car on the circuit to see |
|
|
|
|
|
[![image alt text](http://img.youtube.com/vi/lHlDTTMl_9s/0.jpg)](http://www.youtube.com/watch?v=lHlDTTMl_9s)
|
|
|
##### Video 1: LineFollowerCal.java[1] test.
|
|
|
-
|
|
|
|
|
|
As shown in the video, we can see that the LineFollowerCal.java[1] program has difficulties staying on the target (the black line), even though we can see the car is recognising the black line it won't get back on track when in the middle of a turn and thereby keeps turning with small lacks when registering a black line.
|
|
|
|
... | ... | @@ -82,6 +83,7 @@ Second: We implement the methods for the motors. |
|
|
As seen in the video the car detects both the black line, and the white and green zones - in which it stops perfectly. The car has some problems when going from the ramp and down the hill.
|
|
|
|
|
|
The below codesnippet is the implemented code, the thresholds for the colors are calibrated each time the program starts, furthermore they are allowed to differ +-2 in relation to the detected value.
|
|
|
-
|
|
|
|
|
|
```
|
|
|
public class carLineFollower1 {
|
... | ... | @@ -116,7 +118,7 @@ public class carLineFollower1 { |
|
|
}
|
|
|
```
|
|
|
##### CodeSnippet1: Implemented code for the three color sensor + line follower that stop in green zone.[6]
|
|
|
|
|
|
-
|
|
|
|
|
|
#### Conclusion
|
|
|
Because of the increase in the height of the sensor when going from the ramp and downhill, the robot detects another light percentage, and thereby it don’t know what to do with this value. This could maybe be solved by increasing the sample interval so it won’t check as quickly or forcing the motors to run for a very small interval of time, instead of, as it is now, only run when detecting the right value. Further, using a mean as the threshold for the black and white could solve the problem. However, this would require some more testing, and hopefully more solutions will come next time we look at this experiment.
|
... | ... | @@ -134,6 +136,7 @@ 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]
|
... | ... | @@ -212,6 +215,8 @@ 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.
|
... | ... | @@ -233,12 +238,15 @@ The different values that was shown on the screen on the robot have been set up |
|
|
![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]
|
|
|
|
|
|
[![image alt text](http://img.youtube.com/vi/jcXVPVMcbpM/0.jpg)](http://www.youtube.com/watch?v=jcXVPVMcbpM)
|
|
|
##### Video 4: Demonstration of Color Sensor line follower.
|
|
|
-
|
|
|
|
|
|
|
|
|
#### Conclusion
|
|
|
We have tested if the color sensor can be used to follow a black line and stop when it hits a green color. Furthermore, we have investigated how the color sensor provides information about color. In our experiment, we found out that the reflection from light, and the material used to make the NXT follow a line has a great impact on how well it measures the color successfully since small variations can have a major impact on the red, green, blue and light values.
|
... | ... | |