A Foraging Java Animat

by Luka Milovanov and Seppo Virtanen

alt="the animat applet"
The Java source of the animat: World.java


The above Java animat is based on the subsumption architecture for robotics introduced by Rodney Brooks. The animat has turtle geometry, i.e. it has two wheels the speeds of which are individually controlled.

The mission of the Animat is to explore its world and stay alive. The animat must go to its home base to recharge its batteries every 60 seconds. If 60 seconds have elapsed since the last recharge and the animat has not returned to the home base, it will stop functioning. The animat pays the recharging of its batteries with pellets that it collects as it wanders around its world. The animat is not allowed to touch the boundaries of its world.

The animat has no prior knowledge of the world it lives in. All decisions it makes are based on input from its sensors: two laser range sensors (error margin 10%) in the front, a homing beacon (an angle to the home base, error margin 10%), a clock and a recharging station detector (indicates, whether the animat has reached its home base). Based on the sensory input, the animat acts based on the behaviors programmed into it. The laser sensors detect the home base as an obstacle, but are not able to determine that the obstacle is in fact the home base.

The animat could theoretically live forever in this world, because every time the animat picks up a pellet another pellet appears at a random location in the world. The animat can carry multiple pellets at a time.


The animat's behaviors, from highest priority behavior to the lowest priority one are displayed in the below picture as a subsumption diagram. The longer the box, the stronger the behavior.
Diagram of the animat's behaviors

Behavior descriptions: When sensors activate a behavior that has higher priority than the one that is currently running, the higher-priority behavior subsumes (overrides) the lower-priority behavior.

To drive the animat, there are motion directives like e.g. move forward, turn left and turn right. These are invoked from within the above behaviors.

The Real World

If the real world resembled the environment in which this robot lives, then the robot would have every chance of surviving. Of course, after a while, the robot would need maintenance for its mechanical units, for example something like an oil change. Also, in the real world one can count on having a mechanical failure sooner or later. For example, one of the robot's sensors might break down, or perhaps some equipment at the recharging station might break down.

Besides the mechanical problems, there are many other things that might go wrong. The recharging station might not be open 24 hours a day every day, which would create a need for a power save mode (the robot would be idle and in a low power mode when the recharging station is closed). Also, the station could start demanding more than one pellet for every recharge, in which case the robot might run out of pellets and power.

If the world were larger, the robot would be limited in its operations in at least two ways: it could not go any further than 30 seconds from the recharging station, because otherwise it would run out of power. Also, the range of the homing beacon would be limited in the real world, so the robot would not know in which direction the recharging station is if the robot was too far away from it.

© Luka Milovanov and Seppo Virtanen 1999.
This page has been viewed times since April 7th 1999.
Valid HTML 3.2!