Thursday, 30 October 2008

Breitenburg Bots

Date: 30-10-2008

Duration of activity: 2.75 hours

Group members participating: Thomas, Rasmus, Peter

The Goal of the session...: Experiment with Breitenburg robots.

Setup: We built a small car with 3 wheels and 2 light sensors attached at the front. (Reminiscent of the 2 wheeled cars in the picture below).














Experiment:
We connected the sensors as in case 2a above, and just fed the output from the lightsensors directly to the motors.


Purpose:
Test the effects of just forwarding the output, without any form of normalization.


Result:
The values produced by the lightsensors, were barely high enough to get the car moving, let alone show any sort of consistent behaviour.


Experiment:
We tried normalizing the values, before feeding them into the engines. This was done by averaging the max/min values of the sensors and using them in a normalization process ala the one presented during the lecture:

int result = ((t - MIN_LIGHT)* 100) / (MAX_LIGHT - MIN_LIGHT) ;

Purpose:
Stabilize/magnify he bahaviour exhibited, by tailoring the interpretation of the input to some values relevant for the environment we were in.

Result:
The sensors had different sensitivity, which resulted in the car either driving hard left, or hard right and only when subjected to a strong light source.


Experiment:
When normalizing the values, we took in to account the values already seen:




private int MIN_LIGHT = 100;

private int MAX_LIGHT = 0;

public int readValue()
{
int t = super.readValue();

if(MIN_LIGHT > t)
MIN_LIGHT = t;

if(MAX_LIGHT < t)
MAX_LIGHT = t;

if(MAX_LIGHT == MIN_LIGHT)
MAX_LIGHT++;

int result = ((t - MIN_LIGHT)* 100) / (MAX_LIGHT - MIN_LIGHT) ;
return result;

}


Purpose:
Enable the sensors to calibrate themselves over time, so that the output values actually hit the entire range betweem 0 and 100 depending on the input.


Result:
The car exhibited the desired behaviour, meaning that it steered toward light sources, but turned away before hitting them.

Experiment:
To try out vehicle 2b.

Purpose:
To get at different behaviour by just changing the wiring of the motors and the sensors.

Result:
As expected the car drove towards the light source when the light source was at a certain distance form the car. And when it got closer the car steared towards the light, instead of away from the light.

Final versions:
http://www.daimi.au.dk/~rusmus/Breitenberg/

Thursday, 2 October 2008

Date: 25-9-2008

Duration of activity: 2.5 hours

Group members participating: Thomas, Rasmus, Peter

The Goal of the session...: Building a Linefollower.

Setup:
We built the 9797 car once again, and loaded Linefollower onto the nxj. (Linefollower uses BlackWhiteSensor).

Experiments:

BlackWhiteSensor:


Because we already tested the lightsensor (week 1) we decided to skip straight to consturcting the ColorSensorClass.


ColorSensor:


Our first attempt at a colorsensor just sampled values for black, white and blue, and when asked which color it was on, it calculated the difference between a reading and these values, returning the color that had the least difference. The problem with this approach, was that whenever a blue was reported, the car stopped, because it thought it had reached the goalzone.

We modified the colorsensor, so you had to ask for a boolean on each color and we modified the car, so it counted the number of times a blue was reported. The car did not stop until 10 blues had been reported in a row. (A false reset the count).

Here are the final versions of



ColorSensor
and
LineFollower