Date:
7/2-2014
7/2-2014
Duration of activity:
9.30 - 13 (3.5 hours)
Group members
participating:
Benjamin, Christina, (Levi)
Benjamin, Christina, (Levi)
Goal for the lab
session:
- To complete the exercises for the week [1].
- To complete the exercises for the week [1].
- To get USB-connection to work on all our computers.
- To get BT-communication to work on min. 1 computer.
Plan for the activities:
- To go through the exercises at the chronological order from 1-5.
- To go through the exercises at the chronological order from 1-5.
Results obtained during lab session:
- Exercise 1:
 We placed the light sensor above different blocks of colored pieces of LEGO and note the measured light values. 
 The table for the noted values is seen here:color (all LEGO colors) light % black 30 white 59 blue 34 red 53 beige 54 yellow 58 grey 44 green 32 brown 40 
 As is shown, when the light sensor is above the color black, the light % value is 30. When above the color white, the light % value is 59 (variated between 58 and 60).
 The threshold in the program (of 45) is obtained as the middle value between 30 and 59, as this would mean that when the value is closer to 30 than it is to 59 (or 60), then the program thinks that the color is black and turn appropriately.
- Exercise 2:
 We turned the LED off, so that the ambient light level was measured in stead of the reflection of the red LED. The LED was turned of by changing the light.setFloodlight(true) to light.setFloodlight(false).
 We measured the light value for the same colors as before, and the values for both the situations are seen in the same collection below.color (all LEGO colors) light % Floodlight(true) Floodlight(false) black 30 18 white 59 30 blue 34 21 red 53 27 beige 54 27 yellow 58 28 grey 44 23 green 32 22 brown 40 20 
 
- Exercise 3:
 The sample interval in the program is changed from 10 msec to 100msec, 500msec and 1000msec.
 With the different sample rates we see different things happening:
 - 10msec: the car drives a bit to the right, a bit to the left, then to the right again an so on. It doesn't drive in a straight line bit in a bit of a zig-zag, but it does follow the line. Video:
 - 100 msec: the car has larger turns to the right before turning left. This means that is sometimes get away from the line and can't find it again.
 - 500msec: the car only turns towards the line one time when getting away from it, and then stops following the line, driving around without finding the line again.
 - 1000msec: the car doesn't follow the line at all. Video:
 The reason the car gets worse at following the line is that is samples with too low a rate. In this way it drives to much in one direction before measuring again, and by the time it measures it has gotten way off track.
- Exercise 4:
 We record the light values read in the control loop from the sensor on the car, with the class DataLogger [2]. The values are stored in text files; e.g. 'sample10msec.txt'.We recorded data for sample intervals of 10msec, 100msec, 500m sec and 1000msec. A graph of the light values over time are then plotted. These different plots can be seen below.
 All the plots have the same window of sampling for easy comparison: from measurements in time 500 msec to 6000 msec.
 
 
 
 It can be seen that the different sample intervals greatly influences the oscillations in the graph. For the sample rate of 10 msec, there is a clear oscillation between measured values on white and black color. As the sample rate gets higher fewer fewer values are measured in the same amount of time, and therefore the car doesn't oscillate to the same degree between the white and black color.
 When the sample rate is 1000 msec (1 second), it is clear that the car measures values to slowly to correct it's movement towards the black line.
- Exercise 5:
 We tried using text strings directly in the calls to LCD.drawString instead of the variables right and left.
 With using the variables for the strings "turn left" and "turn right" the free memory space is a constant 56540 bytes, because the strings are being referenced from their variables.
 When using strings for these variables the free memory space decreases from about 56xxx to 40000 before is releases some space and then starts decreasing again. This is because there is being used space to create the strings each time they are written.
Fun
For the fun of it we played around with controlling the car in a way that made made it turn with a smaller degree from white to black color around the table and in the corner points.
The code for doing this is shown here along with a video of the more smooth movement of the car:
Conclusion:
- status: we completed all the exercises for this week.
- we got the car driving a bit more smooth
- what to do next: get BT to work on all computers.
The code for doing this is shown here along with a video of the more smooth movement of the car:
Conclusion:
- status: we completed all the exercises for this week.
- we got the car driving a bit more smooth
- what to do next: get BT to work on all computers.




 
Ingen kommentarer:
Send en kommentar