... | @@ -41,10 +41,16 @@ The sample interval indicates how often the robot should react to its environmen |
... | @@ -41,10 +41,16 @@ The sample interval indicates how often the robot should react to its environmen |
|
|
|
|
|
### Exercise 4
|
|
### Exercise 4
|
|
The following four graphs show the data collected from using 10ms, 50ms, 100ms and 500ms sample intervals respectively. A short sample interval is expected to update the direction of the robot often, while a slow sample interval might allow the robot to drive further away from the black line before its direction is corrected. The graph, which we have created using the DataLogger, illustrate this point well. We see for a 10ms sample rate that we first of all have a lot of data samples, but also that the curve resembles a sinus curve, which oscillates with a fairly high frequency. The same points can be made for 50ms and 100ms, although they oscillate with a lower frequency as expected. The final graph, which modulates 500ms is a special case in that the robot is not able to follow the black line for such a high sample interval. As a result it runs in circles causing the graph to be somewhat chaotic, but still with a low frequency as expected.
|
|
The following four graphs show the data collected from using 10ms, 50ms, 100ms and 500ms sample intervals respectively. A short sample interval is expected to update the direction of the robot often, while a slow sample interval might allow the robot to drive further away from the black line before its direction is corrected. The graph, which we have created using the DataLogger, illustrate this point well. We see for a 10ms sample rate that we first of all have a lot of data samples, but also that the curve resembles a sinus curve, which oscillates with a fairly high frequency. The same points can be made for 50ms and 100ms, although they oscillate with a lower frequency as expected. The final graph, which modulates 500ms is a special case in that the robot is not able to follow the black line for such a high sample interval. As a result it runs in circles causing the graph to be somewhat chaotic, but still with a low frequency as expected.
|
|
|
|
|
|
|
|
|
|
![Alt Text](http://oi57.tinypic.com/29qntwz.jpg)
|
|
![Alt Text](http://oi57.tinypic.com/29qntwz.jpg)
|
|
|
|
|
|
![Alt Text](http://oi58.tinypic.com/10yl6cy.jpg)
|
|
![Alt Text](http://oi58.tinypic.com/10yl6cy.jpg)
|
|
|
|
|
|
|
|
![Alt attribute text Here](images/ex4_100ms.png)
|
|
|
|
|
|
|
|
![Alt attribute text Here](images/ex4_500ms.png)
|
|
|
|
|
|
|
|
|
|
### Exercise 5
|
|
### Exercise 5
|
|
| Color | White | Black | Green | Grey |
|
|
| Color | White | Black | Green | Grey |
|
... | @@ -64,6 +70,10 @@ From these 4 colors, it becomes apparent that the light percentages calculated u |
... | @@ -64,6 +70,10 @@ From these 4 colors, it becomes apparent that the light percentages calculated u |
|
### Exercise 6
|
|
### Exercise 6
|
|
We tried to use text strings directly in the calls to LCD.drawString instead of the variables right and left. We used Runtime.getRuntime().freeMemory() to store the amount of free memory on the heap during the execution using the variables and during the execution using strings directly. This gave us the following two graphs.
|
|
We tried to use text strings directly in the calls to LCD.drawString instead of the variables right and left. We used Runtime.getRuntime().freeMemory() to store the amount of free memory on the heap during the execution using the variables and during the execution using strings directly. This gave us the following two graphs.
|
|
|
|
|
|
|
|
![Alt attribute text Here](images/ex6_mem_var.png)
|
|
|
|
|
|
|
|
![Alt attribute text Here](images/ex6_mem_var.png)
|
|
|
|
|
|
Here we see how the heap gets filled during the executions and is cleared when the amout of free memory is less than 40,000.
|
|
Here we see how the heap gets filled during the executions and is cleared when the amout of free memory is less than 40,000.
|
|
We see how the heap is filled faster when executing the program using strings directly, compared to the program that uses variables. This indicates that the program does not have a direct reference the the strings if not stored in a variable, and therefore allocates space on the heap for the strings each time they are used.
|
|
We see how the heap is filled faster when executing the program using strings directly, compared to the program that uses variables. This indicates that the program does not have a direct reference the the strings if not stored in a variable, and therefore allocates space on the heap for the strings each time they are used.
|
|
|
|
|
... | | ... | |