Tuesday, September 14, 2010

Lab Exercise 2

Date:
9/9 2010

Duration of activity:
3 hours

Group members participating:
Lasse & Christian

Goals:
Get to know the ultra sonic sensor by using different test setups and programs.

Plan:
1. Mount ultrasonic sensor on the Lego car built in Lab Exercise 1.
2. Do experiments with the ultrasonic sensor itself
3. Test the sensor for which distances it can measure
4. Test a TrackBeam program and analyse its behaviour.
5. Test a WallFollower program and follow an algorithm with different modifications.

Results:

1.We mounted the Ultrasonic sensor on the Lego car and compiled and uploaded the SonicSensorTest.java program without any problems.

2. We tried to modify the sampling frequency below 300 ms (default). Already at a sampling rate of 200 ms there was a noticeable difference in the update of sensor values. At 100 ms (and below) it was hard to see a noticeable difference compared to the 200 ms. This concludes that there is still a need for delay between readings but not as high as 300 ms.

3. We wanted to find the measuring limits of the sensor. To test the measurement limit of the sensor we tried measuring the maximum distance to different materials as shown in the table below.



In theory the sensor has a maximum reading limit of 254 cm. A return value of 255 means that no object has been detected. Since the speed of sound is 340.29 m/s a detection of a "no object" requires a minimum delay of 7,5 ms since objects within 255 cm will echo before this.



4. The Tracker program makes sure that the robot keeps a certain distance to objects in front of it.

We the sampling rate from 300 ms to 100 ms an observed obviouslly a faster correction rate from the robot. We lowered the delay to 10 ms and noticed an even faster correction rate. See videos below.

 300 ms

100 ms

10 ms


Other modifiable variables are:

  • Gain: proportial factor adjusting the power to the motor dependant on the distance to object. Small changes in distance yield high speed changes.
  • Minimum power: The minimum power necessary to drive the motors. Values below 60 (default) means that the car halts when the accumulated power does not exceed 60. This means that the car does not move distance error is near 0. Values above 60 means more aggressive speed variations. See video below for a value of 100.
     
Minimum power = 100
The control method is called a closed loop controller or feedback controller since the controller uses the error (difference) between reference and input to change output. Since we only have one input and output the system is called a SISO (Single Input Single Output) control system.

5. We translated the NQC program written by Philippe Hurbain to Java code. We didn't have time to test the threshold values properly, so we did not get the correct WallFollower-behavior from the car.

Conclusion

Experiments with different setups for the ultrasonic sensor has shown some of its properties. The distance the sensor is capable of measuring depends on the material which reflects the sound pulses. The less pulses scattered or absorbed the better reading distance. We also calculated that the time it takes for the pulses to return to the ultrasonic sensor is below 7.5 ms. We also showed that by adjusting different parameters in programs using the ultrasonic sensor both desirable and non-desirable behaviour can be achieved :-)

References

Exercise 2 description:
http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson2.dir/Lesson.html