Todays goals:

Are as described in the lesson 6 exercises notes:

  • Exercise 1 – Building a Base Vehicle
  • Exercise 2 – Vehicle 1
  • Exercise 3 – Vehicle 2
  • Exercise 4 – Vehicle 3

Additional “Optional” Goals

  • No additional goals

The Plan

Because of the thorough guide described in the lesson 6 exercises notes, no further planning was necessary.

Then we did the exercises as explained.

Exercise 1 – Building a Base Vehicle

Plan

Our plan for building the base vehicle is following the step-by-step building instructions found here, but using the third wheel from our previous construction as seen in lesson 1 – 4.

Experiment

None needed.

Programming

None needed.

Results

As seen in figure 1, Max is looking fine in his base dress.

Max mounted with sound sensor based on the Express Bot design Figure 1: Max mounted with sound sensor based on the Express Bot design

We noticed after we had done the experiments that we had used a different backwheel than shown in the the drawings. This was not intentionally – we honestly did not notice there was supposed to be used other wheels. If we had used the wheels from the original drawings, we might experience some issues when turning the vehicle. For this reason, a different proposal was given to use a different set of wheels. We believe this set of wheels would work better on softer surfaces such as carpets as they are more rigid and do not have a large surface area that can get stuck in the material. This is also relevant when on smooth surfaces (e.g. metal, plastic or treated wood) as the wheels would probably slide and not turn. However, this is not a problem to us as the wheels are not connected to a motor and are used merely as support.

Exercise 2 – Vehicle 1

Plan

The plan is to make Max move according to the amplitude of sound near him. We start by first making the amplitude of the measured sound from the sound sensor dictate the corresponding amount of power forward put in his motors. We then afterwards make the sound amplitude dictate if Max should move forward or backwards, and with how much power, this should in the end make Max able to “dance” to the music.

Experiment

The experiment will be in two parts. The first is an observation of Max’ behaviour of moving forward according to the sound levels. The second part is to try and make Max dance to different songs (i.e. Max’ forward speed changes according to the sound levels. The higher the sound levels, the faster Max moves). By simply placing a Max on the floor and run the program, we will observe his behavior when exposed to different levels of sound from a specific source. The source is two computer speakers which will play a song in the first part and three songs in the second part(all chosen by the authors). While the songs are being play, we will also adjust the volume and observe Max’ behavior while doing so.

Programming

The most important part of this program is the value mapping that converts the values from the 0-100 range which is the values received through the sound sensor, to the 55-100 range which is the range that the motors need, so that no sound makes Max stand still and a lot of sound makes him sprint. The range starts from 55, as that is the power needed to overcome inertia of the motors, and we are using a simple one-to-one mapping between sound values and motor power.

To do this conversion we made ValueMap.java which takes a from range and a to range and then converts a given value to its new range using this equation:

return (value-fromMin)*(toMax-toMin) / (fromMax-fromMin)+toMin;

The mapped value is then given to the motors to make Max move. The complete program can be found here.

Results

With the first part of the experiment, Max moved forward when he captures sound levels over a specific amount. In this case the level had to be a least 50-55, since this was the least amount needed for the motors to run. However the minimum power was always dependable to how much Max weighs. There was no need to implement any normalization method for the read values from the sound sensor, since these values were shown as percentages, which had a 1:1 correspondence for the motors’ power values.

As seen in this video Max clearly reacts to the amplitude of sound, and translates this into forward movement according to the sound level. In the following three videos we have tried to make Max dance to music by moving back and forward described by the second part of our plan. We, however, learned that because of the way Max was constructed, noise from the motors made Max power forward when he reached a certain value.

To try and minimize the effect of the motor noise we moved the sound sensor and tried different positions, but without much effect, we decided to place the sensor as seen in the videos.

Max dancing to Nicky Romero – Toulouse can be seen here. Max dancing to ACDC – Thunderstruck can be seen here.

If somebody wants to redo our expiriment, they should remember to note down the values read from the robot for the minimum and maximum values registered, as we forgot.

By registering the maximum and minimum values of the music it might be easier to understand why Max behaves the way he does according to the sound (for instance at high and low sounds).

Also, an improvement to the system could be mapping the difference between 55 – 100 (which is 45) into the overall sound levels. So that the sound values of 1 – 100 are divided into 0 – 45. In this way the robot will move as soon as some sound is a little sound is registered. This provides other complications, as the motor noise in that case might keep Max going.

Exercise 3 – Vehicle 2

Plan

In this exercise we want to mount Max with two light sensors and map the range of the light sensors measurements with the motors powers. Afterwards we want to figure out Max’s behavior according to two different versions of Max’ motor mappings and light measurements, as stated in the assignment. The mappings, as shown in figure 2, are based on using the same two light sensors, but switch the motors controlling them (see 2a and 2b) causing either exhibitory or inhibitory behaviour.

Various versions of the Braitenberg vehicles Figure 2: Various versions of the Braitenberg vehicles

Experiment

