tirsdag den 25. februar 2014

Date: 21
Duration of activity: 5 hrs 
Group members participating: Alexander Rasmussen and Søren Ditlev

Exercise 1

Goal:

To examine the sound sensor

Plan:

Implement a program that display the registered volume and followingly test the sound sensor at different volumes and distances.

Results:


Type
Distance (cm)
Volume 1-100%
Background noise
n/a
3
Light talk
60
15-25
Loud talk
60
25-30
Clap
60
70-90
Light talk
120
8-17
Loud Talk
120
17-25
Clap
120
55-70

Conclusion:

Distance diminishes the volume level. The longer the sound is away from the sound sensor the lower the volume the sensor will registre.
Since most sounds that are human made the varies in volume, for instance a clap varies over 20% at the same distance and even more when distance is factored in, it might be helpful make few clearly defined areas so to lessen the risk of confusing the program.

Exercise 2

Goal:

Log sound data by use of a data logger and identify sound patterns.  

Plan:

Implement a data logger. Record clapping sounds a different distances. Graph the data.  

Results:


Graph a sound data from claps with a distance of 1m:
*
Graph of claps at 100cm distance






Graph a sound data from claps with a distance of 2m:
*
Graph of claps at 200cm distance



Graph a sound data from claps with a distance of 1m:
*
Graph of claps at 300cm distance




Conclusion:

In a silent environment the claps are easily detectable as shown by the spikes in the  graphs above. The distance does not seem to affect the volume of the clap. Probably because the environment was confined.  Successful Claps seem to register a volume level between 50 and 90%.

Exercise 3

Goal:

Examine how the SoundCtrCar.java works a describe its behavior .

Plan:

Install the program on the system and place the system is a silent environment. Observe how the system reacts to claps.

Results:

The 1st clap starts the system.
The 2nd clap makes the system turn right.
The 3rd clap makes the system turn left.
The 4th Clap makes the system stop.



Exercise 4

Goal:

To make the system stop when the escape button is pressed.

Plan:

Modify the code and test if it works as intended, repeat until goal is reached.   

Results:




Conclusion:

By inserting the highlighted sentence into the the while loop the system will stop when the escape button is pressed.

Exercise 5

Goal:

Make the system only react to claps and not loud noise.

Plan:

Implement the method described by Sivan Toledo that detects claps. Adjust the values for clap detection by using the measurements in exercise 2. Test if the system only reacts correctly.

Results:

Conclusion:

By tuning the algorithm using the data from exercise 2 the system almost always register a clap, and never register a continuous loud noise.

Exercise 6

Goal:

Construct  a system that turn towards the side which the highest noise is detected

Plan:

First we want to calibrate the two sound sensors, to detect if there is any difference between the them, by measuring the same sound at the same distance, if necessary make adjustments in the code. Next implement code that detects which sensor registers the highest value makes the system turn towards that side.

Results:

Sensor
Distance  cm
volume %
Right
30
11
Left
30
11

Link to code [1]
Link to partyfinder video[2]

Conclusion:

The sound sensors did not need calibration as they detect the same values. The System can turn towards the side where the sound is loudest, however the system does turn left slower then it turns right, seem to be a problem with than motors not being of equal strength. The sound source have to relatively close to the sensor inorder for the system to detect the correct side    

References:
[1] Code Reference ClapCounter https://github.com/banditlev/ClapCounter.git
[2] Video of party finder: https://vimeo.com/87578671
[3] Exercises http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson3.dir/Lesson.html

fredag den 14. februar 2014

Date: 14/02 - 2014
Duration of activity: 6hrs and 30min
Group members participating: Aleanxer Rasmussen 20106538 and Søren Ditlev 20116323

Exercise 1

Goal
To measure if there is a difference between actual distance and the ultrasonic detected  distance.

Plan
Measuring distance to object different at distance and using various object with different surfaces to see how the surface of an object influence and the distance to an object  affect the USW’s ability to detected the correct distance  

Result
Sample 300ms


Surface
MeasuredDist
SonicDistance
Straight
30cm
31cm
Straight
90cm
92cm
Corner
31cm
31cm
Corner
60cm
40cm
Concaved
60cm
255cm/max

