... | ... | @@ -55,7 +55,7 @@ public class BWSensorTest |
|
|
|
|
|
*Code 1 : BlackWhiteSensor test class*
|
|
|
|
|
|
<img src="https://gitlab.au.dk/martinwp/LegoGroup2/raw/develop/lesson-04/images/sensor_location_high.jpg" alt="Figure 1" width="200px" />
|
|
|
<img src="https://gitlab.au.dk/martinwp/LegoGroup2/raw/develop/lesson-04/images/sensor_location_high.jpg" alt="Figure 1" width="300px" />
|
|
|
*Figure 1 : The initial construction of the robot, Note hight of sensor location*
|
|
|
|
|
|
The *BlackWhiteSensor.java* \[2\] class prints light values to the display as a percentage. We noted these in Table 1.
|
... | ... | @@ -68,7 +68,7 @@ The *BlackWhiteSensor.java* \[2\] class prints light values to the display as a |
|
|
We noticed that the application was very effective at classifying the differences between black and white. It does this by calculating the median between the black and white readings and setting this value as the threshold between the two colors.
|
|
|
Because of this, it was interesting to test the sensor on a greyscale. Starting at white, we moved the robot manually (and thus the sensor) towards black until the classification changed. The classification was printed on the display, and the threshold was printed as ?. This happened around the middle of the scale which makes sense. The exact point at which the application changed from white to black can be seen in Figure 2.
|
|
|
|
|
|
<img src="https://gitlab.au.dk/martinwp/LegoGroup2/raw/develop/lesson-04/images/sensor_black_white.jpg" alt="Figure 2" width="200px" />
|
|
|
<img src="https://gitlab.au.dk/martinwp/LegoGroup2/raw/develop/lesson-04/images/sensor_black_to_white.jpg" alt="Figure 2" width="300px" />
|
|
|
*Figure 2 : Measuring the exact point of classification between black and white. The robot was moved manually and the classification was printed to the display*
|
|
|
|
|
|
### Line Follower with Calibration ###
|
... | ... | @@ -201,7 +201,7 @@ public class LineFollowerCalGoal |
|
|
##### 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, as seen in Figure 3. 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.
|
|
|
|
|
|
<img src="https://gitlab.au.dk/martinwp/LegoGroup2/raw/develop/lesson-04/images/sensor_green.jpg" alt="Figure 3" width="200px" />
|
|
|
<img src="https://gitlab.au.dk/martinwp/LegoGroup2/raw/develop/lesson-04/images/sensor_green.jpg" alt="Figure 3" width="300px" />
|
|
|
*Figure 3 : The green goal zone*
|
|
|
|
|
|
##### Changing the sensor height #####
|
... | ... | @@ -216,7 +216,7 @@ Using these readings as calibration, we tried to run our application. This cause |
|
|
|
|
|
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 configuration can be seen in Figure 4.
|
|
|
|
|
|
<img src="https://gitlab.au.dk/martinwp/LegoGroup2/raw/develop/lesson-04/images/sensor_location_low.jpg" alt="Figure 4" width="200px" />
|
|
|
<img src="https://gitlab.au.dk/martinwp/LegoGroup2/raw/develop/lesson-04/images/sensor_location_low.jpg" alt="Figure 4" width="300px" />
|
|
|
*Figure 4 : Position of the light sensor, changed to be closer to surface*
|
|
|
|
|
|
By lowering the sensor to a height of a few millimeters, the sensor showed the values in Table 4.
|
... | ... | @@ -233,7 +233,7 @@ A final observation relating to this application is that the robot stopped immed |
|
|
### PID Line Follower ###
|
|
|
|
|
|
#### Description ####
|
|
|
It is possible to make a line follower with just one light sensor that follows the line more smoothly and drive faster if a PID regulator is used \[PID\]. Try this.
|
|
|
It is possible to make a line follower with just one light sensor that follows the line more smoothly and drive faster if a PID regulator is used \[5\]. Try this.
|
|
|
|
|
|
#### Execution ####
|
|
|
In this exercise, we follow the description of a PID implementation given in the exercise sources<<<<<ref>>>>>. We refer to this article for the theoretical reasoning for building a PID algorithm.
|
... | ... | @@ -327,13 +327,13 @@ While a simple program fitted with an advanced sensor can fulfil some goals, mor |
|
|
|
|
|
\[4\] : [ThreeColorSensor](https://gitlab.au.dk/martinwp/LegoGroup2/raw/develop/lesson-04/exercise-03/ThreeColorSensor.java)
|
|
|
|
|
|
\[PID\] : [A PID Controller For Lego Mindstorms Robots](http://www.inpharmix.com/jps/PID_Controller_For_Lego_Mindstorms_Robots.html)
|
|
|
\[5\] : [A PID Controller For Lego Mindstorms Robots](http://www.inpharmix.com/jps/PID_Controller_For_Lego_Mindstorms_Robots.html)
|
|
|
|
|
|
<!--
|
|
|
STYLE FOR REF:
|
|
|
\[number\] : [name](link)
|
|
|
|
|
|
STYLE FOR IMAGE:
|
|
|
<img src="" alt="Figure X" width="200px" />
|
|
|
<img src="" alt="Figure X" width="300px" />
|
|
|
*Figure X : This is a caption for Figure X*
|
|
|
--> |