
The POPBUGS package has proved useful for playing with the simulations described in Valentino Braitenberg's book `Vehicles: Experiments in Synthetic Psychology, MIT Press, 1984'. Braitenberg's early vehicles are bug-like entities which have direct connections between sensors and wheel motors. Their behaviour is modulated by changing the pattern and strengths of these connections. For example:
`Vehicle 1 is equipped with one sensor and one motor... The connection is a very simple one. The more there is of the quality to which the sensor is tuned, the faster the motor goes' (p.3, this and all other quotations from Braitenberg's book).
In POPBUGS, we can have various sorts of sensors including proximity sensors, which return a value indicating the proximity of the nearest obstacle along a given ray. We can build a rough simulation of vehicle 1 as follows. First we set up a new world containing a single bug.
1 -> pb_new_world;![]()
Then, we give that bug a single proximity sensor pointing directly ahead.
[[prox1]] -> pb_sensors;
Finally, we define its behaviour so that the single proximity input is used to fix the amount of drive to be applied to the two drive wheels.
[[x(1)][x(1)]] -> pb_behaviour;
We we run the simulation, the vehicle executes a kamikaze dive into the nearest wall.
In chapter 3 Braitenberg describes a vehicle which exhibits `love'.
`What comes to mind is to introduce some inhibition in the connections between the sensors and the motors, switching the sign of the influence from positive to negative. This will let the motor slow down when the corresponding sensor is activated. Again we can make two variants, one with straight and one with crossed connections. Both will slow down in the presence of a strong stimulus and race when the stimulus is weak' (p.10).
To simulate this vehicle we first initialize the bugworld.
1 -> pb_new_world;
[[name roger][position [30 50]][colour pink][shape circle]] -> pb_spec;
[[{10} roger][{-10} roger]] -> pb_sensors;
[90 90] -> pb_position;
To achieve the inhibitory effect we arrange for the input proportions to be subtracted from the default motor output rather than added to it. First we implement the vehicle with straight connections.
[[(1-x(1))][(1-x(2))]] -> pb_behaviour;
With this behaviour, the vehicle seems to show a deep fascination with `roger', the pink object. It moves towards that object but with a decreasing speed. Eventually it comes to a halt.
If we cross the connections then the vehicle behaves more bashfully. It turns away and moves out of the space with an increasing speed.
[[(1-x(2))][(1-x(1))]] -> pb_behaviour;
Braitenberg then describes a much more complex variant of this vehicle.
`We give [the vehicle] not just one pair of sensors but four pairs, tuned to different qualities of the environment, say light, temperature, oxygen concentration, and amount of organic matter. Now we connect the first pair to the motors with uncrossed excitatory connections ... the second pair with crossed excitatory connections ... and the third and fourth pairs with inhibitory connections, crossed and uncrossed.' (p.12)
To simulate temperature we set up an object called `temperature' and then arrange for our vehicle to sense that object directly. The position of the object then effectively simulates the centre of concentration of the relevant property. A vehicle which is near and facing towards the temperature object thus senses a `high' temperature value but an object which is far/facing away experiences a `lower' temperature value.
First we set up the world and pseudo objects.
1 -> pb_new_world;
[[number 1][substance rubber_shell]] -> pb_spec;
{20 20} -> pb_position;
[[name light][position [40 53]][colour yellow][dimensions [6 6]]] -> pb_spec;
[[name temp][position [60 38]][colour red][dimensions [6 6]]] -> pb_spec;
[[name oxygen][position [81 58]][colour LightCyan][dimensions [6 6]]] -> pb_spec;
[[name dung][position [48 69]][colour brown][dimensions [6 6]]] -> pb_spec;
Note that the center of temperature concentration is a small red object. The center of organic-material is a small brown object. The light source is a yellow object and the oxygen source a light-blue object.
Now, we equip the vehicle with the appropriate sensory equipment.
[
[{40} light] [{-40} light]
[{40} temp] [{-40} temp]
[{40} oxygen] [{-40} oxygen]
[{40} dung] [{-40} dung]
] -> pb_sensors;
Finally, we redefine the behaviour so that the relevant sensor-motor connections are crossed or straight as appropriate.
[[0.3+x(2)+x(3)-x(5)-x(8)] [0.3+x(1)+x(4)-x(6)-x(7)]] -> pb_behaviour;
Braitenberg says `this is now a vehicle with really interesting behaviour. It dislikes high temperature, turns away from hot places, and at the same time seems to dislike light bulbs with even greater passion, since it turns toward them and destroys them. On the other hand it definitely seems to prefer a well-oxygenated environment and one containing many organic molecules, since it spends much of its time in such places.' (p.12)
A video of a simulation of this vehicle is available
here Note that
the various sensory objects in the simulation move around. This is to
cause the bug to produce a more interesting variety of behaviours.
`Let us consider the following improvement. The activation of a certain sensor will make the corresponding motor run faster, but only up to a point, where the speed of the motor reaches a maximum. Beyond this point, if the sensor is activated even more strongly, the speed will decrease again' (p.15).
The value of the trigonometric `sin' function increases for values up to 90 and then decreases for values up to 180. Thus we can achieve the desired effect by calling `sin' with a value which is just the sensor activation level multiplied by 180. To see what sort of effect this can achieve we set up a world involving one (tank-shaped) bug and two objects. We arrange things such that the bug has a `non-linear attraction' to one of the objects and a `non-linear repulsion' from the other.
1 -> pb_new_world;
{15 50} -> pb_position;
[[number 1][substance rubber_shell]] -> pb_spec;
[[number 2][trail_colour aquamarine][shape tank]] -> pb_spec;
[[name a][position [61 34]][shape circle][dimensions [6 6]]] -> pb_spec;
[[name b][position [64 46]][shape circle][dimensions [6 6]]] -> pb_spec;
[[{25} a][{-25} a][{25} b][{-25} b]] -> pb_sensors;
[[0.7+(((sin(x(2)*180))-(sin(x(4)*180))))]
[0.5+(((sin(x(1)*180))-(sin(x(3)*180))))]] -> pb_behaviour;
pb_refresh();
The world created by this code looks like this.
When we run the simulation we find that non-linearities inherent in the sensory stimuli produce a strange looping behaviour, the first few cycles of which look like this.
Sussex Poplog users can get access to these and other Braitenberg-style simulations via the teach file TEACH VEHICLES.