User Tools

Site Tools


marvin:ecp4

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
marvin:ecp4 [2009/01/29 10:57] riepermarvin:ecp4 [2009/01/29 11:00] (current) rieper
Line 4: Line 4:
 </texit> </texit>
  
-======Lab report 4 - Behaviour control======+======Lab report 4 - Behaviour Control======
 **Date:** January 16nd 2009\\ **Date:** January 16nd 2009\\
 **Duration of activity:** 8-16\\ **Duration of activity:** 8-16\\
Line 24: Line 24:
 {{ :marvin:sonic.png |The NXT Ultrasonic Sensor}} {{ :marvin:sonic.png |The NXT Ultrasonic Sensor}}
  
-====Knowledge learned from previous lessons====+====Knowledge Learned from Previous Lessons====
 Prior to using a sensor for a specific purpose it is important to investigate the main use for the sensor. For example in lab session 4 (([[http://wiki.aasimon.org/?id=marvin:lab4|Lab 4]])) we used the light-sensor as an input for measuring tilt of the robot. Or in other words, it was not the primary use for the sensor we used it for. Another example is the ultrasonic sensor (([[http://wiki.aasimon.org/?id=marvin:lab2|Lab 2]])) which operates fairly precise when operated at an angle of 90 degrees to the wall, because is uses echo for measurement. When the angle was shifted to one side the sensor became increasingly inaccurate. Again you have to closely investigate the capabilities and limitations of the sensor one plans to use. As the ultrasonic sensor depends on sound, the primary limitations are echo delays and angle shifts. Therefore the best readings will be available when the sensor is positioned directly in in front of a wall. And the best readings will also be available when to sensor is close to the wall due to the fact that echoes will travel in different directions. These limitations will not be a problem in our project due to the fact that we only use the ultrasonic sensor to avoid that Marvin will hit any walls. Prior to using a sensor for a specific purpose it is important to investigate the main use for the sensor. For example in lab session 4 (([[http://wiki.aasimon.org/?id=marvin:lab4|Lab 4]])) we used the light-sensor as an input for measuring tilt of the robot. Or in other words, it was not the primary use for the sensor we used it for. Another example is the ultrasonic sensor (([[http://wiki.aasimon.org/?id=marvin:lab2|Lab 2]])) which operates fairly precise when operated at an angle of 90 degrees to the wall, because is uses echo for measurement. When the angle was shifted to one side the sensor became increasingly inaccurate. Again you have to closely investigate the capabilities and limitations of the sensor one plans to use. As the ultrasonic sensor depends on sound, the primary limitations are echo delays and angle shifts. Therefore the best readings will be available when the sensor is positioned directly in in front of a wall. And the best readings will also be available when to sensor is close to the wall due to the fact that echoes will travel in different directions. These limitations will not be a problem in our project due to the fact that we only use the ultrasonic sensor to avoid that Marvin will hit any walls.
  
Line 31: Line 31:
  
 =====Implementation===== =====Implementation=====
-====The Behavior class====+====The Behavior Class====
 {{ :marvin:behavior.png?450 }} {{ :marvin:behavior.png?450 }}
 A platform for a behaviour based system with a simple suppression mechanism. An actual behaviour is defined by extending the ''Behavior'' class. Each behaviour is a single thread of control. A platform for a behaviour based system with a simple suppression mechanism. An actual behaviour is defined by extending the ''Behavior'' class. Each behaviour is a single thread of control.
Line 115: Line 115:
 </code> </code>
 The ''Behavior'' class has the following 3 subclasses: The ''Behavior'' class has the following 3 subclasses:
-====The RandomDrive class====+====The RandomDrive Class====
 This behaviour drives in one of four random directions for a random number of milliseconds.  This behaviour drives in one of four random directions for a random number of milliseconds. 
 All of these numbers are computed using a random function from Java Math library. All of these numbers are computed using a random function from Java Math library.
  
-====The AvoidFront class====+====The AvoidFront Class====
 Implemented using a ultrasonic sensor. The behaviour activates a backward motion and do this for a number of milliseconds to back away from the obstacle. Afterwards Marvin stops and turns right corresponding to an approximately 90 degree turn. The code for the essential parts of the ''AvoidFront'' class can be seen below as an illustrative example of how behaviours are implemented in general. Implemented using a ultrasonic sensor. The behaviour activates a backward motion and do this for a number of milliseconds to back away from the obstacle. Afterwards Marvin stops and turns right corresponding to an approximately 90 degree turn. The code for the essential parts of the ''AvoidFront'' class can be seen below as an illustrative example of how behaviours are implemented in general.
 <code java> <code java>
Line 151: Line 151:
 } }
 </code> </code>
-====The BTController class==== +====The BTController Class==== 
-The thread handles Bluetooth communication in order to control Marvin with a remote control. The arrow keys on the computer is used instead of a remote. This class will be covered in detail in the next lab report.+The thread handles bluetooth communication in order to control Marvin with a remote control. The arrow keys on the computer is used instead of a remote. This class will be covered in detail in the next lab report.
  
  
 The full source code for these classes can be found in the files ''Behavior.java'', ''RandomDrive.java'', ''BTController.java'' and ''AvoidWall.java'' in the Marvin code tarball (([[http://wiki.aasimon.org/lib/exe/fetch.php?media=marvin:marvin-1.0.tar.gz|marvin-1.0.tar.gz]])) The full source code for these classes can be found in the files ''Behavior.java'', ''RandomDrive.java'', ''BTController.java'' and ''AvoidWall.java'' in the Marvin code tarball (([[http://wiki.aasimon.org/lib/exe/fetch.php?media=marvin:marvin-1.0.tar.gz|marvin-1.0.tar.gz]]))
marvin/ecp4.1233223031.txt.gz · Last modified: 2009/01/29 10:57 by rieper