... | ... | @@ -59,7 +59,7 @@ Next, we modified our program to receive raw values directly from the sensor por |
|
|
|
|
|
*Video 3: Running SoundLover.java using raw values read directly from the sensor port instead of dB values read from the sound sensor*
|
|
|
|
|
|
The next task was to map the raw values to the range [-100, 100], in order for the robot motor power range to go from full power backwards to full power forwards, rather than from full stop to full power forwards. We do this simply by multiplying the percentage of measured raw value (inverted) by 2 - that is, instead of obtaining a percentage value by multiplying by 100, we multiply by the full range value of 200. The resulting value is then added to the minimum range value of -100. We implemented this in the program ***SoundReactor.java***, and the result can be seen in Video 4.
|
|
|
The next task was to map the raw values to the range [-100, 100], in order for the robot motor power range to go from full power backwards to full power forwards, rather than from full stop to full power forwards. We do this simply by multiplying the percentage of measured raw value (inverted) by 2 - that is, instead of obtaining a percentage value by multiplying by 100, we multiply by the full range value of 200. The resulting value is then added to the minimum range value of -100. We implemented this in the program ***SoundReactor.java*** [5], and the result can be seen in Video 4.
|
|
|
|
|
|
[![SoundReactor](http://img.youtube.com/vi/doQHtfXyvQ0/0.jpg)](https://www.youtube.com/watch?v=doQHtfXyvQ0)
|
|
|
|
... | ... | @@ -67,13 +67,13 @@ The next task was to map the raw values to the range [-100, 100], in order for t |
|
|
|
|
|
After being thoroughly confused by draw int for a while (TODO: Ida forstår ikke det her - det var da ikke DrawInt, der forvirrede os? Nicolai: Jo, det var hvor vi troede den viste 300-600 hvor den kun burder vise værdier fra 0-100, men det var bare fordi vi ikke clearet displayet så det 3. digit stadig var der fra de gange den viste 100), we managed to get it working. As can be seen in the video, the robot drives forward and backward according to sound level reasonably appropriately, although it appears that when driving backwards the noise/vibrations caused by the robot is enough of an increase in the values picked up by the sensor that the robot immediately slows down its backwards driving and even drives forward a bit.
|
|
|
|
|
|
We wrote a program, ***SoundHater.java*** [5], as the inhibitory version of ***SoundLover.java***. The program is exactly the same as the SoundLover program, except we don't invert the read value. The result is shown in Video 5. The robot accurately stops when hearing loud noises and drives forward under low sound levels.
|
|
|
We wrote a program, ***SoundHater.java*** [6], as the inhibitory version of ***SoundLover.java***. The program is exactly the same as the SoundLover program, except we don't invert the read value. The result is shown in Video 5. The robot accurately stops when hearing loud noises and drives forward under low sound levels.
|
|
|
|
|
|
[![SoundHater](http://img.youtube.com/vi/be89rHd9oHs/0.jpg)](https://www.youtube.com/watch?v=be89rHd9oHs)
|
|
|
|
|
|
*Video 5: The robot running SoundHater.java*
|
|
|
|
|
|
Finally, we made the program ***TinyDancer.java*** [6], where we initially made the robot turn left if the sensor measured a sound level above 50 (TODO Ida: som i 50 procent? Eller dB? Nicolai: Procent... I think? Halp i need 2nd opinion Camilla), and turn right if the value was less than 50. The robot kept constantly turning left as the sound level caused by itself was too high. This can be seen in Video 6.
|
|
|
Finally, we made the program ***TinyDancer.java*** [7], where we initially made the robot turn left if the sensor measured a sound level above 50 (TODO Ida: som i 50 procent? Eller dB? Nicolai: Procent... I think? Halp i need 2nd opinion Camilla), and turn right if the value was less than 50. The robot kept constantly turning left as the sound level caused by itself was too high. This can be seen in Video 6.
|
|
|
|
|
|
[![TinyDancer, 1st attempt](http://img.youtube.com/vi/gjiWjaYU4eA/0.jpg)](https://www.youtube.com/watch?v=gjiWjaYU4eA)
|
|
|
|
... | ... | @@ -93,7 +93,7 @@ The robot was rebuilt to include two light sensors instead of the sound sensor, |
|
|
![Robot with light sensors](https://gitlab.au.dk/LEGO/lego-kode/raw/master/week8/img/firefry1.PNG)
|
|
|
*Figure 3: Robot fitted with two light sensors*
|
|
|
|
|
|
We created a program, ***LightLover.java*** [7], which behaves similarly to ***SoundLover.java*** - the difference being that we now have two sensors, mapping one sensor's light readings to the power of one motor, and the other sensor's readings to the power of the other motor. We created Braitenberg's Vehicle 2a (see Figure 4) by simply mapping the value measured by the left sensor to the left motor, and the value from the right sensor to the right motor. As we have programmed for an exitatory behavior, this means that high light levels on the left sensor will induce a high power on the left motor and as a result cause the robot to drive *away* from light sources. The resulting behaviour turned our to be that the robot mostly stood still, as the ambient light values in the room did not map to a high enough motor power to get the motors to actually move (the measured values and resulting motopower would lie around 57). However, when stimulated by a bright light source, such as the torch on our phone, the robot accurately drives away from it, as shown in Video 8. If we wanted the robot to properly drive around and watch out for light, we could simply do a small calibration by adding some extra base power to each motor, to get the robot to actually drive around in ambient lighting.
|
|
|
We created a program, ***LightLover.java*** [8], which behaves similarly to ***SoundLover.java*** - the difference being that we now have two sensors, mapping one sensor's light readings to the power of one motor, and the other sensor's readings to the power of the other motor. We created Braitenberg's Vehicle 2a (see Figure 4) by simply mapping the value measured by the left sensor to the left motor, and the value from the right sensor to the right motor. As we have programmed for an exitatory behavior, this means that high light levels on the left sensor will induce a high power on the left motor and as a result cause the robot to drive *away* from light sources. The resulting behaviour turned our to be that the robot mostly stood still, as the ambient light values in the room did not map to a high enough motor power to get the motors to actually move (the measured values and resulting motopower would lie around 57). However, when stimulated by a bright light source, such as the torch on our phone, the robot accurately drives away from it, as shown in Video 8. If we wanted the robot to properly drive around and watch out for light, we could simply do a small calibration by adding some extra base power to each motor, to get the robot to actually drive around in ambient lighting.
|
|
|
|
|
|
[![Light haters gonna hate](http://img.youtube.com/vi/R5ao7_WGzs8/0.jpg)](https://www.youtube.com/watch?v=R5ao7_WGzs8)
|
|
|
|
... | ... | @@ -142,7 +142,7 @@ The illustration in Figure 6 ("Figure 7" in the lesson plan) shows the sound sen |
|
|
|
|
|
*Figure 6: The diagrammatic illustration of Vehicle 3 provided as Figure 7 in the lesson plan*
|
|
|
|
|
|
We wrote a program, ***RaveBot.java*** [8], that seeks towards places with both high sound levels and high light levels. The program mostly consists of a mash of our previous programs ***SoundLover.java*** and ***LightLover.java***, where we simply add together the two values received from the sensors and then divide by two (halving the impact of each sensor), using the resulting value as the motor power for the corresponding motor according to the drawing in Figure 6. The result can be seen in Video 10.
|
|
|
We wrote a program, ***RaveBot.java*** [9], that seeks towards places with both high sound levels and high light levels. The program mostly consists of a mash of our previous programs ***SoundLover.java*** and ***LightLover.java***, where we simply add together the two values received from the sensors and then divide by two (halving the impact of each sensor), using the resulting value as the motor power for the corresponding motor according to the drawing in Figure 6. The result can be seen in Video 10.
|
|
|
|
|
|
[![RaveBot: Activate](http://img.youtube.com/vi/8bv9QNYc14I/0.jpg)](https://www.youtube.com/watch?v=8bv9QNYc14I)
|
|
|
|
... | ... | @@ -162,12 +162,14 @@ TODO |
|
|
|
|
|
[4] [The Soundlover.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson6programs/SoundLover.java)
|
|
|
|
|
|
[5] [The SoundHater.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson6programs/SoundHater.java)
|
|
|
[5] [The SoundReactor.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson6programs/SoundReactor.java)
|
|
|
|
|
|
[6] [The TinyDancer.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson6programs/TinyDancer.java)
|
|
|
[6] [The SoundHater.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson6programs/SoundHater.java)
|
|
|
|
|
|
[7] [The LightLover.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson6programs/LightHater.java)
|
|
|
[7] [The TinyDancer.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson6programs/TinyDancer.java)
|
|
|
|
|
|
[8] [The RaveBot.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson6programs/RaveBot.java)
|
|
|
[8] [The LightLover.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson6programs/LightHater.java)
|
|
|
|
|
|
[9] [The RaveBot.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson6programs/RaveBot.java)
|
|
|
|
|
|
[TODO: video refs] |
|
|
\ No newline at end of file |