Conclusion
The system is accurate within an error margin of a few cm when the object which it measures its distance to is a flat surface.
If the object becomes more complex the system will fail to detect the correct distances especially at larger distances.

Exercise 2

Goal
To see if different sample intervals will affect the distance measured by the USW sensor

Plan
Gradually increasing sample rate while making a few measurements at each sample rate.  

Result
Sample 100ms


Surface
MeasuredDist
SonicDistance
Straight
50cm
52cm
Straight
30cm
31cm



Sample 10ms


Surface
MeasuredDist
SonicDistance
Straight
10cm
15cm
Straight
30cm
31cm
Straight
50cm
53cm



Sample 1ms


Surface
MeasuredDist
SonicDistance
Straight
10cm
15-21cm
Straight
30cm
22cm
Straight
50cm
51cm

Conclusion
As evident by the table above the system will begin to fail detecting the right distance at very high sampling rate. Sample rate at 1ms gives errors at short distances to the object.

Exercise 3

Goal
To detect the maximum distance at which  the USW sensor is able to detect an object and afterwards calculate the time whic it take for the SW to travel that distance.

Plan
Place the system at 254cm form a wall and slowly move the system forward until it detects the wall. When the max distance is detect use mathematics to calculate max travel time.  

Result

Max distance

At 254cm the system was unable to detect the object. Slowly moving the system forward, it was found that the system able to detect the object at a distance of 180cm. everything above showed 255.  

Update  

The max distance of USW sensor can detect is 180 cm. The sound has to travel that distance twice, forth and back, which is 360cm or 3,6m. Sound travels at a speed of 340.29 ms.  
Conclusion  
It takes approximately 10ms to travel max distance. The update rate should not limit the system as long as it above the limit of 10ms and since we operate at update rate of 300ms the update rate is not a factor.

Exercise 4


Goal
To observe the systems behaviour and describe it . Following change variable and see how the system reacts.

Plan
Step 1: Place the system on the floor and observe. Step 2: change variables and repeat step 1

Results

Initial system test

The system will accelerate until it detects an object  at distance > 120cm. After this detection the  system  decelerate. The system will start to back when it reaches a distance < 34cm and start to move forward when the distance > 36cm.

Changing variable

If minPower is decreased to 30 the system stops before the it reaches the target distance, and stands completely still at distance of 42cm.
(the reason it stops completely is possibly because there is not enough power to start moce

If minPower is increased to 80 the system will overshoot it target distance and start to oscillate between 25cm and 43cm.    

Conclusions
The no object variable will ensure that the system runs at max power when if it fails to detect and object.. This explain why we saw a deceleration in the initial test, the system began to detect an object 120cm distance and thus slowed down and fits fairly well with the max detection found in exercise 3 .    

The program is a P controller since it only uses proportional calculations to control the system.

Exercise 5

Goal
Construct a PID  controller what that would allow the system to  stop completely at a distance of 35cm.

Plan
Used the pseudo code provided in the exercise to create a PID algorithm, then following table to change the values of kp, ki kd

Result
With the following values the system would stop completely at distance 32cm  

kp 1.3
ki  0.02
kd 1

Conclusion
We were not able to detect the right kp, ki, kd values to hit the target spot of 35cm. However 32 is reasonably close

Exercise 6

Goal
Goal to make a system that uses the USW sensor follow a  wall
Plan
Translate the wallFollower NQC code made by Philippe Hurbain[1], into java[2] and testhow well the algorithm behaves.

Results
To make the algorithm work we had to make subtle changes to the algorithm, first off we changed the distance values so that they were consistent with the output in centimeters that we got from the the nxt sensor.
Also instead of setting motors to full speed forward in each loop, we set the left motor to forward and adjusted speed of right motor to turn left, and did it the other way around for left turning.   



A video of the wallFollower working can be found on vimeo[3].

Conclusion
We are able to construct a Wallflowing system that could follow a straight wall. However if the system is not aligned with the wall to begin with it was unable to drive straight forward until it located a wall, instead it would just turn in place.     

[1] Philippe Hurbain, WallFollower