User Tools

Site Tools


marvin:lab10

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
marvin:lab10 [2008/11/28 09:00] devamarvin:lab10 [2008/11/28 09:16] (current) deva
Line 5: Line 5:
  
 ====Project Goal==== ====Project Goal====
-In this lab session we will investigate how a behaviour-based architecture(([[http://lejos.sourceforge.net/nxt/nxj/tutorial/Behaviors/BehaviorProgramming.htm]])), has been implemented in the subsumption API of leJOS NXJ. We will investigate the interface lejos.subsumption.Behavior and the class lejos.subsumption.Arbitrator and try to make an alternative implementation of the Arbitrator.+In this lab session we will investigate how a behaviour-based architecture(([[http://lejos.sourceforge.net/nxt/nxj/tutorial/Behaviors/BehaviorProgramming.htm]])), has been implemented in the subsumption API of LeJOS NXJ. We will investigate the interface lejos.subsumption.Behavior and the class lejos.subsumption.Arbitrator and try to make an alternative implementation of the Arbitrator.\\ 
 +\\ 
 +{{marvin:lab10-1.jpg?300}}\\ 
 +//Marvin//
  
-**Marvin**\\ 
-{{marvin:lab10-1.jpg?300}} 
  
 ====Plan==== ====Plan====
-The plan for today is devided into two parts. First we will investigate and evaluate the behaviour of BumperCar((BumperCar.java can be found in the example folder of the LejOS source code - http://lejos.sourceforge.net/nxj-downloads.php)). And second we will change the behaviour of Arbitrator for BumberCar(([[http://legolab.daimi.au.dk/DigitalControl.dir/NXT/Lesson10.dir/Lesson.html]]))+The plan for today is devided into two parts. First we will investigate and evaluate the behaviour of BumperCar((BumperCar.java can be found in the example folder of the LejOS source code - http://lejos.sourceforge.net/nxj-downloads.php)). And second make suggestions on how to improve the Arbitrator in LejOS to better suite the model described in Krink.
  
 ===Part One=== ===Part One===
Line 17: Line 18:
   * Behaviour of BumberCar((BumperCar.java can be found in the example folder of the LejOS source code - http://lejos.sourceforge.net/nxj-downloads.php))   * Behaviour of BumberCar((BumperCar.java can be found in the example folder of the LejOS source code - http://lejos.sourceforge.net/nxj-downloads.php))
   * Investigate the source code for the Arbitrator((http://lejos.sourceforge.net/nxt/nxj/api/lejos/subsumption/Arbitrator.html))   * Investigate the source code for the Arbitrator((http://lejos.sourceforge.net/nxt/nxj/api/lejos/subsumption/Arbitrator.html))
-  * Implement a third behaviour called Exit that will react on Escape button +  * Implement a third behaviour called ExitOnEscape that will react on Escape button 
-  * Implement a fourth behaviour called Playsound that will react on Enter button+  * Implement a fourth behaviour called PlaySound that will react on Enter button
  
 ===Part Two=== ===Part Two===
-Implementation of an alternative Arbitrator that will make sure that takeControl of all behaviours are called each time through the loop. When the Arbitrator is working we will compare it to the lejos Arbitrator. +Suggest alternative implementation of an Arbitrator that will make sure that ''takeControl'' of all behaviours are called each time through the loop. 
 + 
  
 ====Execution==== ====Execution====
-The program bumberCar.java is run in the NXT and we observe what happens when the touch sensor is kept pressed constantly. We expect the hitWall behaviour to be active making Marvin go backwards and turn over and over. This is not what happens though and the reason for this is found by inspection of the arbitrator within the Lejos system. The source code for the arbitrator is shown below. +The program BumberCar.java is run in the NXT and we observe what happens when the touch sensor is kept pressed constantly. We expect the ''HitWall'' behaviour to be active making Marvin go backwards and turn over and over. This is not what happens though and the reason for this is found by inspection of the arbitrator within the LejOS system. The source code for the arbitrator is shown below. 
  
-The lejOS Arbitrator+The LejOS Arbitrator
 <code java> <code java>
 public class Arbitrator { public class Arbitrator {
Line 101: Line 104:
 ====Motivation Functions==== ====Motivation Functions====
 The "normal" case is that when hitWall is active, Marvin will back out, turn a little bit an step out of that routine. But what if the hitWall routine is activated repeatedly. What happens then? In the group, we talked about the case where Marvin would hit a bouncing wall, e.g. a wall with a spring attached to the back of it, so that it would move towards Marvin when pushed once. In this case Marvin would react the normal way, that is, back out and turn, but the wall will then hit him again, and this will repeat itself. In this case, it would be convenient to implement some sort of mechanism that would help Marvin to get out of that situation. Lets could it a motivation to do something. Thiemo Krink(([[http://www.legolab.daimi.au.dk/DigitalControl.dir/Krink.pdf]])) has some proposals on this topic. Marvin could have some sort of motivation factor to get away from the wall on change direction. As is seen in the picture below we have drawn a simple graph to illustrate how we think Marvin should behave in the case where he hits the wall several times. \\ The "normal" case is that when hitWall is active, Marvin will back out, turn a little bit an step out of that routine. But what if the hitWall routine is activated repeatedly. What happens then? In the group, we talked about the case where Marvin would hit a bouncing wall, e.g. a wall with a spring attached to the back of it, so that it would move towards Marvin when pushed once. In this case Marvin would react the normal way, that is, back out and turn, but the wall will then hit him again, and this will repeat itself. In this case, it would be convenient to implement some sort of mechanism that would help Marvin to get out of that situation. Lets could it a motivation to do something. Thiemo Krink(([[http://www.legolab.daimi.au.dk/DigitalControl.dir/Krink.pdf]])) has some proposals on this topic. Marvin could have some sort of motivation factor to get away from the wall on change direction. As is seen in the picture below we have drawn a simple graph to illustrate how we think Marvin should behave in the case where he hits the wall several times. \\
- +\\ 
-{{:marvin:lab10-krink.png}}\\+{{:marvin:lab10-krink.png?300}}\\
 //The Krink model//\\ //The Krink model//\\
- +\\ 
-{{:marvin:lab10-2.jpg?300}}+{{:marvin:lab10-2.jpg?300}}\\
 //Motivation over time//\\ //Motivation over time//\\
- +\\ 
-The first time Marvin hits the wall his motivation to backout and turn should be major. If takeControl takes over to reactivate the rutine the motivation should thereafter me minor because of e.g. the spring wall mentioned earlier. There after the motivation should again rise over some time (the time period is case not important as we only talk principles, but is ofcourse important in the implementation) to improve the motivation to get away from the wall. It should be noted that the first time Marvin hits the wall, it would be the normal case and after some time the motivation should be greater than normal state. This may not be that well illustrated on the graph.+The first time Marvin hits the wall his motivation to back out and turn should be major. If ''takeControl'' takes over to reactivate the routine the motivation should thereafter me minor because of e.g. the spring wall mentioned earlier. There after the motivation should again rise over some time (the time period is case not important as we only talk principles, but is of course important in the implementation) to improve the motivation to get away from the wall. It should be noted that the first time Marvin hits the wall, it would be the normal case and after some time the motivation should be greater than normal state. This may not be that well illustrated on the graph.
  
 The implementation of this could be e.g. 10-20 seconds time interval from first hit to full motivation and could be an integer or percentage (floating point number) that will increase the speed Marvin backs up with and second the degree of turn that he makes. The implementation of this could be e.g. 10-20 seconds time interval from first hit to full motivation and could be an integer or percentage (floating point number) that will increase the speed Marvin backs up with and second the degree of turn that he makes.
  
-====Discussion====+====Conclusion==== 
 +The LejOS implementation of the Arbitrator seems very random, and in many cases it disqualifies as an arbitrator.\\ 
 +A new implementation of the arbitrator could be made using the Krink model.
  
- 
-====Conclusion==== 
marvin/lab10.1227859222.txt.gz · Last modified: 2008/11/28 09:00 by deva