... | @@ -29,16 +29,16 @@ We were provided with the program ***AvoidFigure9_3.java*** [4] which implements |
... | @@ -29,16 +29,16 @@ We were provided with the program ***AvoidFigure9_3.java*** [4] which implements |
|
![the avoid behavior](https://gitlab.au.dk/LEGO/lego-kode/raw/master/week9/img/fig93.PNG)
|
|
![the avoid behavior](https://gitlab.au.dk/LEGO/lego-kode/raw/master/week9/img/fig93.PNG)
|
|
*Figure 2: Diagram of the avoid behavior. The image is originally Figure 9.3 in [2].*
|
|
*Figure 2: Diagram of the avoid behavior. The image is originally Figure 9.3 in [2].*
|
|
|
|
|
|
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 (symbolised by Idas arm) with the avoid behavior enabled while in the end showing that the touch sensors is indeed disabled.
|
|
The program worked quite well. The robot succesfully avoided obstacles registered by the ultrasonic sensor, and when approaching a corner [TODO - 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 (symbolised by Idas arm) with the avoid behavior enabled while in the end showing that the touch sensors is indeed disabled.
|
|
|
|
|
|
[![Robot running avoid behavior](http://img.youtube.com/vi/4Xa1ZYIT-Rs/0.jpg)](https://www.youtube.com/watch?v=4Xa1ZYIT-Rs)
|
|
[![Robot running avoid behavior](http://img.youtube.com/vi/4Xa1ZYIT-Rs/0.jpg)](https://www.youtube.com/watch?v=4Xa1ZYIT-Rs)
|
|
*Video 1: The robot running AvoidFigure9_3.java, implementing the avoid behavior*
|
|
*Video 1: The robot running AvoidFigure9_3.java, implementing the avoid behavior*
|
|
|
|
|
|
|
|
|
|
#### Incorpoating a 180 degree escape turn
|
|
#### Incorpoating a 180 degree escape turn
|
|
As prescribed in the lesson plan, we modified ***AvoidFigure9_3.java*** [5] 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).
|
|
As prescribed in the lesson plan, we modified ***AvoidFigure9_3.java*** [5] to make the robot perform a 180 degree turn when both front - and side distances were below the threshold value.
|
|
|
|
|
|
We tried changing the program by making the robot drive backwards a little when encountering an obstacle, check if it was a corner 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 (1000 ms), which wasn't enough, but when we changed it to 2 seconds (2000 ms) it spun approximately 180 degrees. This behavior can be seen in video 2 where the robot turn 180 degrees when measuring a low distance in all three checks, but not when only measuring a low distance in some.
|
|
We tried changing the program by making the robot drive backwards a little when encountering an obstacle, check if it was a corner [TODO - corner?] 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 (1000 ms), which wasn't enough, but when we changed it to 2 seconds (2000 ms) it spun approximately 180 degrees. This behavior can be seen in video 2 where the robot turn 180 degrees when measuring a low distance in all three checks, but not when only measuring a low distance in some.
|
|
|
|
|
|
[![Improved avoid behavior](http://img.youtube.com/vi/Um4zjVYArJ0/0.jpg)](https://www.youtube.com/watch?v=Um4zjVYArJ0)
|
|
[![Improved avoid behavior](http://img.youtube.com/vi/Um4zjVYArJ0/0.jpg)](https://www.youtube.com/watch?v=Um4zjVYArJ0)
|
|
*Video 2: The robot performing a 180 degree turn when encountering a corner (approximately 6 seconds in)*
|
|
*Video 2: The robot performing a 180 degree turn when encountering a corner (approximately 6 seconds in)*
|
... | @@ -50,20 +50,19 @@ We were provided with the program ***RobotFigure9_9.java*** [6] which implements |
... | @@ -50,20 +50,19 @@ We were provided with the program ***RobotFigure9_9.java*** [6] which implements |
|
![Behavior control network](https://gitlab.au.dk/LEGO/lego-kode/raw/master/week9/img/fig99.PNG)
|
|
![Behavior control network](https://gitlab.au.dk/LEGO/lego-kode/raw/master/week9/img/fig99.PNG)
|
|
*Figure 3: Diagram of the behavior control network of section 9.5 in [2], exluding the Escape behavior. The original diagram, including the Escape behavior, is Figure 9.9 in [2].*
|
|
*Figure 3: Diagram of the behavior control network of section 9.5 in [2], exluding the Escape behavior. The original diagram, including the Escape behavior, is Figure 9.9 in [2].*
|
|
|
|
|
|
Running ***RobotFigure9_9***, the robot would stop and turn to both sides every time it was bothered by either an obstacle or light, in the same manner as with ***AvoidFigure9_3***. It was hard to distinguish whether it was reacting to light or an obstacle, as the resoponses looked the same. Later, a closer look at the code confirmed that the behavor implementations were similar, in that they both sought in the direction of the higher value (of either light reading or distance). [TODO: beskrivelse af video]
|
|
Running ***RobotFigure9_9***, the robot would stop and turn to both sides every time it was bothered by either an obstacle or light, in the same manner as with ***AvoidFigure9_3***. It was hard to distinguish whether it was reacting to light or an obstacle, as the resoponses looked the same (if one didn't use the LCD screen that is). Later, a closer look at the code confirmed that the behavor implementations were similar, in that they both sought in the direction of the higher value (of either light reading or distance). The behavior of the initial implementation of ***RobotFigure9_9*** can be seen in video 3, where the robot avoids the walls and follows the incriased light source of Idas mobile phone.
|
|
|
|
|
|
[![Avoid follow cruise](http://img.youtube.com/vi/2qxAJpQgZMM/0.jpg)](https://www.youtube.com/watch?v=2qxAJpQgZMM)
|
|
[![Avoid follow cruise](http://img.youtube.com/vi/2qxAJpQgZMM/0.jpg)](https://www.youtube.com/watch?v=2qxAJpQgZMM)
|
|
*Video 3: The robot running with three behaviors: Cruise, Follow, and Avoid*
|
|
*Video 3: The robot running with three behaviors: Cruise, Follow, and Avoid*
|
|
|
|
|
|
After the initial observations, we ran the robot with modified versions of the program. First, with only the Cruise behavior included - in this case, the robot simply drove forward without responding to any stimuli. When including the Follow behavior, unsurprisingly the robot responded to a lit smartphone torch being near it but remained unaffected by other stimuli such as a box standing in its way.
|
|
After the initial observations, we ran the robot with modified versions of the program. First, with only the Cruise behavior included - in this case, the robot simply drove forward without responding to any stimuli. When including the Follow behavior, unsurprisingly the robot responded to a lit smartphone torch being near it but remained unaffected by other stimuli such as a box standing in its way.
|
|
|
|
|
|
|
|
Furthermore, observing the robot running with the Follow behavior, we became aware that the light readings were performed using reflective light. We realized this when we tried to block out the light by holding a hand in front of the sensor, which didn't work. Trying to recreate the incident, we held the robot in place and shone a light in front if it, interchangeably blocking the light with a hand or some dark fabric. The hand had to be very close to the sensor for the robot not to respond, while the dark fabric caused it to stop immediately. The difference between the pale reflecting hand and the dark fabric can be seen in figure 4.
|
|
Furthermore, observing the robot running with the Follow behavior, we became aware that the light readings were performed using reflective light. We realized this when we tried to block out the light by holding a hand in front of the sensor, which didn't work. Trying to recreate the incident, we held the robot in place and shone a light in front if it, interchangeably blocking the light with a hand or some dark fabric. The hand had to be very close to the sensor in order to for the robot not to respond, while the dark fabric caused it to stop immediately.
|
|
|
|
|
|
|
|
![Pale hand and dark shirt](https://gitlab.au.dk/LEGO/lego-kode/raw/master/week9/img/handshirt.PNG)
|
|
![Pale hand and dark shirt](https://gitlab.au.dk/LEGO/lego-kode/raw/master/week9/img/handshirt.PNG)
|
|
*Figure 4: Pale hand and t-shirt made of dark fabric. The hand reflected too much light back to the sensor causing it not to register that the torch light was blocked, while the dark fabric succesfully blocked the torch light.*
|
|
*Figure 4: Pale hand and t-shirt made of dark fabric. The hand reflected too much light back to the sensor causing it not to register that the torch light was blocked, while the dark fabric succesfully blocked the torch light.*
|
|
|
|
|
|
We speculate that this might lead to unintuitive behavior. For instance, if the robot gets close to a white wall, the Follow behavior might cause it to be drawn to the wall before the Avoid behavior kicks in and drives it away from the surface. [TODO reflective might only measure specific light values LOOK INTO IT CAMILLA - EMIL]
|
|
We speculate that this might lead to unintuitive behavior. For instance, if the robot gets close to a white wall, the Follow behavior might cause it to be drawn to the wall before the Avoid behavior kicks in and drives it away from the surface. We however concluded that in other cases it wouldn't effect the behavior, as ...[TODO reflective might only measure specific light values LOOK INTO IT CAMILLA - EMIL]
|
|
|
|
|
|
Additionally, we discovered a slight nuisance during closer observations of the Follow behavior. The robot would, when left alone, constantly stop up and check its sides for light sources, even when not given any significant light source from a torch, as shown in video 4.
|
|
Additionally, we discovered a slight nuisance during closer observations of the Follow behavior. The robot would, when left alone, constantly stop up and check its sides for light sources, even when not given any significant light source from a torch, as shown in video 4.
|
|
|
|
|
... | | ... | |