... | ... | @@ -13,7 +13,7 @@ |
|
|
|
|
|
For this exercise we mounted an ultrasonic sensor, a light sensor and a contact sensor to the LEGO car (Fig.1).
|
|
|
![IMG_8268](http://gitlab.au.dk/uploads/group-22/lego/a223889942/IMG_8268.jpg)
|
|
|
##### Fig.1 - The car used for this lab session
|
|
|
##### Fig.1 - The car used for this lab session. It has two touch sensors on the front and a light and distance sensor on the top. This is the max amount of sensors that can be connected to the NXT.
|
|
|
|
|
|
|
|
|
|
... | ... | @@ -29,7 +29,7 @@ The program was executed without changes in the code. |
|
|
|
|
|
[![image alt text](http://img.youtube.com/vi/eWA66BUeK1E/0.jpg)](http://www.youtube.com/watch?v=eWA66BUeK1E)
|
|
|
|
|
|
##### Fig.2 - Observed results for surface avoidance
|
|
|
##### Fig.2 - Observed results for surface avoidance. The robot is placed in a closed off area. It avoids contact by using the distance sensor.
|
|
|
|
|
|
As seen in Fig.2 the car drives and turns in order to avoid surface contact. When it encounters a surface that is less than the stopThreshold (Fig.3) the car stops and turns to measure distances to it’s left and right. It then compares these readings and drives in the direction with most space available.
|
|
|
|
... | ... | @@ -102,9 +102,7 @@ If all distances are less than the stopThreshold the car backs up a little befor |
|
|
As the program was executed we observed the following (Fig.5):
|
|
|
|
|
|
[![image alt text](http://img.youtube.com/vi/Lsahzi8ipL4/0.jpg)](http://www.youtube.com/watch?v=Lsahzi8ipL4)
|
|
|
##### Fig.5 - Observed behavior in a closed alley.
|
|
|
|
|
|
The robot drives through a closed alley. When the robot meets the dead end and cannot find space in any direction it makes a u-turn and drives in the opposite direction.
|
|
|
##### Fig.5 - Observed behavior in a closed alley. The robot drives through a closed alley. When the robot meets the dead end and cannot find space in any direction it makes a u-turn and drives in the opposite direction.
|
|
|
|
|
|
## Exercise 2: Behaviors as concurrent threads
|
|
|
|
... | ... | @@ -123,7 +121,7 @@ The RobotFigure9_9.java was executed without changes and the test was conducted |
|
|
The robot was placed a few metres from the door. The video (Fig 6) shows the robot turn left and right in order to measure light values to it's sides. It then compares the values and drives towards the door as this area emits most light.
|
|
|
|
|
|
[![image alt text](http://img.youtube.com/vi/MUuwSy8rngo/0.jpg)](http://www.youtube.com/watch?v=MUuwSy8rngo)
|
|
|
##### Fig.6 - Observed behavior in a darkened room.
|
|
|
##### Fig.6 - Observed behavior in a darkened room. The robot searches for a light source and drives towards it.
|
|
|
|
|
|
#### Task 2:
|
|
|
|
... | ... | @@ -176,7 +174,7 @@ To make the robot only cruise we outcommented the threads Avoid and Follow in Ro |
|
|
For the first experiment with only cruise active, we observed a very simple behavior. The robot only drove forward as any other behaviors are inactive. For the experiment with Cruise and Follow active, the robot had almost the same behaviour as when using it’s full behaviour model as seen in the previous task, except it was not able to stop when encountering an obstacle, so it would continue to drive forward even though it was impossible. This behavior is seen in Fig.8
|
|
|
|
|
|
[![image alt text](http://img.youtube.com/vi/MGHlz4jhcUc/0.jpg)](http://www.youtube.com/watch?v=MGHlz4jhcUc)
|
|
|
##### Fig.8 - Observed behavior with Cruise and Follow activated.
|
|
|
##### Fig.8 - Observed behavior with Cruise and Follow activated. When objects are plaed in front of it, the robot will collide with them because the distance sensor is not active.
|
|
|
|
|
|
|
|
|
As an addition we tested the robot with Avoid and Cruise active. Here the robot drove straight ahead in a slight curve, ignoring light conditions. When encountering an object with the ultrasonic sensor, the robot compared distances and turned towards the direction where the distance is longest.
|
... | ... | @@ -263,7 +261,7 @@ class Escape extends Thread |
|
|
The car behaves as expected. It starts driving according to the light readings, where it drives in the direction with the most light. However if an object comes close, the ultrasonic sensor takes control and the robot turns toward the area with the most space. If the object is not detected by the ultrasonic sensor the robot will detect the object through the touch sensors on the bumper and make the reverse and turn away from the encountered object. This behavior is seen in Fig.10:
|
|
|
|
|
|
[![image alt text](http://img.youtube.com/vi/q5wdHOUkjGo/0.jpg)](http://www.youtube.com/watch?v=q5wdHOUkjGo)
|
|
|
##### Fig.10 - Results from experiment
|
|
|
##### Fig.10 - The video shows the robot running with all four behaviors. It drives towards the strongest light, but when encountering an object in front the avoid behavior takes over. When the robot bumps into the side, the escape behavior takes over. The display on the robot shows how the behavior changes.
|
|
|
|
|
|
## Exercise 4: Add a third motor to turn the light sensor
|
|
|
|
... | ... | @@ -345,7 +343,7 @@ The code makes sure that the tacho count is reset once the program is executed. |
|
|
The progam was executed in a darkened room. The goal was for the robot to drive towards the door where the light is brightest. The experiment is shown in the video (Fig.15):
|
|
|
|
|
|
[![image alt text](http://img.youtube.com/vi/M8O1tO_O-3s/0.jpg)](http://www.youtube.com/watch?v=M8O1tO_O-3s)
|
|
|
##### Fig.15 - Results of using the light sensor with a motor
|
|
|
##### Fig.15 - Results of using the light sensor with a motor. The robot is placed in a dark room. It then drives towards the light. When et comes out of the room, objects are placed in front of it and a different behavior is triggered.
|
|
|
|
|
|
The video shows the robot drive and navigate from the back of the room where the light level is low. The motor turns the light sensor while conducting readings and the robot is successfully able to drive towards the door and exit the room. The video also shows the bumper and ultrasonic sensor at work. When the robot bumps into an object the 'escape' behavior is activated and when the robot hits an unseen object the 'avoid' behavior is used.
|
|
|
|
... | ... | @@ -364,7 +362,7 @@ Arbiter: |
|
|
The arbiter class looks at the array and decides what command to run dependant on priority and if the triggering conditions are met I.E true. The priority is highest at place 0 because it is the first to be checked in the array.
|
|
|
|
|
|
![IMG_8268](http://gitlab.au.dk/uploads/group-22/lego/21a33a9b19/fig_9.9.png)
|
|
|
##### Fig.16
|
|
|
##### Fig.16 - The behavior control network as described by [1].
|
|
|
|
|
|
As we can see in fig.16: Cruise is always active unless it is overruled by one of the command classes with higher priority.
|
|
|
|
... | ... | @@ -372,7 +370,7 @@ Jones, Flynn, and Seiger use a method, void arbitrate() (Fig. 17) to check a fla |
|
|
|
|
|
|
|
|
![IMG_8268](http://gitlab.au.dk/uploads/group-22/lego/0165cb92a7/211.png)
|
|
|
##### Fig.17
|
|
|
##### Fig.17 - The arbitrate method used by [1].
|
|
|
|
|
|
The advantage of this method, is that it is easy to maintain an overview of what command classes affects the behaviour of the robot, since they are all prioritized in one arbitrator class [1, p.306-309.]
|
|
|
|
... | ... | |