... | @@ -99,7 +99,9 @@ The software for the sumo wrestler LEGO car is build upon the dynamic behavioral |
... | @@ -99,7 +99,9 @@ The software for the sumo wrestler LEGO car is build upon the dynamic behavioral |
|
|
|
|
|
![Overview of the behavioral control](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson9/Images/BehavioralControl.jpg)
|
|
![Overview of the behavioral control](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson9/Images/BehavioralControl.jpg)
|
|
|
|
|
|
The most important behavior is "StayInRing". According to the rules of the battle one will loose if the LEGO car drives or gets pushed off the battle area (outside the white border). In order to make the light sensors able to trigger the StayInRing behavior at any time, the priority of this is set to highest possible value. The program is made so that a calibration is required before the actual program is initiated. This copes with variations in the lighting and power level of the NXT. The threshold between black and white is determined using a weighted difference between the two calibration values as seen in the following code snippet.
|
|
The most important behavior is "StayInRing". According to the rules of the battle one will loose if the LEGO car drives or gets pushed off the battle area (outside the white border). In order to make the light sensor able to trigger the "StayInRing" behavior at any time, the priority of this is set to highest possible value. Even though the dynamic behavioral paradigm is used there will be no priority changes and the statical hierarchy shown in the previous figure will be kept during the lifetime of the program.
|
|
|
|
|
|
|
|
The program is made so that a calibration is required before the actual program is initiated. This copes with variations in the lighting and power level of the NXT. The threshold between black and white is determined using a weighted difference between the two calibration values as seen in the following code snippet.
|
|
|
|
|
|
```java
|
|
```java
|
|
final float alpha = 0.7f;
|
|
final float alpha = 0.7f;
|
... | | ... | |