... | ... | @@ -18,26 +18,33 @@ Camilla will write the code, Emil will take notes, and Ida and Nicolai will be i |
|
|
|
|
|
## Results
|
|
|
### Rebuilding the robot
|
|
|
We used the picture of an augmented robot, provided in the lesson plan, as a guide for our rebuild.
|
|
|
We rebuilt the robot to use four sensors, of which the two touch sensors were placed on a bumper on the robot's front. We used the picture of an augmented robot, provided in the lesson plan, as a guide for our rebuild.
|
|
|
|
|
|
![rebuilt robot](https://gitlab.au.dk/LEGO/lego-kode/raw/master/week9/img/TODO.PNG)
|
|
|
*Figure 1: The robot, refittet with two touch sensors, one light sensor, and one ultrasonic sensor:
|
|
|
*Figure 1: The robot, refitted with two touch sensors, one light sensor, and one ultrasonic sensor:
|
|
|
|
|
|
### Running the program implementing the avoid behaviour
|
|
|
Figure 2 shows a diagram, representing the robot's overall behaviour when running the provided ***AvoidFigure9_3.java***.
|
|
|
### Observing the avoid behaviour
|
|
|
We were provided with the program ***AvoidFigure9_3.java*** which implements a behaviour that tries to avoid obstacles using the ultrasonic sensor. Figure 2 shows a diagram, representing the robot's overall behaviour when running it. We ran the program in order to observe the resulting conduct of the robot.
|
|
|
|
|
|
![the avoid behaviour](https://gitlab.au.dk/LEGO/lego-kode/raw/master/week9/img/fig93.PNG)
|
|
|
*Figure 2: Diagram of the avoid behaviour. The image is taken from [2, Figure 9.3].*
|
|
|
|
|
|
The program worked quite well. It avoided small obstacles put in it's vision, and even when it reached a corner, it seemed like it tried to find a way around the obstacle by looking 'increasingly much' to either side. When we looked into the code of the program, we saw that this was partially correct, since it did exactly that, but only with increasingly looking more to the left. TODO video of avoid program + description - EMIL
|
|
|
The program worked quite well. The robot succesfully avoided obstacles registered by the ultrasonic sensor, and when approaching a corner it seemed like the robot was attempting to find a way around the obstacle by scanning from side to side by turning its body, increasing the angle for left-turns with each try. When we looked into the program code, we saw that this observation is correct albeit a little too specific: the robot increases its turn angle in the direction where it measures the largest distance to any obstacles - i.e. it will not necessarily be the angle for left-turns that is increased. Video 1 shows the robot avoiding different obstacles [TODO: grundigere beskrivelse]
|
|
|
|
|
|
#### Changing the program
|
|
|
We tried changing the program by making the robot drive backwards a little when encountering an obstacle and then spin around 180 degrees (by making one motor drive forward and the other driving backwards). Initially we made it spin for 1 second (1000ms), which wasn't enough, but when we changed it to 2 seconds (2000ms) it spun approximately 180 degrees. TODO: video description
|
|
|
![robot running avoid behaviour](TODO)
|
|
|
*Video 1: The robot running AvoidFigure9_3.java, implementing the avoid behaviour*
|
|
|
|
|
|
[![TODO: video of improved avoid program]()]()
|
|
|
*Video 1: TODO*
|
|
|
|
|
|
### Behavior from figure 9.9
|
|
|
#### Incorpoating a 180 degree escape turn
|
|
|
We tried modifying *AvoidFigure9_3.java* to make the robot perform a 180 degree turn when encountering a corner (i.e. when both the front distance and the side distance are below the threshold value).
|
|
|
|
|
|
We tried changing the program by making the robot drive backwards a little when encountering an obstacle and then spin around 180 degrees (by making one motor drive forward and the other drive backwards). Initially we made the robot perform the 180 turn for 1 second (1000ms), which wasn't enough, but when we changed it to 2 seconds (2000ms) it spun approximately 180 degrees. TODO: video description
|
|
|
|
|
|
![Improved avoid behaviour](TODO)
|
|
|
*Video 2: The robot performing a 180 degree turn when encountering a corner (approximately TODO seconds in)*
|
|
|
|
|
|
|
|
|
### Behaviour from figure 9.9
|
|
|
The car stopped and looked around every time it was bothered by either an obstacle or light. It was hard to distinguish whether it reacted due to light or an obstacle. TODO video of avoid program + description - EMIL
|
|
|
|
|
|
Only:
|
... | ... | |