... | @@ -24,7 +24,7 @@ We rebuilt the robot to use four sensors, of which the two touch sensors were pl |
... | @@ -24,7 +24,7 @@ We rebuilt the robot to use four sensors, of which the two touch sensors were pl |
|
*Figure 1: The robot, refitted 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:
|
|
|
|
|
|
### Observing the Avoid behavior
|
|
### Observing the Avoid behavior
|
|
We were provided with the program ***AvoidFigure9_3.java*** which implements a behavior that tries to avoid obstacles using the ultrasonic sensor. Figure 2 shows a diagram representing the robot's overall behavior when running it. We ran the program in order to observe the resulting conduct of the robot.
|
|
We were provided with the program ***AvoidFigure9_3.java*** [4] which implements a behavior that tries to avoid obstacles using the ultrasonic sensor. Figure 2 shows a diagram representing the robot's overall behavior when running it. We ran the program in order to observe the resulting conduct of the robot.
|
|
|
|
|
|
![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].*
|
... | @@ -36,26 +36,39 @@ The program worked quite well. The robot succesfully avoided obstacles registere |
... | @@ -36,26 +36,39 @@ The program worked quite well. The robot succesfully avoided obstacles registere |
|
|
|
|
|
|
|
|
|
#### Incorpoating a 180 degree escape turn
|
|
#### 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).
|
|
As prescribed in the lesson plan, we modified ***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
|
|
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 behavior](TODO)
|
|
![improved avoid behavior](TODO)
|
|
*Video 2: The robot performing a 180 degree turn when encountering a corner (approximately TODO seconds in)*
|
|
*Video 2: The robot performing a 180 degree turn when encountering a corner (approximately TODO seconds in)*
|
|
|
|
|
|
|
|
|
|
### Observing the Avoid, Follow and Cruise behaviors
|
|
### Observing the Avoid, Follow and Cruise behaviors
|
|
We were provided with the program ***RobotFigure9_9.java*** which implements a behavior control network incorporating three behaviors: Avoid (as described earlier), Follow (which seeks out bright light and follows it), and Cruise (which simply drives the robot forwards). Figure 3 shows a diagram of the behavior control network. We ran the program in order to observe the resulting conduct of the robot, before implementing an Escape behavior as well (next section).
|
|
We were provided with the program ***RobotFigure9_9.java*** [5] which implements a behavior control network incorporating three behaviors: Avoid (as described earlier), Follow (which seeks out bright light and follows it), and Cruise (which simply drives the robot forwards). Figure 3 shows a diagram of the behavior control network. We ran the program in order to observe the resulting conduct of the robot, before implementing an Escape behavior as well (next section).
|
|
|
|
|
|
![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.
|
|
|
|
|
|
|
|
![avoid follow cruise](TODO)
|
|
|
|
*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.
|
|
|
|
|
|
|
|
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)
|
|
|
|
*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.*
|
|
|
|
|
|
|
|
... This might lead to unintuitive behavior if its driving in a very dark room and gets close to a surface, since the avoid behavior wants to drive away from the surface, but the follow behavior might want to drive towards it. TODO reflective might only measure specific light values LOOK INTO IT CAMILLA - EMIL
|
|
|
|
|
|
|
|
|
|
|
|
As the threshold between seeing light and not seeing light is based on an initial calibration of the ambient light, we sometimes had issues with the calibrated threshold being too low, causing the robot to constantly respond to light even when the smartphone torch was off - that is, it was simply responding to (changes in) the ambient light in the room.
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
Cruise behavior - it just drives forward without any behavior changes.
|
|
|
|
Follow behavior - it reacts according to a light reading compared to a threshold (based on an initial light reading). It uses reflective light, which we realized when we tried to close out the light by holding a hand infront of the sensor. This might lead to unintuitive behavior if its driving in a very dark room and gets close to a surface, since the avoid behavior wants to drive away from the surface, but the follow behavior might want to drive towards it. TODO reflective might only measure specific light values LOOK INTO IT CAMILLA - EMIL
|
|
|
|
### Escape behavior
|
|
### Escape behavior
|
|
We use a program from p. 305[2].
|
|
We use a program from p. 305[2].
|
|
We tried turning by just powering one motor, but that didnt work so now we power forward in one and backwards in one. This worked well, even though we had the other behaviors turned on, so they affected the run. We tried with them turned off aswell, and it worked even better this time.
|
|
We tried turning by just powering one motor, but that didnt work so now we power forward in one and backwards in one. This worked well, even though we had the other behaviors turned on, so they affected the run. We tried with them turned off aswell, and it worked even better this time.
|
... | @@ -106,6 +119,8 @@ TODO: |
... | @@ -106,6 +119,8 @@ TODO: |
|
[3] Fred G. Martin, Robotic Explorations: A Hands-on Introduction to Engineering, Prentice Hall, 2001.
|
|
[3] Fred G. Martin, Robotic Explorations: A Hands-on Introduction to Engineering, Prentice Hall, 2001.
|
|
|
|
|
|
TODO: Alle nødvendige kode-refs
|
|
TODO: Alle nødvendige kode-refs
|
|
|
|
[4] [The AvoidFigure9_3.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson7programs/AvoidFigure9_3.java) *(modified)*
|
|
|
|
[5] [The RobotFigure9_9.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson7programs/RobotFigure9_9.java) *(modified)*
|
|
[TODO] [The Escape.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson7programs/Escape.java)
|
|
[TODO] [The Escape.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson7programs/Escape.java)
|
|
[TODO] [The FollowWithMotor.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson7programs/FollowWithMotor.java)
|
|
[TODO] [The FollowWithMotor.java program](https://gitlab.au.dk/LEGO/lego-kode/blob/master/src/Lesson7programs/FollowWithMotor.java)
|
|
|
|
|
... | | ... | |