Sunday, February 16, 2014

Lab Session 2

Date: 13. february 2014
Duration of activity: 3 hours 
Group members participating: Lukas, Daniela, Helene

Goals:

  • Perform exercises from Lab Session 

Plan:
  • Mount the ultrasonic sensor on the car.
  • Run the program for lab 2, see if everything works.
  • Do exercises 1-6.

Results:

Exercise 1


In the first measurament session we measured the distances using the following set-up: 




A measuring tape was used to measure actual distances, while the distances measured by the sensor were printed to the NXT screen. 

We measured distances from three different obects: a wall, a bike helmet and a scarf. The objects were chosen in order to get some variation in the dimension, shape and material of the object to be detected by the sensor. 
All the measuraments were done for distances under 255 cm, i.e. under the declared sensor range. 

MEASURING DISTANCES FROM A WALL

We noticed that the NXT measurament and the actual distances where very close for distances greater than 20 cm. For distances smaller than 20 cm we got errors from 3 to 6 cm between the two kinds of measuramet. 

We suspected that the discrepancy in the results where due to errors in the real world measurament done with the measuring tape. We then decided to repeat the measuraments for distances under 20 cm paying more attention to the accuracy of real world measurament. We used the following set-up:





The new measuraments showed very similar distances for measuring tapes and sensor values. 




MEASURING DISTANCE FROM A BIKE HELMET
The bycicle helmet has a round and irregular surface and several holes in its surface. We wanted to see if these facts could affect the performance of the sensor, but we did't notice a significat difference between in the performance of the NXT sensor compared to the wall experiment.  



The differens between the real world measurement of 13 cm to the NXT measurement of 23 cm may be due to the fact that the helmet is round, and we there fore had trouble measuring the correct real word distance.

MEASURING DISTANCE FROM A SCARF
This measurament session gave very inaccurate results. Many times the sensor value was 255 (meaning no object in a range of 255 cm) even though the actual distance was much smaller. We argued that this result is due to the fact that the scarf often absorbs the ultrasound signals instead of reflecting them back to the sensor.


(*) The measurement switched between the given number and 255 

-----------------------------------------------------------------------------------------------------------
Exercise 2

In this experiment we measured distances from a wall, changing the sampling interval of the ultrasound sensor. 


In the first part of the experiment the distance between the sensor and the wall was kept constant to 50 cm.
We set the sample interval from 300 down to 5 millisenconds, with 10 ms intervals and the NXT measurament where all accurate. 

We then decided to increase the distance from the wall to ca. 1 m in order to see if this had an effect on the NXT measurament, but again we got very accurate NXT measuraments.


We had expected that, due to sound speed, sampling with a too short delay would make the sensor unable to measure the distance, since there would be not enough time for the reflected signal to get back to the source. Since this did't happen, we looked in the LeJos library source code, and discovered that the sensor always waits at least 30 ms between different signals are sent. So, eventhough we set our own sample interval to 1, the sensor would still wait 30 ms. This explains why we got accurate measuraments even with a very low sampling interval.


-----------------------------------------------------------------------------------------------------------------
Exercise 3

In this experiment we tried to mesure distance from a big glass picture and from a wall. 
We tried to measure a distance of 254 cm, but we observed that when the distance is bigger than ca. 230 cm, the measuraments are very difficult to gather and the sensor gives very often a value of 255. Moreover, we could not get the NXT sensor to report a value of more than 240 cm. 

The time limit for measurament is 30 ms which can be seen in the source code for LeJos. Taking this time limit and the speed of sound (340,29 m/sec) into account, we argue that the sensor, in theory, can measure objects to a maximum distance of ca. 5 meters. We got this value doing the fallowing calculations:


340,29 m/s : 10 = 34.029 cm/ms


(34.029 cm/ms * 30 ms) / 2 = 510,4 cm = 5,1 m    (meaning 5,1 m out and back to the sensor)


In practice this theoretical value is restricted according to our experiments to ca. 240 cm (a value even smaller than the declared sensor value of 255 cm).


The time limit for measuraments limits how often we can measure a distance. The maximum lenght of the distance to be measured is bounded in our case by the quality of the sensor. 


--------------------------------------------------------------------------------------------------
Exercise 4

In this experiment we placed the car in front of a wall and afterwards in front of an hand. 
We ran the program and we observed that the car tries to keep a distance of ca. 35 cm from other objects and oscillates around this distance.


Video showing our first observations: http://youtu.be/kNkIeVqSetQ

We started changing values of the gain-variable in the code and made the following observations:


gain = 0.9 -> The car moves faster towards the wall.

gain = 0.1 -> 
The car mover very slow towards the wall.

We then set the gain back to its default value and tried different values for the minPower-variable


min power= 90 -> 
The car runs very fast towards the wall. 

min power= 10 -> 
no movement

min power=30 -> 
The car moves but stops before the desired distance. Not enough power to come closer. 

min power=50 -> 
The car moves up to 45 cm from the object. 


The control is a proportional control. This can be seen in the following lines of code:


error = distance - desiredDistance;

power = (int)(gain*error);

We can see that the error is multiplied by a constant, so the power is proportional to the error.


--------------------------------------------------------------------------------------------------------------------

Exercise 5

The car oscillates when the parameters are set to the values provided with the code (gain= 0.5, min power= 60)

We implemented the differential control in the program by following the pseudocode given in the exercise (see link to source code files under references).

We started experimenting with values of gain, integralGain and derivativeGain, setting them all equal to 0.5, and the car seems to move randomly. 
We didn't have the time to experiment furhter in a systematic way, so we didn't find variables that could make the car stand still. 

-------------------------------------------------------------------------------------------------------------------
Exercise 6

We didn't have the time to make this exercise. 


Conclusion:

The NXT sensor performs quite good in measuring distances from rigid objects, but not quite as good measuring distances from soft objects such as a scarf.

The LeJos API implementation ensures that even when the custom sampling rate for the ultrasound sensor is very low, the sensor is still able to measure distances in the declared range.

The quality of the sensor is a more decisive parameter than the sampling rate in determining the limits of the NXT ultrasound sensor. The NXT ultrasound sensor does not perform very well for distances close to its declared range of 255 cm. 


References:


No comments:

Post a Comment