marvin:ecp4
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
marvin:ecp4 [2009/01/29 09:25] – deva | marvin:ecp4 [2009/01/29 11:00] (current) – rieper | ||
---|---|---|---|
Line 4: | Line 4: | ||
</ | </ | ||
- | ======Lab report 4 - Behaviour | + | ======Lab report 4 - Behaviour |
**Date:** January 16nd 2009\\ | **Date:** January 16nd 2009\\ | ||
**Duration of activity:** 8-16\\ | **Duration of activity:** 8-16\\ | ||
Line 10: | Line 10: | ||
=====Project Goal===== | =====Project Goal===== | ||
- | Make the robot drive autonomous, avoiding obstacles, using a behaviour model. | + | Make the robot drive autonomously, avoiding obstacles |
=====Plan===== | =====Plan===== | ||
* Move balance related code to a thread. | * Move balance related code to a thread. | ||
* Make control parameters writeable from outside the motor thread to make it possible to drive around. | * Make control parameters writeable from outside the motor thread to make it possible to drive around. | ||
- | * Copy code from previous Behaviour project (([[http:// | + | * Copy code from previous Behaviour project (([[http:// |
* Modify the code to make it fit Marvin. | * Modify the code to make it fit Marvin. | ||
- | === The Ultrasonic Sensor === | + | =====Theory===== |
+ | ====The Ultrasonic Sensor==== | ||
Ultrasonic sensors work on a principle similar to radar or sonar by emitting an impulse and interpreting the echoes from radio or sound waves respectively. Ultrasonic sensors generate high frequency sound waves and evaluate the echo which is received back by the sensor. The time interval between the emitted and received signal is then calculated in order to determine a distance to a given object. The ultrasonic sensors are also known as transducers when they both send and receive signals. The Ultrasonic Sensor(([[http:// | Ultrasonic sensors work on a principle similar to radar or sonar by emitting an impulse and interpreting the echoes from radio or sound waves respectively. Ultrasonic sensors generate high frequency sound waves and evaluate the echo which is received back by the sensor. The time interval between the emitted and received signal is then calculated in order to determine a distance to a given object. The ultrasonic sensors are also known as transducers when they both send and receive signals. The Ultrasonic Sensor(([[http:// | ||
{{ : | {{ : | ||
- | === Knowledge | + | ====Knowledge |
- | 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:// | + | 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:// |
[[http:// | [[http:// | ||
{{youtube> | {{youtube> | ||
- | =====The Behavior class and its subclasses===== | + | =====Implementation===== |
- | + | ====The Behavior | |
- | ====The Behavior | + | |
{{ : | {{ : | ||
A platform for a behaviour based system with a simple suppression mechanism. An actual behaviour is defined by extending the '' | A platform for a behaviour based system with a simple suppression mechanism. An actual behaviour is defined by extending the '' | ||
Line 57: | Line 57: | ||
// Clone the Behavior list. | // Clone the Behavior list. | ||
this.behaviors = new ArrayList(); | this.behaviors = new ArrayList(); | ||
+ | |||
for(int i = 0; i < behaviors.size(); | for(int i = 0; i < behaviors.size(); | ||
Behavior b = (Behavior)behaviors.get(i); | Behavior b = (Behavior)behaviors.get(i); | ||
Line 114: | Line 115: | ||
</ | </ | ||
The '' | The '' | ||
- | ===The RandomDrive | + | ====The RandomDrive |
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 | + | ====The AvoidFront |
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 '' | 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 '' | ||
<code java> | <code java> | ||
Line 150: | Line 151: | ||
} | } | ||
</ | </ | ||
- | ===The | + | ====The |
- | The thread handles | + | The thread handles |
- | The full source code for these classes can be found in the files '' | + | The full source code for these classes can be found in the files '' |
marvin/ecp4.1233217501.txt.gz · Last modified: 2009/01/29 09:25 by deva