nhaulrik created page: Lab7 authored by Nikolaj Cilleborg Haulrik's avatar Nikolaj Cilleborg Haulrik
......@@ -11,11 +11,18 @@
#### Activity duration: 5 + ...
For this exercise we mounted an ultrasonic sensor, a light sensor and a contact sensor to the LEGO car as illustrated below.
![IMG_8268](http://gitlab.au.dk/uploads/group-22/lego/a223889942/IMG_8268.jpg)
## Exercise 1: LEGO vehicle that exhibits a single behavior
#### Task: The program AvoidFigure9_3.java implements the avoid behavior with a single ultrasonic sensor. Download the program and observe the car. Describe how the car behaves.
#### Task:
The program AvoidFigure9_3.java implements the avoid behavior with a single ultrasonic sensor. Download the program and observe the car. Describe how the car behaves.
#### Plan: The program was executed without changes in the code.
#### Plan:
The program was executed without changes in the code.
#### Result:
......@@ -59,4 +66,10 @@ As seen in the video the car drives and turns in order to avoid surface contact.
}
}
```
#### Task 2:
Change the program so that the car drives backwards a little when all the three distances,leftDistance, frontDistance, and rightDistance are less than stopThreshold, and afterwards the car should spin around on the spot 180 degrees.
#### Plan
We wish to implement a behavior that handles a situation where the robot is close to a surface in the directions front, left and right and makes a u-turn and drives in the opposite direction.