In exercise 2, we mapped the sensor’s input range from 0 – 100, and made the output range from 50 – 100 because the motor power has to overcome inertia. This time, however, we will map it differently because the light sensor’s raw values are in the range of 0 – 1023. This means we have the input range from 0 – 1023, and the output range from 50 – 100.

We will connect Max as shown in Figure 2, 2a and 2b, after we have measured and defined the mappings between sensor range and motor power. Then we will have Max run with exitatory connections and see what happens. We expect him to drive away from the light when connected as Figure 2, 2a, and towards the light when connect as in Figure 2, 2b.

The next would be to test Max with inhibitory connections for 2a and 2b, and see how he behaves. We did not complete this part of the exercise.

Programming

The code can be found here.

The interesting parts from this exercise is that we have now introduced the ability for Max to turn left and right. Also, we need to map our light sensor input values (ranged 0 – 1023) to the vehicle power values (50 – 100). This time, the inertia value is just 50 because the light sensor (almost) never goes to full minimum, and therefore we can map the motor values to 50.

To make Max turn left or right, we need to map the light values. Since we have connected Max as in Figure 2, 2a, and if we want to create exitatory behavior, it means that if the light value from left light sensor increases (because a light source is to the left of Max), the left motor value should increase as well – making Max drive away. The right motor will have a lower value than the left motor, because the light source is to the left – which means the robot til will turn right.

When Max is connected as in Figure 2, 2b, we use the same code making him drive towards the light.

Results

When Max is in exitator mode and connected as in Figure 2, 2a, he drives toward darkness and away from the light as seen on this video. When Max behaves in the same exitatory way but connected as shown in Figure 2, 2b, Max will drive towards the light and away from the darkness. Unfortunately, we do not have a video of this.

Speculation

If we had Max in inhibitatory mode, we speculate that if Max was created as in Figure 2, 2a – he would drive slower and slower towards the light source, and then stop just before. If Max instead was connected as in Figure 2, 2b, he would drive away from the light and driver faster and faster the further away from the light source he comes.

Exercise 4 – Vehicle 3

Plan

In this exercise we will mound Max with 2 ultrasonic sensors in addition to the already mounted light sensors. We aim for giving Max the behavior of moving towards where it is brightest, while avoiding any obstacles in his path.

Max geared up for new adventures, with 2x ultrasonic sensors and 2x light sensors. Max geared up for new adventures, with 2x ultrasonic sensors and 2x light sensors.

Experiment

In this experiment we will test Max’ moving capabilities. We will program him to drive towards brighter areas and avoid hitting any obstacles. The test will be performed in a dark room with a single half-open door to another brighter room. Max will be placed in one end of the room facing the the end with the door, but not at the door itself. Thereby we will see Max’ behaviour of movement according to the brightness for the opening, and how Max reacts when nearing other objects.

Programming

In this program Max has two objectives: 1) moving towards the light (much like talking about a near death situation, and someone “moves toward the light”) and 2) avoid bumping into any obstacles. The main priority of the two objectives is avoiding bumping into obstacles, and then Max will only move towards brighter areas if no obstacles are within 30cm of him in his path. Just like with the light and sound sensors there is a value map, but with a difference in values(input: 0-255, output: 0-40). We are measuring the nearest distance from each sensor and the output is the value that is subtracted from the motors maximum power and is thus given the desired power. This means that the closer an object is to Max, the more Max will turn to avoid the object. The entire project can be found here.

Note in the codes that the values are divided into two powermaps. The values will be explained after this:

  • Powermap1, values: (0, 100, 60, 100). This powermap is for the light sensors.
  • Powermap2, values: (0, 255, 0, 40). This powermap is for the ultrasonic sensors.

For powermap1, the values are described as (minimum light value, maximum light value, minimum motorpower, maximum motorpower).

For powermap2, the values are described as (minimum distance, maximum distance, minimum value subtracted from maximum motorpower value, maximum value that subtracted from maximum motorpower value). One of the main things to notice here is having the maximum value subtracted from maximum motorpower value as 40. This is because of the maximum motorpower value is 100, and we still need to overcome inertia (and Max has gained weight, so the inertia value is now 60, instead of 55).

One specific note about Max’ power output is that the brighter an area is, the more power output his motors give. This means that Max will be driving with near minimum speed, in dark rooms, while in higher speed in brighter rooms.

Results

As seen in this video Max moves very slow in the darker room, but slowly moved towards the opening at the door to a brighter room. When meeting an obstacle – and depending on which side – the motor on that corresponding side would increase in power and thus try to avoid the object. This, however, also meant that if there was one obstacle on each side of Max both motors increase in power. This might have been seen as a problem, but instead would still avoid obstacles, since the side with the closest object would also have the motor with the higher power output, thus making sure Max avoided both obstacles.

General

Problems

We had problems having Max slalom around chairs’ legs because he did not know which way was out, which we found in Exercise 3. Other than that, we just had issues with finding enough time in our schedule to complete this Lesson.

Conclusion

Braitenberg vehicles are fun and interesting. We found it interesting how very advanced behavior can be created by very simple sensor controls. What we mean with this, is that by simply changing the connections of two sensors, but using the same code, it was possible to create two completely different behaviors.