jessvi created page: Lab3 authored by Jesper Kurtzmann Svith's avatar Jesper Kurtzmann Svith
...@@ -56,13 +56,18 @@ ...@@ -56,13 +56,18 @@
> >
> #### Results > #### Results
> >
>First we clapped at different distances to the sensor in order to measure from how far the sensor Will pick up >sound. We soon realized that the measurements were very inconsistent as it is impossible to make two or more >identical claps in a row. > First we clapped at different distances to the sensor in order to measure from how far the sensor Will pick up
> sound. We soon realized that the measurements were very inconsistent as it is impossible to make two or more
> identical claps in a row.
> >
>To compensate for the inconsistency we decided to use a smartphone and transmit a constant tone. The setup is showed >in the picture below. The car was placed on a table in the middle of the room and loudness were measured from >different distances: > To compensate for the inconsistency we decided to use a smartphone and transmit a constant tone. The setup is
> showed in the picture below. The car was placed on a table in the middle of the room and loudness were measured
> from different distances:
> >
> ![Skærmbillede 2015-03-02 kl. 09.56.58](http://gitlab.au.dk/uploads/group->22/lego/fcb16f422c/Sk%C3%A6rmbillede_2015->03-02_kl._09.56.58.png) > ![G1](http://gitlab.au.dk/uploads/group-22/lego/093160e740/G1.png)
> >
>Fig. 1: Picture of the setup. The robot was placed on a table and the phone was pointed towards the robot. After >each sensor reading the distance to the phone was increased. > Fig. 1: Picture of the setup. The robot was placed on a table and the phone was pointed towards the robot. After
> each sensor reading the distance to the phone was increased.
> >
> | Distance (approx metres) | Sensor Reading (dB) | > | Distance (approx metres) | Sensor Reading (dB) |
> | -------- | -------- | > | -------- | -------- |
...@@ -83,18 +88,22 @@ ...@@ -83,18 +88,22 @@
> >
> #### Plan > #### Plan
> >
>We use the program DataLogger.java from lesson 1 to record data from the program SoundSampler.java. Then we will >process the data and make a graph using excel. > We use the program DataLogger.java from lesson 1 to record data from the program SoundSampler.java. Then we will
> process the data and make a graph using excel.
> >
> #### Result > #### Result
> >
>The DataLogger was used to log data from the sound sensor. The experiment consisted of a period of 10 seconds in >which consecutive snaps were made with the fingers. The graph below shows the results: > The DataLogger was used to log data from the sound sensor. The experiment consisted of a period of 10 seconds in
> which consecutive snaps were made with the fingers. The graph below shows the results:
> >
>![Skærmbillede 2015-03-02 kl. 10.34.35](http://gitlab.au.dk/uploads/group-22/lego/c97aea11de/Sk%C3%A6rmbillede_2015->03-02_kl._10.34.35.png) > ![T1](http://gitlab.au.dk/uploads/group-22/lego/a2d284cc77/T1.png)
>Fig. Recording of a sequence of four finger snaps. The graph shows data logged from the NXT while running the >SoundSampler program. > Fig. Recording of a sequence of four finger snaps. The graph shows data logged from the NXT while running the
> SoundSampler program.
> >
> The graph shows four distinct spikes in the sound level caused by the finger snapping. The spikes peak at 30-50 > The graph shows four distinct spikes in the sound level caused by the finger snapping. The spikes peak at 30-50
> (db?) before the sound level goes back to its normal. The background noise measured is about 2-10 (db?).It is > (db?) before the sound level goes back to its normal. The background noise measured is about 2-10 (db?).It is
>interesting to note that the spikes increase faster than they fade away. This observation can be due to resonance or >echo from the sound waves which take some milliseconds to fade away. > interesting to note that the spikes increase faster than they fade away. This observation can be due to resonance
> or echo from the sound waves which take some milliseconds to fade away.
> >
> --- > ---
> ## Exercise 3 - Sound Controlled Car > ## Exercise 3 - Sound Controlled Car
...@@ -109,16 +118,24 @@ ...@@ -109,16 +118,24 @@
> >
> #### Result > #### Result
> >
>The test was conducted on a table where the car was controlled using voice commands. When the car detected the first >spike it would drive forward, when it heard the second it would turn left, on the third it would turn right and on >the fourth it would stop. > The test was conducted on a table where the car was controlled using voice commands. When the car detected the
> first spike it would drive forward, when it heard the second it would turn left, on the third it would turn right
> and on the fourth it would stop.
> >
>As every word has its own sound profile It could be interesting to investigate if the robot could interpret and act >differently on various voice commands. For instance it might be possible for the robot to recognize the difference >in length of words. However if different words are of equal length it might be difficult. > As every word has its own sound profile It could be interesting to investigate if the robot could interpret and act
> differently on various voice commands. For instance it might be possible for the robot to recognize the difference
> in length of words. However if different words are of equal length it might be difficult.
> >
> --- > ---
> ## Exercise 4 - ButtonListener > ## Exercise 4 - ButtonListener
> >
> #### Task > #### Task
> >
>In the program SoundCtrCar.java the ESCAPE button is polled in the outermost loop so that the ESCAPE button can be >used to stop the program. This does not work when the program loops in one of the four inner loops. You can make the >ESCAPE button always work as a program terminator if you also poll the state of the button in the inner loops. But >you can also use the ButtonListener mechanism to listen for the ESCAPE button and exit when ESCAPE is pressed. A >simple example of a ButtonListener can be seen in the leJos tutorial, [4]. Try this in the program. > In the program SoundCtrCar.java the ESCAPE button is polled in the outermost loop so that the ESCAPE button can be
> used to stop the program. This does not work when the program loops in one of the four inner loops. You can make
> the ESCAPE button always work as a program terminator if you also poll the state of the button in the inner loops.
> But you can also use the ButtonListener mechanism to listen for the ESCAPE button and exit when ESCAPE is pressed.
> A simple example of a ButtonListener can be seen in the leJos tutorial, [4]. Try this in the program.
> >
> #### Plan > #### Plan
> >
... ...
......