Thursday, 5 June 2014

Proposal for Drawing Robots or Turtles (BMMF 2014)



Drawing Robots or Turtles

History

Last year I created some 'bacteria-robots' for the Brighton Mini Maker faire. This year, my proposal is to have some programmable robots that perform simple graphics like the Logo-programmed turtle graphics developed in the late 60's.

Bacteria-robots

The bacteria-robots consisted of two motors an arduino and a dual motor controller with a chassis made of wood and perspex.
Here is a picture of them in action:

Behavior of some bacteria

The robots simulate the behavior of some types of bacteria - flagellated bacteria such as
Escherichia coli which have a tiny flagellum. This flagellum can be thought of as a tiny propeller and the bacteria are either propelled along by it, or if it runs in reverse, they tumble about.
When they move about, bacteria like this do what is called a 'random walk'. The random walk is driven by the concentration of food in the liquid in which they swim.
The random walk works like this:

  • The bacteria swim for a while.
  • If food concentration is rising they swim for longer than if it is falling or remaining constant.
  • They will stop swimming and tumble after a while. The tumble has the effect of  selecting a new direction at random. Then they swim again - swimming for longer if the food concentration is rising.
  • If the food concentration is rising then they are getting closesr to food.
  • A 'short' swim (food concentration falling) is about one third of a long swim.
   This sequence is repeated indefinitely. The effect is that they will gradually approach food because the food concentration will be higher near to where food is located (for example a piece of fruit that has fallen into the pond where they are living).
Success of a population of any life form is related to how much food they can get (this applies to plants as well as animals and bacteria). So moving toward food is beneficial.
Bacteria use a similar mechanism to avoid poisons - but the opposite happens if they detect poison -  they move away - in other words, in the direction of decreasing poison concentration (which tends to help their survival!).

Bacteria robots in more detail

The bacteria-robots move in only two dimensions, not three (like real bacteria) and they move about on a board in air, not in a liquid. They are much larger (a human hair on the scale of the robots would be roughly six feet in diameter).
The food is simulated by the shade (light/dark) of the board on which they move. The robots have a photocell to detect the shade of the floor and they move further if it is getting lighter.
They have 'crash' switches on the front in case they hit the side of their enclosure or another robot. The crash switch causes them to reverse and do a tumble. Real bacteria do not do this as far as I know but it helps to keep the bacteria-robots moving about in an interesting way.

The robots end up on the lightest patches. Of course, they continue to move about, so there was a kind of trap - a perspex ceiling and the robots had a switch that was operated by this so they stopped in the 'target' area - just to demonstrate that the random walk actually worked!
One of the robots developed a fault - the photocell became disconnected. This illustrated that there was a significant effect as this one hardly ever got to the target area.

Drawing robots or turtles

The plan is to base the drawing robots on the bacteria-robot design. They will have a radio connection and will download a sequence of moves of the form:

Move D
Draw D
Turn  A
Draw  D

Where D is a distance, A is an angle and M means 'move with pen up' and D means draw (move with 'pen down').

The robots will need a programming system that runs on something like a PC. The idea is to use  Scratch ( see the link : http://scratch.mit.edu/ ) but this is still under study.
The programming system will create a list of instructions to the robot which is then downloaded by radio to the robot as a list of commands to be executed by the program running in the robot.
This is done when the user has finished preparing the program.
The robot will then execute the program to produce a drawing.

Here is a prototype in action:

You can (just!) see that this has drawn part of a regular polygon.

It may be necessary to fit an electronic compass to the robots. This is to ensure the turns are correctly executed as I have found in prototype testing that as the battery is discharged, the robot slows so the turns get less and less. A compass, together with specific programming in the robots will help to avoid this.
The robots will be bigger than the bacteria-robots as they need space between the motors for the pen and the wider wheelbase helps them draw straight lines. They will need a pen lifting device.
When I put a list of commands for drawing into the bacteria-robots, the figures were a bit irregular as the robots wander about and the straight lines are not very straight. But with a wider wheelbase this problem seemed to be mainly solved.
However the robots will not draw as neatly as a screen-based drawing program. However I think this is a useful demonstration that actually engineering real objects (for example robots or machines) can be harder than making computer simulations.
In real life driving wheels slip, not everything works as you'd expect and so on. I hope the robots will help peoples appreciate the practical aspects of making things work.