... | ... | @@ -70,22 +70,25 @@ Next, we modified our program to receive raw values directly from the sensor por |
|
|
|
|
|
[![Raw value SoundLover](http://img.youtube.com/vi/I5IMfdiapT4/0.jpg)](https://www.youtube.com/watch?v=I5IMfdiapT4)
|
|
|
|
|
|
*Video 3: Running SoundLover.java using raw values read directly from the sensor port instead of dB values read from the sound sensor*
|
|
|
*Video 3: Running SoundLover.java using raw values read directly from the sensor port instead of dB values read from the lejos sound sensor*
|
|
|
|
|
|
#### Sound Reactor
|
|
|
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)
|
|
|
|
|
|
*Video 4: The robot running SoundReactor.java*
|
|
|
|
|
|
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.
|
|
|
After being thoroughly confused by the robot LCD displays method for drawing an integer, we realized that we had forgotten to clear the robots LCD display resulting in us being confused by an unexpected value that wasn't actually part of the program execution. After a while, however, we managed to get it working. As can be seen in video 4, 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 motors 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.
|
|
|
|
|
|
#### Inhibitory vehicle
|
|
|
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*
|
|
|
|
|
|
#### Dancing robot
|
|
|
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)
|
... | ... | |