A simple exploration robot

An application of the UF Library, v1.2.4

NOTE: Version 1.2.4 of UFLibrary has now been released, and it can be downloaded HERE.

Introduction

The UFLibrary is a software library, which implements the utility function (UF) method of behavioral selection for autonomous robots. In short, the UF method, as implemented in the UFLibrary, v1.2.4,

* Note: the term robotic brain is used instead of control system, as the latter term implies a more limited system based completely on classical control theory.

Description

UFLibrary is developed in object-oriented Pascal, and consists of more than 25,000 lines of code, contained in 81 source units. A complete description of all units is available in the reference manual for the UFLibrary. In addition, as a code example, one of the behaviors used in the paper submitted to IJAIT ([1]) can be downloaded here, namely the behavior locate charging station. The aim of UFLibrary is to provide researchers in the field of behavior-based robotics with a general tool for behavioral selection, capable of selecting appropriately from repertoires of simple behaviors and involving a minimum of parameter-tuning by the experimenter. The philosophy behind the UF method (and thus the UFLibrary), is that the user should only be required to write the basic behaviors, and that these should be as simple as possible, leaving the complicated issue of behavioral selection to the UF method, as implemented in the UFLibrary. Thus, the method makes possible the generation of robots exhibiting complex (and useful) overall behavior, without requiring that the user should solve the difficult problems of writing complex behaviors and specifying their relative merits in different situation. A typical application of the UF method proceeds as follows:

  1. The user lists and implements the needed behaviors that are to be included in the behavioral repertoire. Of course, it is also possible to use the pre-defined behaviors (e.g. obstacle avoidance) present in the UFLibrary. In addition, the variation of any hormone functions should be defined.

  2. The user writes a definition file for the robot, consisting of one part defining the body of the robot (which, of course, can be reused in many applications), and one part describing the structure of the robotic brain, i.e. the behavioral hierarchies. (This is often quite straightforward. As an example, see the description provided in the paper submitted to IJAIT [1]). For each behavior, the available state variables are specified. An example of a definition file for a robot is the UFLibDemoRobot.txt file, and the associated file UFLibDemoRoboticBrain.txt, describing the robotic brain (in principle, the entire definition of the robot can be placed in one file but, for clarity, brain and body have been separated here). The sample files are located in the subfolder Data that, in turn, is contained in the UFLibDemo.zip archive.

  3. The user defines an arena, using a specific format understood by UFLibrary. An example (the one used in the UFLibDemo application) is given in the file UFLibDemoArena.txt (available in the subfolder Data, contained in the UFLibDemo.zip archive).

  4. The user specifies an evaluation setup, defining the training and validation simulations as well as the method by which the overall (combined) fitness is formed.

  5. The user defines the evolutionary algorithm.
  6. The user writes and compiles the actual program, linking the UFLibrary to the program. The program UFLibDemo.exe, contained in the UFLibDemo.zip archive, was used for generating the results shown in the submitted paper ([1]).

At a first glance, the procedure just described might seem cumbersome. However, one should keep in mind that (1) The entire machinery for behavioral selection is contained in the UFLibrary. Thus, the user need only be concerned with the task of providing the individual behaviors, as well as a few definition files which, normally, can be based on templates, and are thus quick to write, (2) One of the main ideas with the UFLibrary is to allow the user to write his or her own applications, suitable to the task at hand: It is our experience that every new investigation will differ from previous ones to such an extent that it is impossible to generate, once a for all a single program useful for all investigations. Instead, a library (the UFLibrary) is provided, (3) (most important) Behavioral organization is a difficult problem, and a general solution to that problem is bound to reach a certain degree of complexity.

Even though the application implemented in this particular example is quite simple, it is our hope that the reader will be able (through this example) to see the power of this method. With the UF method, implemented in the UFLibrary, we believe it will be possible to generate progressively more complex (and thus, more useful) robotic brains for behavior-based robots.

Installing and running the program

