fredag den 30. oktober 2009

Lab session 7

Attendees: Jesper Jakobsen and Michael Nygaard Pedersen

Work time: 9.0o - 13.00


The goal is to create and investigate simple Braitenberg creatures.

Sub goals

To program three different types of Braitenberg creatures and investigates the behavior of its own and among other Braitenberg creatures.


· Build a basic robot with the properties of the Braitenberg creature (2a and 2b from Ref1)

· Program and test a light following Braitenberg creature

· Evaluate a light avoiding Braitenberg creature

· Compare direct control form and comparator control form.

· Evaluate and implement light measurement filter.


Description of experiment


Programming attempts

Four different approaches where either fully implemented or investigated during this lab session.

Direct control

The direct control works in almost the same way as the filtered implementation, which is presented in the next subparagraph and dealt with in detail.

Filtered direct control

The Braitenberg vehicles are constructed as shown in Ref1. It basically consists of two light sensors and two motors.

The values read by the light sensors are fed directly to two motors, respectively, as shown in Ref1. Vehicle 2a avoids the light while Vehicle 2b searches the light. To change the functionality of one vehicle to the other, the light sensor/motor connections are simply swapped.

The “estimate” value is set to 50 as default and offset is 250 - Both values are based on experiments. The “light searcher” essentially works as follows:

public void searchLight() {

while (!Button.ENTER.isPressed()) {

normVal1 = ls1.getNormalizedLightValue();

normVal2 = ls2.getNormalizedLightValue();

// Filter algorithm

estimate1 = estimate1 + (filterKoef*(normVal1 - estimate1));

estimate2 = estimate2 + (filterKoef*(normVal2 - estimate2));

normVal1 = (int)estimate1;

normVal2 = (int)estimate2;

// Range algorithm - Not used in this implementation

calibrateSensor(normVal1); calibrateSensor(normVal2);

// Search algorithm.





The light sensor values are read, filtered and normalized to comply with the .controlMotor method. The filter “smoothes” the operation of the vehicle by slowly integrating weighed changes in light intensity.

Differential control

Another way of optimizing the behavior is to make the light measurement depended of one another. By subtracting the two measured values, the ambient light level is less important, when the speed is determined. The direction is determined by the polarization of the subtraction and the turning and drive speed can be calculated based on the difference.

Filtered direct control in two threads

To make the Braitenburg creature even more real, the two inputs with the belonging output was tried implemented in two different threads (two brain halves controlling each side). The idea was to take implemented filter control and put half of the functionality into one class and the other half into another. The main class should then extend threads and each class should then run independently in two threads. The final implementation was not made, because of the used time.

Problems encountered

When the Braitenberg creature was tried implemented in threads there was several compiler errors and they were not resolved within the lab session.


The NXT behavior was never tested among other NXTs, because only few NXTs where actual working. The designed robot was borrowed from another group because LegeCarstens’ group member with access to the robot never showed up. The written software worked perfectly on the other robot.


Ref 1: Notes on construction of Braitenberg's Vehicles, Chapter 1-5 of Braitenbergs book

Ref2: Introduction to Machina Speculatrix and Braitenberg Vehicles

Ingen kommentarer:

Send en kommentar

Faste læsere