... | ... | @@ -22,7 +22,7 @@ The plan is to follow the instructions for Lesson 7 [1]. |
|
|
|
|
|
In this test the Lego car is mounted with two large wheels on the motors and a small wheel is mounted in the back of the car in order to stabilize the construction. 4 sensors is attached which is an ultrasonic sensor, a light sensor and two touch sensors. The two touch sensors are connected with a brick to make a bumper in front of the car. The construction is seen in the following image.
|
|
|
|
|
|
![Lego car construction for the single behavior software implementation](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson7/Images/SingleBehaviorSetup.JPG)
|
|
|
![Lego car construction for the single behavior software implementationn](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson7/Images/SingleBehaviorSetup.JPG)
|
|
|
|
|
|
### Results
|
|
|
|
... | ... | @@ -75,7 +75,7 @@ The first part of the video shows the robot cruising, this is triggered because |
|
|
|
|
|
The second part of the video (00:13 in) shows the robot avoiding a wall using the avoid behavior, triggered by the wall being too close. After the wall has been avoided, the robot reverts to cruising until it reaches a the door where it is lighter, triggering the "Follow" behavior. This goes on, until it reaches another obstacle (a foot), which triggers the "Avoid" behavior. Finally the robot reaches a corner triggering the "Avoid" behavior, which (unsuccessfully) attempts to avoid said corner.
|
|
|
|
|
|
We observed the robot with only the `Cruise` thread active - this causes the robot to cruise indefinitly, not following light, or avoiding obstacles. With only `Cruise` and `Follow` active, the robot followed light, but would not attempt to avoid obstacles.
|
|
|
We observed the robot with only the `Cruise` thread active - this causes the robot to cruise indefinitely, not following light, or avoiding obstacles. With only `Cruise` and `Follow` active, the robot followed light, but would not attempt to avoid obstacles.
|
|
|
|
|
|
#### Triggering conditions and behavior implementation
|
|
|
|
... | ... | @@ -97,7 +97,7 @@ The trigger condition for the `Avoid` class is that the `frontDistance`, which i |
|
|
|
|
|
### Setup
|
|
|
|
|
|
The *Escape* behavior was implemented in java based on the IC description given in [4]. Note that the bumper on the back is not used in our design, since we did not have enough available sensor ports on the NXT.
|
|
|
The *Escape* behavior was implemented in Java based on the IC description given in [4]. Note that the bumper on the back is not used in our design, since we did not have enough available sensor ports on the NXT.
|
|
|
A snippet of the main loop of the behavior is shown below.
|
|
|
The full source code can be found in [3].
|
|
|
|
... | ... | |