... | ... | @@ -16,12 +16,19 @@ The goal of this exercise is to do experiments with the behavior control paradig |
|
|
|
|
|
The plan is to follow the instructions for Lesson 7 [1].
|
|
|
|
|
|
## Avoid behavior
|
|
|
## Single behavior - Avoid
|
|
|
|
|
|
### Setup
|
|
|
|
|
|
In this test the Lego car is mounted with two large wheels on the motors and a small wheel is mounted in the back of the car in order to stabilize the construction. 4 sensors is attached which is an ultrasonic sensor, a light sensor and two touch sensors. The two touch sensors are connected with a brick to make a bumper in front of the car. The construction is seen in the following image.
|
|
|
|
|
|
![Lego car construction for the single behavior software implementation](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson7/Images/SingleBehaviorSetup.JPG)
|
|
|
|
|
|
### Results
|
|
|
|
|
|
By running the program provided the car acts as expected where it drives forward until the distance to an obstacle gets below the stop threshold. Afterwards by turning first to the left, then to the right and in both cases measuring the distance to the obstacle in front it determines in which direction the distance to the obstacle is largest and drives in that direction. The problem is that when the car approaches a corner the structure of the program makes it drive further and further into the corner until all distances (front, left and right) is below the stop threshold. In this situation the car stops and is stuck in the corner. This scenario is shown in the video "Single behavior" in the references section.
|
|
|
|
|
|
In order to cope with this a small fix is implemented. Whenever the all the distances is below the stop threshold the car drives backwards a performs a 180 degree turn. This scenario is shown in the video "Single behavior modified" in the references section.
|
|
|
|
|
|
## Concurrent behaviors
|
|
|
|
... | ... | @@ -67,4 +74,6 @@ In Fred Martins code, arrays are preallocated to be able to contain ten processe |
|
|
|
|
|
### Videos
|
|
|
|
|
|
[Single behavior] - http://youtu.be/iFmBLXIuRiE
|
|
|
[Single behavior modified] - http://youtu.be/Xvs0y3kdMeA
|
|
|
|