... | ... | @@ -93,6 +93,12 @@ 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.
|
|
|
|
|
|
## Escape behavior
|
|
|
|
|
|
### Setup
|
|
|
|
|
|
### Results
|
|
|
|
|
|
## Light turning motor
|
|
|
|
|
|
### Setup
|
... | ... | @@ -142,8 +148,6 @@ This will ensure that the behaviors with the highest priority will drive the act |
|
|
The *Prioritizing Algorithm* by Fred Martin is written in C and implements the same functionality as the *SharedCar* and *Arbiter* classes. The differences is that in Fred Martins code, forward, backward and stop is controlled by the motor power. That is, forward is a positive value, backward is a negative value and stop is zero. In the *SharedCar* the direction must be set explicitly.
|
|
|
In Fred Martins code, arrays are preallocated to be able to contain ten processes, whereas in the *Arbiter* an arbitrary number of processes can be added runtime.
|
|
|
|
|
|
|
|
|
|
|
|
## Conclusion
|
|
|
|
|
|
|
... | ... | |