Installing the program is very simple. Just download the UFLibDemo.zip, right-click on the corresponding icon, and choose "extract to here" (assuming that you have WinZip installed on your computer). The extraction procedure will generate the executable (UFLibDemo.exe) and a setup file ("setup.txt". NOTE: do not edit or remove the setup file), as well as a folder (Data/) containing the definition files, i.e. the arena file (UFLibArena.txt), the robot body (UFLibRobot.txt), the robotic brain structure file (UFLibRoboticBrain.txt), the evolutionary algorithm (UFLibEA.txt), and the evaluation file (UFLibEvaluation.txt). The source of the program is distributed in two versions: (1) Borland Delphi 5 and (2) Turbo Delphi 2006, where the latter is available (for free) at http://www.turboexplorer.com/ (it should also be compatible with Borland's commercial product, Borland Developer Studio 2006). Either of these must be available in order to compile the UFLibDemo executable. However, since the executable is included in the distribution, neither is required for just running the UFLibDemo program.

After installation, run the program by clicking on the program icon associated with the file UFLibDemo.exe. The following window will appear:

UFLib demo (simulation window)

Fig. 1 The simulation window of the UFLibDemo program. The parameters shown are the default values.

To run the program, just click Initialize and then Run. You can, of course, easily change the parameter settings, should you wish to do so. In order to inspect the performance of the best robot obtained, click Inspect. Note that the evolutionary algorithm (EA) must first complete the present generation before inspection is allowed. The status of the program is indicated in the Status box below the buttons. When the text in the status box changes to Paused., click the Inspect button. The best individual is then re-evaluted, and its motion is shown, in 3D, in the window.When the re-evaluation has been completed, click Run to resume the run, or End to end it.

The program will generate a folder (named according to the time when the run was started, as obtained from the system clock), containing some files with results. The RunResultsSummary file contains, as the name implies, a summary of the performance of the results obtained during the run. In addition, a file (Robot_Gen_X.txt, where X is the generation at which the re-evaluation took place) is generated for each re-evaluation (i.e. when the button Inspect is clicked). In this file, the utility functions are given (Note: All state variables are called x_i, i=1,... in this file, regardless of their type), as well as their variation over time. Plotting the utility functions, it is possible to check the behavioral switching dynamics taking place during the evaluation of the robot. In addition, the position and angle of heading for the robot are listed, as functions of time. Finally, the battery level is listed, as a function of time. The format of all data in the text files is such that it is easily imported into Mathematica.

Notes on usage:

Running the program Note that the program is quite demanding, as regards CPU resources. In order to reduce the priority of the program, open the task manager (CTRL-Alt-Delete), choose Processes, right-click on the UFLibDemo.exe, select Set Priority, and, finally, set the priority to either BelowNormal or Low. (If the computer is equipped with multiple CPUs, this procedure might not be needed.)

Textures Note also that textures have not been added in this demo, to minimize the computational demands. However, it is easy to add any textures one might like, by simply adding the relative path to the image of the texture in the UFLibDemoArena.txt file. The path to the image should be relative to the file UFLibDemoArena.txt. For example, in order to add a texture FloorTexture.jpg (located in a subfolder called Textures) to the floor, change the section in UFLibDemoArena.txt so that the part defining the floor reads:

object Floor: TFloor
  Position = 7.500 7.500 0.000
  Velocity = 0.000 0.000 0.000
  Angle = 0.000
  Height = 0.000
  Mass = -1.000
  RGBColor = 0 0 0
  Texture = 'Textures\FloorTexture.jpg'
  Length = 5.000
  Width = 5.000
  TileLength = 1.000
  TileWidth = 1.000
end

and run the program again. Upon inspection, the texture will be visible on the floor. A sample arena (without textures) is shown below. For optimal performance, the width and height of a texture image should be powers of 2 (i.e. 64x64, 128x256, 256x256, etc.). 

Fig. 2 A typical screenshot from a run of UFLibDemo.exe.

Movies

Two movies (one large and one smaller in size), showing the motion of typical an evolved individual, can be downloaded here and here. Note: To run the film, you will need the video codec "Microsoft Windows Media Video 9", which can be downloaded here.

References

[1]    Pettersson, J. and Wahde, M. UFLibrary: A Simulation Library Implementing the Utility Function Method for Behavioral Organization in Autonomous Robots, submitted (2005) to International Journal on Artificial Intelligence Tools (IJAIT).