marvin:lab7
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
marvin:lab7 [2008/10/31 10:13] – rieper | marvin:lab7 [2008/11/07 10:58] (current) – rieper | ||
---|---|---|---|
Line 3: | Line 3: | ||
**Duration of activity:** 8-13\\ | **Duration of activity:** 8-13\\ | ||
**Participants: | **Participants: | ||
+ | |||
====Project Goal==== | ====Project Goal==== | ||
- | The project goal is to build and experiment with Braitenberg vehicles. The vehicles are shown here below. | + | The project goal is to build and experiment with Braitenberg vehicles. The vehicles are shown here below. |
{{: | {{: | ||
===Vehicle 1=== | ===Vehicle 1=== | ||
- | This vehicle | + | This vehicle utilizes the simplest form of sensor-> |
- | In our project a sound sensor is used instead of a light sensor. The source code for vehicle 1 is displayed below. | + | In our project a sound sensor is used instead of a light sensor. |
+ | |||
+ | **Source Code**\\ | ||
+ | The source code for vehicle 1 is displayed below. | ||
<code java> | <code java> | ||
Line 41: | Line 45: | ||
rightMotor.controlMotor(val, | rightMotor.controlMotor(val, | ||
- | Thread.sleep(200); | ||
LCD.clear(); | LCD.clear(); | ||
} | } | ||
Line 57: | Line 60: | ||
[[http:// | [[http:// | ||
- | ===Vehicle | + | ===Vehicle |
- | This vehicle will move towards the light source. | + | For vehicle 2a it should be possible to use two sound sensors given they are sufficiently seperated - this statement is based on the characteristic that was measured in Lab session 3, which revealed that the sound sensor readings were reliant on the direction towards the sound source. In spite of this, we have decided to use two light sensors for vehichle 2a. This vehicle will move towards the light source. |
+ | **Source Code**\\ | ||
+ | The source code for vehicle 2a is displayed below. | ||
+ | <code java> | ||
+ | public class Vehicle2 { | ||
+ | // Commands for the motors | ||
+ | private final static int | ||
+ | forward | ||
+ | backward = 2, | ||
+ | stop = 3, | ||
+ | flt = 4; | ||
+ | |||
+ | private static MotorPort rightMotor= MotorPort.A; | ||
+ | private static MotorPort leftMotor = MotorPort.B; | ||
+ | private static MotorPort light = MotorPort.C; | ||
+ | |||
+ | public static void main(String [] args) throws Exception { | ||
+ | LightSensor l1 = new LightSensor(SensorPort.S1); | ||
+ | LightSensor l2 = new LightSensor(SensorPort.S2); | ||
+ | l1.setFloodlight(false); | ||
+ | l2.setFloodlight(false); | ||
+ | |||
+ | light.controlMotor(100, | ||
+ | |||
+ | while (! Button.ESCAPE.isPressed()) { | ||
+ | |||
+ | // Read value from light sensors | ||
+ | int val1 = l1.readValue() + 60; | ||
+ | int val2 = l2.readValue() + 60; | ||
+ | |||
+ | LCD.drawInt(val1, | ||
+ | LCD.drawInt(val2, | ||
+ | |||
+ | leftMotor.controlMotor(val1, | ||
+ | rightMotor.controlMotor(val2, | ||
+ | |||
+ | LCD.clear(); | ||
+ | } | ||
+ | |||
+ | leftMotor.controlMotor(0, | ||
+ | rightMotor.controlMotor(0, | ||
+ | } | ||
+ | } | ||
+ | </ | ||
**Observed behaviour**\\ | **Observed behaviour**\\ | ||
- | The first testrun indicated that | + | The first testrun indicated that we are facing a motor problem, which have occured often. The problem is, that the car is unable to move forward due to uneven velocity between the motors at the same power level. This problem makes it very difficult to draw conclusions on wheater the code, the sensor or the motors are causing unexpected behaviour. We have attempted to solve this problem by introducing different types of parameters to compensate for the velocity difference, but the problem seems to be dependent on both battery level and is non-linear to the power level. Therefore we have decided to change to a different set of motors. |
+ | Another type of problem is the test environment, | ||
+ | |||
+ | **Video and pictures of vehicle 2a**\\ | ||
+ | [[http:// | ||
+ | |||
+ | |||
+ | ===Vehicle 2b=== | ||
+ | For vehicle 2b, the sensor inputs are reversed using the same source code. No practical test have been made for this vehicle. | ||
+ | |||
+ | ===Interaction between robots=== | ||
+ | A light sensor has been placed on our robot. If we get access to more robots it would be a nice experiment to place them in a dark room and observe their behaviour. Perhaps it could reflect more complex behaviour than expected given the very simple controllers. | ||
+ | |||
+ | ===Conclusions=== | ||
+ | For both vehichles, it was possible to make the robots resemble the expected behaviour of the Braitenberg vehicles, 1 & 2a. The sensors need not be the exact same as in the original proposal in order to reach as similar behaviour/ | ||
- | **Video and pictures of vehicle1**\\ | ||
- | [[http:// | ||
marvin/lab7.1225444429.txt.gz · Last modified: 2008/10/31 10:13 by rieper