... | ... | @@ -40,8 +40,8 @@ After activating the touch sensor the robot starts reversing. It stays in revers |
|
|
[![image alt text](http://img.youtube.com/vi/ZHFlJe0Ao6c/0.jpg)](http://www.youtube.com/watch?v=ZHFlJe0Ao6c)
|
|
|
|
|
|
##### Fig. 2: The robot drives along a table. Once the touch sensors are activated the robot goes in reverse.
|
|
|
|
|
|
>
|
|
|
|
|
|
If the touch sensor is pressed, the takeControl() method returns a value of 100 (see fig 3) which initiates the prioritised action() behavior. Once initiated, the boolean value ‘active’ is set to true and the priority value is set to 50. This means that if the touch sensor is pressed while the action() is still running the method will start over due to the higher priority.
|
|
|
|
|
|
```
|
... | ... | @@ -58,6 +58,9 @@ If the touch sensor is pressed, the takeControl() method returns a value of 100 |
|
|
##### Fig. 3: takeControl() method. Shows how different values are returned according to sensor values and if the methods is ‘active’.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
// Find behavior with highest priority
|
|
|
maxPriority = -1; highest = -1;
|
... | ... | |