... | ... | @@ -38,17 +38,17 @@ In order to cope with this a small fix is implemented. Whenever the all the dist |
|
|
|
|
|
**Cruise**
|
|
|
|
|
|
The cruise class does not have a trigger condition. The cruise class drives the car forward by applying a power of 70 to both motors.
|
|
|
The `Cruise` class does not have a trigger condition. The cruise class drives the car forward by applying a power of 70 to both motors.
|
|
|
|
|
|
**Follow**
|
|
|
|
|
|
The trigger condition of the Follow class is that the `frontLight` is greater than the `lightThreshold`. The threshold value is set in the constructor, and is therefore the light value when the program is started. If the light value never reaches a value higher than the first, the Follow class will never issue a command to the car.
|
|
|
The trigger condition of the `Follow` class is that the `frontLight` is greater than the `lightThreshold`. The threshold value is set in the constructor, and is therefore the light value when the program is started. If the light value never reaches a value higher than the first, the Follow class will never issue a command to the car.
|
|
|
|
|
|
If the condition is met, the light to the left and right sides of the car is measured, and the course adjusted by a delta expression which equals the difference in the two light values. Thereby the car will make sharper turns towards the light with increasing light intensity.
|
|
|
|
|
|
**Avoid**
|
|
|
|
|
|
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.
|
|
|
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
|
|
|
|
... | ... | |