... | ... | @@ -9,16 +9,16 @@ |
|
|
**Activity duration:** 3 hours
|
|
|
|
|
|
## Goal
|
|
|
The goal of this exercise is to expirement with the light and make the robot follow a line using simple control algorithms.
|
|
|
The goal of this exercise is to expirement with the light sensor and make the LEGO car follow a line using simple control algorithms.
|
|
|
|
|
|
## Plan
|
|
|
To follow the instructions given in Lesson 1 (http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson1.dir/Lesson.html)
|
|
|
The plan is to follow the instructions given in the instructions for Lesson 1 (http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson1.dir/Lesson.html)
|
|
|
|
|
|
## Results
|
|
|
|
|
|
### Exercise 1
|
|
|
|
|
|
In order to generate the color percentages we used the color scale from the assembly manual of the 9797 Lego car (page 69). The robot was placed on one color at a time and the percentage was read from the display. In this setup the red LED on the light sensor was turned on. The output of this process is summarized in the following table.
|
|
|
In order to generate the color percentages we used the color scale from the assembly manual of the LEGO car (page 69). The robot was placed on one color at a time and the percentage was read from the display. In this setup the red LED on the light sensor was turned on. The output of this process is summarized in the following table.
|
|
|
|
|
|
Color | Percentage
|
|
|
----------- | -----
|
... | ... | @@ -34,12 +34,11 @@ Dark blue | 41 |
|
|
Black | 39
|
|
|
White | 58
|
|
|
|
|
|
From this table it is clear that the lighter the color is the higher is the output percentage. To determine a proper threshold between black and white the middle between black and white is used which is **49**.
|
|
|
|
|
|
From this table it is clear that the brighter the color is the higher is the output percentage. To determine a proper threshold between black and white the mean value of the two colors percentages is used which is **49**.
|
|
|
|
|
|
### Exercise 2
|
|
|
|
|
|
In this exercise the same procedure as in exercise 1 is carried out however the red LED in the light sensor is turned off. The output of this process is sumarized in the following table.
|
|
|
In this exercise the same procedure as in exercise 1 is carried out however the red LED in the light sensor is turned off. The output of this process is sumarized in the following table.
|
|
|
|
|
|
Color | Percentage
|
|
|
----------- | -----
|
... | ... | @@ -55,7 +54,7 @@ Dark blue | 18 |
|
|
Black | 15
|
|
|
White | 21
|
|
|
|
|
|
It is seen that the different color percentages are closer to each other with the red LED is turned off. It is desirable to have the color percentages seperated as much as possible to enhance the operation of the LEGO car which is why in further usage of this light sensor the LED should be turned on.
|
|
|
It is seen that the different color percentages are closer to each other when the red LED is turned off. It is desirable to have the color percentages seperated as much as possible to enhance the operation of the LEGO car which is why in further usage of this light sensor the LED should be turned on.
|
|
|
|
|
|
### Exercise 3
|
|
|
|
... | ... | @@ -106,7 +105,7 @@ Dark blue | 793 | 22.48 | 4.48 |
|
|
Black | 842 | 17.69 | 2.69
|
|
|
White | 762 | 25.51 | 4.51
|
|
|
|
|
|
It is seen from these tables that the delta percentages more inconsistent when the red LED in turned off.
|
|
|
It is seen from these tables that the delta percentages are more inconsistent when the red LED in turned off.
|
|
|
|
|
|
In general one will gain a higher precision when using the raw values due to a larger span which can be beneficial in some applications.
|
|
|
|
... | ... | @@ -116,9 +115,9 @@ The following figure represents the free memory available while the robot car is |
|
|
|
|
|
![alt text](https://gitlab.au.dk/uploads/rene2014/lego/f828f01da7/FreeMemoryMeasurements.png "Exercise 6 - Measurements")
|
|
|
|
|
|
The data shows the available memory decrease during operation, as memory is being allocated in every iteration of the control loop, and the garbage collector periodically reclaiming memory.
|
|
|
The data shows the available memory decreases during operation, as memory is being allocated in every iteration of the control loop, and the garbage collector periodically reclaiming memory.
|
|
|
|
|
|
From this data, we can see that using string literals directly will result in allocating a new string each time that code is invoked - that is, the JVM on the NXT does not perform string interning. Thus, using string litterals will result the GC being invoked more frequently, and may degrade performance.
|
|
|
|
|
|
## Conclusion
|
|
|
In this lesson 1 we have done expriements with the light sensor and simple control algorithms. It is clear from the results that external light affects the light readings significantly should therefore be considered in future applications. |
|
|
\ No newline at end of file |
|
|
In this lesson 1 we have done experiments with the light sensor and simple control algorithms. It is clear from the results that external light affects the sensor readings significantly and should therefore be taken in account in future applications. |
|
|
\ No newline at end of file |