... | ... | @@ -25,7 +25,7 @@ A sound sensor is mounted in the front of the car pointing forward. The final co |
|
|
|
|
|
![Vehicle 1](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson6/Images/Vehicle1.JPG)
|
|
|
|
|
|
Three implementations will be tested
|
|
|
Three cases will be tested
|
|
|
|
|
|
* **Excitatory** setup with motor power going from 0 to 100
|
|
|
* **Inhibitory** setup with motor power going from 0 to 100
|
... | ... | @@ -93,7 +93,7 @@ The motor power range is now 200 which yields a conversion factor of |
|
|
|
|
|
*conversion factor = 200/1023 = 0.196*
|
|
|
|
|
|
To introduce negative motor power 100 is subtracted from the calculated output
|
|
|
To introduce negative motor power a value of 100 is subtracted from the calculated output
|
|
|
|
|
|
*power = (sound level * 0.196) - 100*
|
|
|
|
... | ... | @@ -110,16 +110,21 @@ static int calcOutput(int soundLvl) |
|
|
|
|
|
### Results
|
|
|
|
|
|
A video showing the result of each case is found in the references section with an explanation given in the following.
|
|
|
|
|
|
**Excitatory** (0 to 100)
|
|
|
|
|
|
The result of the Excitatory setup is seen in the video in the references section. This video shows the initial test setup where the car is turned upside down and placed on a table. Next to the sound sensor a mobile phone is placed with the loudspeaker pointing towards the sound sensor of the lego car. The mobile phone is playing a piece of music and the louder the music gets the faster the wheels spin which is as we expected.
|
|
|
The initial test setup is where the car is turned upside down and placed on a table. Next to the sound sensor a mobile phone is placed with the loudspeaker pointing towards the sound sensor. The mobile phone is playing a piece of music and the louder the music gets the faster the wheels spin which is as we expected.
|
|
|
|
|
|
**Inhibitory** (0 to 100)
|
|
|
|
|
|
The result of the Excitatory setup is seen in the video in the references section. This video
|
|
|
The test setup from the excitatory case is used again here where it is seen that the cars behavior is just the opposite as with the excitatory setup. As the music gets louder the speed of the wheels decrease just as expected. Due to the friction in the motor the wheels stop spinning even though the maximum sound level is not reached.
|
|
|
|
|
|
**Negative motor power** (-100 to 100)
|
|
|
|
|
|
The test setup is changed in this case to inspect the "dancing" of the car. The car is placed on a table and a mobile phone playing music is held closes to the sound sensor. Whenever the music gets loud (sound level > 512) the car drives forward and at low sounds (sound level < 512) the car drives backwards. By adjusting the distances of the phone to the sound sensor we can somewhat get the car to "dance".
|
|
|
|
|
|
|
|
|
## Vehicle 2
|
|
|
|
|
|
### Setup
|
... | ... | @@ -145,60 +150,55 @@ static int calcDirectOutput(int lightLvl) |
|
|
}
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### Results
|
|
|
The result of the two vehicles 2a and 2b in excitatory mode is seen in the videos in the references section. Here it is clearly shown that vehicle 2a drives towards the darkness, whereas vehicle 2b drives towards the light, just as expected.
|
|
|
|
|
|
|
|
|
|
|
|
## Vehicle 3
|
|
|
|
|
|
### Setup
|
|
|
|
|
|
The setup for this exercise was based on Braitenberg vehicles 3, with two different kinds of sensor as seen in the picture below.
|
|
|
THe vehicle is fitted with light sensors as in the previous exercise, and ultrasonic sensors on the far left and right hand side of the front of the vehicle.
|
|
|
The setup for this exercise was based on Braitenberg vehicles 3, with two different kinds of sensors as seen in the picture below.
|
|
|
The vehicle is fitted with light sensors as in the previous exercise, and ultrasonic sensors on the far left and right hand side of the front of the vehicle.
|
|
|
|
|
|
![Vehicle 3](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson6/Images/Vehicle3.JPG)
|
|
|
|
|
|
The purpose of this exercise was to combine readings from both kinds of sensor when determining the motor power values.
|
|
|
However this proved a challenge as it was difficult to balance the values enough to achieve a deterministic behavior of the vehicle.
|
|
|
We tried exitatory connections, inhibitory connections and combinations, however we were not satisfied with the behavior of any of them.
|
|
|
We tried excitatory connections, inhibitory connections and combinations, however we were not satisfied with the behavior of any of them.
|
|
|
|
|
|
A different approach was to have an exitatory connection of the light sensors, making the vehicle steer towards the light, whilst having an overriding mechanism from the ultra sonic sensors which prevented the vehicle from getting to close to an objects regardless of the light sensor input.
|
|
|
A different approach was to have an excitatory connection of the light sensors, making the vehicle steer towards the light, whilst having an overriding mechanism from the ultra-sonic sensors which prevented the vehicle from getting to close to an objects regardless of the light sensor input.
|
|
|
This is shown in the code snippet below:
|
|
|
|
|
|
```java
|
|
|
...
|
|
|
int rightPower = llight;
|
|
|
int leftPower = rlight;
|
|
|
|
|
|
if(rdist < 20)
|
|
|
leftPower = leftPower/2;
|
|
|
if(ldist < 20)
|
|
|
rightPower = rightPower/2;
|
|
|
|
|
|
Car.forward(leftPower, rightPower);
|
|
|
int rightPower = llight;
|
|
|
int leftPower = rlight;
|
|
|
|
|
|
if(rdist < 20)
|
|
|
leftPower = leftPower/2;
|
|
|
if(ldist < 20)
|
|
|
rightPower = rightPower/2;
|
|
|
|
|
|
Car.forward(leftPower, rightPower);
|
|
|
...
|
|
|
```
|
|
|
|
|
|
If the reading form the ultra sonic sensor drops below 20, which has been normalized from 0-100, the opposing wheel will have it power cut in half making the vehicle turn away from the object close to the ultra sonic sensor.
|
|
|
Thereby the vehicle has a prioritized control algorithm, that will steer towards the light as long as the higher priority distance measurement does not go below the threshold.
|
|
|
|
|
|
If the reading form the ultra-sonic sensor drops below 20, which has been normalized from 0-100, the opposing wheel will have its power cut in half making the vehicle turn away from the object close to the ultra-sonic sensor.
|
|
|
Thereby the vehicle has a prioritized control algorithm, which will steer towards the light as long as the higher priority distance measurement does not go below the threshold.
|
|
|
|
|
|
### Results
|
|
|
|
|
|
The control approach was tested in a dark room with a hand held light used to attract the vehicle.
|
|
|
A hand was placed in front of the ultrasonic sensor in order to trigger the higher priority control and steer the vehicle away from the obstacle.
|
|
|
The vehicle was able to steer towards the light and avoid the obstacle by changing course when the hand was placed in front of the ultra sonic sensor.
|
|
|
|
|
|
Finally an obstacle was placed in front of both ultra sonic sensors which made the car stop, as expected.
|
|
|
This is seen in the video for vehicle 3 in the references.
|
|
|
The vehicle was able to steer towards the light and avoid the obstacle by changing course when the hand was placed in front of the ultra-sonic sensor.
|
|
|
|
|
|
Finally an obstacle was placed in front of both ultra-sonic sensors which made the car stop, as expected.
|
|
|
This is seen in the video for vehicle 3 in the references.
|
|
|
|
|
|
## Conclusion
|
|
|
|
|
|
|
|
|
|
|
|
## References
|
|
|
|
|
|
[1] http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson6.dir/Lesson.html
|
... | ... | @@ -211,5 +211,6 @@ This is seen in the video for vehicle 3 in the references. |
|
|
|
|
|
[Vehicle 2a] - http://youtu.be/GxheAQWwvLs
|
|
|
[Vehicle 2b] - http://youtu.be/toa2pd02Qq4
|
|
|
|
|
|
[Vehicle 3] - https://www.youtube.com/watch?v=Ys6YdiNbyQE
|
|
|
|