|
# Group Optimus Crime
|
|
# Group Optimus Crime
|
|
|
|
|
|
## Lab Notebook Lesson 1
|
|
## Group members
|
|
|
|
|
|
**Date:** 12/02 2015
|
|
Joakim Gregersen Quach, Simon Møller Christensen, Simon Hammerholt Madsen |
|
|
|
\ No newline at end of file |
|
**Group members participating:** Joakim Gregersen Quach, Simon Møller Christensen, Simon Hammerholt Madsen
|
|
|
|
|
|
|
|
**Activity duration:** 3.5 hours
|
|
|
|
|
|
|
|
## Goal
|
|
|
|
To build a LEGO-car and equip it with a light-sensor, to make it follow a line, as per the instructions.
|
|
|
|
|
|
|
|
## Plan
|
|
|
|
Follow the exercises one by one, and experiment with values and components.
|
|
|
|
|
|
|
|
## Results
|
|
|
|
|
|
|
|
### Exercise 1 & 2
|
|
|
|
|
|
|
|
*In these exercises, we measure light values with the LED turned on, and the LED turned off.*
|
|
|
|
|
|
|
|
The first measurement of light values, was done by placing the light sensor over the different colors and noting the values. The results appear in the table below:
|
|
|
|
|
|
|
|
| First measurement | Sort | Hvid | Rød | Grøn | Blå | Grå |
|
|
|
|
|------------------- |------ |------ |----- |------ |----- |----- |
|
|
|
|
| LED tændt | 29 | 39 | 37 | 28 | 28 | 33 |
|
|
|
|
| LED slukket | 29 | 33 | 29 | 27 | 26 | 24 |
|
|
|
|
|
|
|
|
The measurements above seemed off, as some colors reflected less than the black color, and the difference between having the LED on and having the LED off, seemed random. We therefore tested with a different light sensor, which yielded the results below.
|
|
|
|
|
|
|
|
| Second measurement| Sort | Hvid | Rød | Grøn | Blå | Grå |
|
|
|
|
|-------------------|------|------|-----|------|-----|-----|
|
|
|
|
| LED tændt | 24 | 42 | 40 | 28 | 28 | 34 |
|
|
|
|
| LED slukket | 18 | 31 | 27 | 22 | 23 | 25 |
|
|
|
|
|
|
|
|
These results appear to be more plausible.
|
|
|
|
|
|
|
|
After these initial measurements we had a chat with Ole, which resulted in us questioning our choice of bigger tires, which we from testing found was faster, but meant that the light sensor was farther away from the floor/track then when using the standard tires from the building instructions. The following measurements was with the standard tires from the building instructions.
|
|
|
|
|
|
|
|
| Third measurement | Sort | Hvid | Rød | Grøn | Blå | Grå |
|
|
|
|
|------------------- |------ |------ |----- |------ |----- |----- |
|
|
|
|
| LED tændt | 34 | 61 | 60 | 40 | 38 | 49 |
|
|
|
|
| LED slukket | 16 | 23 | 20 | 16 | 16 | 18 |
|
|
|
|
|
|
|
|
From these measurements we logged a much bigger gap between readings of white and black, making the distinction much easier for the light sensor, when following the line.
|
|
|
|
|
|
|
|
To find the value for the blackWhiteThreshold-variable, we added the light values (with the LED turned on) and divided by two, to find the average. This yielded the result: 47
|
|
|
|
|
|
|
|
With the LED turned off the observed values were lower, as would be expected, as there is less light to be reflected.
|
|
|
|
|
|
|
|
### Exercise 3
|
|
|
|
|
|
|
|
*In this exercise we increase the sample interval, observe the changes, and try to explain these changes.*
|
|
|
|
|
|
|
|
As we increased the sample interval, the LEGO-car seemed to behave more and more erratically. The car was able to follow the line at sample values 10 and 100 but with a sample interval of 500, the car was no longer able to follow the line, but, after some initial random driving, started to follow the edge of the paper. With higher intervals the car just kept spinning.
|
|
|
|
|
|
|
|
The sample interval determines the frequency, with which light value samples are collected. As the intervals between light value samples became longer, the car had a longer time to do a turning action, resulting in the car not being able to follow certain lines.
|
|
|
|
|
|
|
|
### Exercise 4
|
|
|
|
|
|
|
|
*In this exercise we have logged the lightPercent and time from each sample.*
|
|
|
|
|
|
|
|
![Interval10](http://gitlab.au.dk/uploads/madsensi/optimus_crime-legolab/8a83f072fb/Interval10.JPG)
|
|
|
|
![Interval100](http://gitlab.au.dk/uploads/madsensi/optimus_crime-legolab/2e2b185005/Interval100.JPG)
|
|
|
|
![Interval500](http://gitlab.au.dk/uploads/madsensi/optimus_crime-legolab/e7d5e3ba98/Interval500.JPG)
|
|
|
|
![Interval1000](http://gitlab.au.dk/uploads/madsensi/optimus_crime-legolab/aa8f5d2cfa/Interval1000.JPG)
|
|
|
|
|
|
|
|
As we increase the sample interval, the oscillations increase as well until a certain point where the large sample interval, results in the car, not being able to follow the line.
|
|
|
|
|
|
|
|
### Exercise 5
|
|
|
|
|
|
|
|
*In this exercise we use the rawdata values instead of the lightPercent.*
|
|
|
|
|
|
|
|
Using the sensorPortTest.java, we conducted measurements with the rawdata, and got the following results:
|
|
|
|
|
|
|
|
| Rawdata measurement | Black | White |
|
|
|
|
|--------------------- |------- |------- |
|
|
|
|
| Rawdata | 650 | 400 |
|
|
|
|
|
|
|
|
Black lightpercent calculated with formula:
|
|
|
|
|
|
|
|
`100*(1-650/1023) = 36,46`
|
|
|
|
|
|
|
|
In our measurements with lightPercent, we measured black to be 34, which is quite close.
|
|
|
|
|
|
|
|
We found the interval between the measurements of black and white, to have a larger interval, than the percentages. This could be an advantage when there is a need for higher level of detail, as it provides larger resolution.
|
|
|
|
|
|
|
|
### Exercise 6
|
|
|
|
|
|
|
|
*In this exercise compare the drawString method using variables and using the strings directly.*
|
|
|
|
|
|
|
|
![HeapTest](http://gitlab.au.dk/uploads/madsensi/optimus_crime-legolab/f006f54b5e/HeapTest.JPG)
|
|
|
|
|
|
|
|
As the graphs show, using the strings directly requires more heap-memory. This could be because the strings are being generated each time the drawString-method is called, when the strings are used directly.
|
|
|
|
|
|
|
|
## Conclusion
|
|
|
|
|
|
|
|
The exercises were conducted as explained in the instructions.
|
|
|
|
|
|
|
|
## References
|
|
|
|
|
|
|
|
No references. |
|
|