... | ... | @@ -89,18 +89,30 @@ The suppressed functionality has also been implemented so that the behavior can |
|
|
|
|
|
### Physical setup
|
|
|
|
|
|
In order to win a sumo battle an offense and a defense strategy needs to be determined. The initial idea for the offense strategy is to use place a shovel in front of the LEGO car which goal is to lift the opposing LEGO car and thereby remove its control abilities. By placing a sonar sensor in front of the car it should be able localize the opponent and drive towards it.
|
|
|
The defense strategy involves keeping the LEGO car inside the ring. For this a light sensor is used that can distinguish between the black battle area and the white border. Whenever a border is detected the car will back up and make a turn.
|
|
|
In order to win a sumo battle an offense and a defense strategy needs to be determined. The initial idea for the offense strategy is to place a shovel in front of the LEGO car which goal is to lift the opposing LEGO car and thereby remove its control abilities. By combining the shovel with a sonar sensor the car should be able localize the opponent and drive towards it. The defense strategy involves keeping the LEGO car inside the ring. For this a light sensor is used that can distinguish between the black battle area and the white border. Whenever the border is detected the car will back up and make a turn.
|
|
|
|
|
|
[INDÆST BILLEDE: original setup]
|
|
|
|
|
|
### Software setup
|
|
|
|
|
|
[INDÆST BESKRIVELSE]
|
|
|
The software for the sumo wrestler LEGO car is build upon the dynamic behavioral control paradigm. Three behaviors are used in this setup as illustrated in the following figure.
|
|
|
|
|
|
![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.
|
|
|
|
|
|
```java
|
|
|
final float alpha = 0.7f;
|
|
|
threshold = (int) (blackLight * (1-alpha) + whiteLight*alpha);
|
|
|
```
|
|
|
|
|
|
Whenever the LEGO car is not on the border the sonar sensor is able to trigger the "Destroy" behavior if an opponent is detected in front. If the opponent is not in front of the LEGO car it will initiate the default behavior "Search". Randomness ensures that the LEGO car will search after the opponent in a random manner by both turning and driving forward. All behaviors and how they are triggered in the battle area is illustrated in the following figure.
|
|
|
|
|
|
![How the behaviors are triggered in the battle area](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson9/Images/BehavioralControlOnTrack.jpg)
|
|
|
|
|
|
### Results
|
|
|
|
|
|
[INDÆST BESKRIVELSE]
|
|
|
[INDSÆT BESKRIVELSE]
|
|
|
|
|
|
## Iterations
|
|
|
|
... | ... | @@ -108,23 +120,30 @@ In order to improve the performance of the sumo wrestler LEGO car a number of it |
|
|
|
|
|
### Secured shovel
|
|
|
|
|
|
We quickly realized that the shovel in front of the car was too poorly attached to the LEGO car. During a couple of test battles the opponent was able to detach the shovel and thereby destroying the offense strategy. By using several bricks the shovel is secured to the body of the car as shown in following image. The weight of the LEGO car is verified using a standard kitchen weight.
|
|
|
We quickly realized that the shovel in front of the car was too poorly attached to the LEGO car. During a couple of test battles the opponent was able to detach the shovel and thereby destroying the offense strategy. By using several bricks the shovel is secured to the body of the car, as shown in following image.
|
|
|
|
|
|
![Secured shovel to avoid it falling off during a battle](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson9/Images/SecuredShovel.jpg)
|
|
|
|
|
|
### Added randomness
|
|
|
Tilføjet randomness, for at variere search (Lejos random stinker)
|
|
|
|
|
|
[INDSÆT BESKRIVELSE]
|
|
|
|
|
|
### Added weight
|
|
|
The weight limit is determined in the rules to be 1 kg. It is estimated that it will be beneficial to reach this limit in order to make it harder for the opponent to push our LEGO car off the battle area. A simple weight block is build using relatively heavy lead bricks as shown in the following image.
|
|
|
|
|
|
The weight limit is determined in the rules to be 1 kg. It is estimated that it will be beneficial to reach this limit in order to make it harder for the opponent to push our LEGO car off the battle area. A simple weight block is build using relatively heavy lead bricks as shown in the following image. The weight of the LEGO car is verified using a standard kitchen weight.
|
|
|
|
|
|
![Weight is added to make the car harder to push of the battle area](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson9/Images/ExtraWeight.jpg)
|
|
|
|
|
|
By setting up a few test battles it is confirmed that it is harder to pushed the LEGO car of the battle area with the weight increase applied. However a new problem arose. Since the LEGO car only have one light sensor attached in right side it has trouble staying in the ring when approaching the border from the left.
|
|
|
|
|
|
### Extra light sensor
|
|
|
-> Extra lys sensor, da bilen kunne køre ud over banen i den ene side
|
|
|
|
|
|
Since there are free sensor inputs available on the NXT, an easy fix is just to add another light sensor and thereby obtain symmetry in the construction. The setup is seen in the following image.
|
|
|
|
|
|
![An extra light is added to cope with problems about approaching the border of the battle area.](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson9/Images/ExtraLightSensor.jpg)
|
|
|
|
|
|
With the additional light sensor the LEGO is able to stop, back up and turn no matter which side the border is approached from.
|
|
|
|
|
|
## Conclusion
|
|
|
|
|
|
|
... | ... | |