... | ... | @@ -25,8 +25,7 @@ Ida was writing the code, Nicolai took notes, and Camilla and Emil were in charg |
|
|
## Results
|
|
|
We began by rebuilding the robot, looking at the illustrations for the building instructions for *Express-Bot* [1, page 2] as well as the images provided in the lesson plan under *Building Instructions for a Base Vehicle*.
|
|
|
|
|
|
![rebuilt robot](https://gitlab.au.dk/LEGO/lego-kode/raw/master/week8/img/firstbot.PNG)
|
|
|
|
|
|
![rebuilt robot](https://gitlab.au.dk/LEGO/lego-kode/raw/master/week8/img/firstbot.PNG)
|
|
|
*Figure 1: The robot's new look after rebuild - note the lovely flower; a celebration of spring and robots coming alive*
|
|
|
|
|
|
|
... | ... | @@ -37,7 +36,7 @@ A range of 0 to 100 could make sense as it incorporates noise levels up to shout |
|
|
|
|
|
Ideally we would run some more thorough experiments to figure out the exact range that the sound sensor can measure, but we opted not to do this. The result of running this program can be seen in Video 1.
|
|
|
|
|
|
[TODO: Video]
|
|
|
[TODO: Video]
|
|
|
*Video 1: The robot running SoundLover.java*
|
|
|
|
|
|
As can be seen in the video, the robot starts driving forward fine when measuring some noise, however it keeps driving forward with full speed despite receiving (almost) no sound. We judged this as being a result of one of two things: The sound sensor could be vibrating too violently when the robot is driving full force, which the sensor interprets as a loud sound thereby causing a constant feedback loop making the robot continue to drive forward. Alternatively, it could simplu be that the sound made by the motors is loud enough to cause the robot to keep driving. A combination of the two being the cause is also likely.
|
... | ... | @@ -47,7 +46,7 @@ To solve this issue, we rebuilt the robot to extend the sound sensor further awa |
|
|
![re-rebuilt robot](https://gitlab.au.dk/LEGO/lego-kode/raw/master/week8/img/polebot.PNG)
|
|
|
*Figure 2: The robot after second rebuild - notice that the flower is still there*
|
|
|
|
|
|
[TODO: Rebuild video]
|
|
|
[TODO: Rebuild video]
|
|
|
*Video 2: The robot running SoundLover.java after rebuild*
|
|
|
|
|
|
We see that the build solves our problem extremely well, as the robot accurately slows down once we stop making sounds instead of constantly driving at high speed.
|
... | ... | @@ -56,24 +55,24 @@ Next, we modified our program to receive raw values directly from the sensor por |
|
|
|
|
|
[TODO: Perhaps insert code example?]
|
|
|
|
|
|
[TODO: Video, one from corner to middle in 3 bursts (Nicolai knows wtf this means)]
|
|
|
[TODO: Video, one from corner to middle in 3 bursts (Nicolai knows wtf this means)]
|
|
|
*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.
|
|
|
|
|
|
[TODO: Insert videooo (killed the radio star) - Ida: Thank you, Nicolai, nu har man den på hjernen (min venindes kommentar: Thanks Obama)]
|
|
|
[TODO: Insert videooo (killed the radio star) - Ida: Thank you, Nicolai, nu har man den på hjernen (min venindes kommentar: Thanks Obama)]
|
|
|
*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?), 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***, 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.
|
|
|
|
|
|
[TODO: insert SoundHater video]
|
|
|
[TODO: insert SoundHater video]
|
|
|
*Video 5: The robot running SoundHater.java*
|
|
|
|
|
|
Finally, we made the program ***TinyDancer.java***, 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?), 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.
|
|
|
|
|
|
[TODO: Insert spin me right round baby right round]
|
|
|
[TODO: Insert spin me right round baby right round]
|
|
|
*Video 6: TinyDancer robot constantly turning left*
|
|
|
|
|
|
We then tried increasing the values of the threshold for turning left or right to 80, then to 90, and lastly settled on a magic number, 93, before we were satisfied with the left-to-right ratio Lastly, we realized that the robot wasn't dancing, it was just driving forward with either the left or right motor. We then made the made the motor that wasn't currently driving forward go backwards with the same amount of power, so the robot would stand in one spot and 'dance', instead of simply driving around. The fabulous result can be seen in Video 7.
|
... | ... | |