... | ... | @@ -156,10 +156,45 @@ The result of the two vehicles 2a and 2b in excitatory mode is seen in the video |
|
|
|
|
|
### 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.
|
|
|
|
|
|
![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.
|
|
|
|
|
|
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.
|
|
|
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);
|
|
|
...
|
|
|
```
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
### 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.
|
|
|
|
|
|
|
|
|
## Conclusion
|
|
|
|
... | ... | @@ -176,4 +211,5 @@ The result of the two vehicles 2a and 2b in excitatory mode is seen in the video |
|
|
|
|
|
[Vehicle 2a] - http://youtu.be/GxheAQWwvLs
|
|
|
[Vehicle 2b] - http://youtu.be/toa2pd02Qq4
|
|
|
[Vehicle 3] - https://www.youtube.com/watch?v=Ys6YdiNbyQE
|
|
|
|