... | ... | @@ -34,9 +34,21 @@ In order to cope with this a small fix is implemented. Whenever the all the dist |
|
|
|
|
|
### Setup
|
|
|
|
|
|
The setup is the same as described in the "Setup" section for the exercise "Single behavior - Avoid".
|
|
|
The model used in this exercise is based on the model as described in the "Setup" section for the exercise "Single behavior - Avoid". The model was extended with a by adding a horizontal motor which rotates a light sensor. For the first part of this exercise, the fixed mounted light sensor was used.
|
|
|
|
|
|
#### Triggerig conditions and behavioir implementation
|
|
|
![Setup for the concurrent behaviors test](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson7/Images/concurrentBehaviorSetup.jpg)
|
|
|
|
|
|
### Results
|
|
|
|
|
|
The behavior of the vehicle without any modifications was captured and can be seen in the video [Concurrent behaviors]. The car was initialized as shown on the picture in the "Setup" section.
|
|
|
|
|
|
The first part of the video shows the robot cruising, this is triggered because both "Avoid" and "Follow" behavior is inactive. "Follow" is inactive because the light level is lower than the value used for initialization, although the initialization look darker, we think the maybe due to the light from the floodlight being reflected by the white wall. "Cruise" is inactive because there is no obstacles directly in front of the robot.
|
|
|
|
|
|
The second part of the video (00:13 in) shows the robot avoiding a wall using the avoid behavior, triggered by the wall being too close. After the wall has been avoided, the robot reverts to cruising until it reaches a the door where it is lighter, triggering the "Follow" behavior. This goes on, until it reaches another obstacle (a foot), which triggers the "Avoid" behavior. Finally the robot reaches a corner triggering the "Avoid" behavior, which (unsuccessfully) attempts to avoid said corner.
|
|
|
|
|
|
We observed the robot with only the `Cruise` thread active - this causes the robot to cruise indefinitly, not following light, or avoiding obstacles. With only `Cruise` and `Follow` active, the robot followed light, but would not attempt to avoid obstacles.
|
|
|
|
|
|
#### Triggering conditions and behavior implementation
|
|
|
|
|
|
**Cruise**
|
|
|
|
... | ... | @@ -52,9 +64,6 @@ If the condition is met, the light to the left and right sides of the car is mea |
|
|
|
|
|
The trigger condition for the `Avoid` class is that the `frontDistance`, which is measured continuously, becomes less than the `stopThreshold` which is set to 30. If the trigger condition is met, the car will stop, turn left and measure distance, turn right and measure distance and finally proceed in the direction with the largest distance. Even though the implementation does not consider the scenario where both the `leftDistance` and `rightDistance` equal 255, like in the case of the single narrow obstacle, since the car does not return from having measured the distance to the right, it will process in the right direction.
|
|
|
|
|
|
### Results
|
|
|
|
|
|
|
|
|
## Escape behavior
|
|
|
|
|
|
### Setup
|
... | ... | |