Webots User Guide

previous page go up next page

Foreword

Thanks

1.Installing Webots

2.Upgrading from Webots 2

3.Getting Started with Webots

4.Tutorial: Modelling and simulating your robot

5.Robot and Supervisor Controllers

6.Tutorial: Using the KheperaTM robot

7.ALife Contest

     

7.4 How to Enter the Contest

If you are willing to challenge the other competitors of the contest, here is the detailed procedure on how to enter the ALife contest. You will need either a Windows or a Linux machine to program your robot controller.

7.4.1 Obtaining the software

All the software for running the contest may be obtained free of charge.

  • The Webots software to be used for the contest is available from the Webots download page. This is an evaluation version of Webots which contains all the necessary material to develop a robot controller for the contest, except the Java environment. Follow the instructions on the Webots download page to install the Webots package.

  • The Java 2 Standard Edition (J2SE) Software Development Kit (SDK) may be downloaded from Sun web site for free. Please use the version 1.4 of the SDK. Follow the instructions from Sun to install the SDK.

7.4.2 Running the software

Launch Webots and open the world named alife.wbt. Click on the run to start the simulation. You will see two robots moving around in the world. Each robot is controlled by a Java program named respectively ALife0 and ALife1 located in the Webots controllers directory. You may enter their directory and have a look a the source code of the programs.

On Windows, you may need to edit the ALife0.bat and ALife1.bat files to set correct paths to the Webots directory and possibly to the java executable.

7.4.3 Creating your own robot controller

The simpliest way to create your own robot controller is to start from the existing ALife0 or ALife1 controllers.

Installation

It is safer and cleaner to install a local copy of the material you will need to modify while developing your intelligent controller. Here is how to proceed:

  1. Create a working directory which you will store all your developments. Let's call this directory my_alife. It may be in your Linux home directory or in your Windows My Documents directory or somewhere else.

  2. Enter this directory and create two subdirectories called controllers and worlds.

  3. Copy the file alife.wbt from the Webots worlds directory to your own worlds you just created. Copy also the the alife directory and all its contents from the Webots worlds directory to your own worlds directory. You may replace the images Alife0.png and Alife1.png in the alife directory by your own custom images. These images are actually texture flags associated to the robots. Their size must be 64x64 pixels with 24 or 32 bits depth.

  4. Copy the whole ALife0 directory from the Webots controllers directory to your own controllers directory you just created. Repeat this with the ALife1 directory. This way you could modify the example controllers without loosing the original files.

  5. In order to indicate Webots where the files are, launch Webots, go to the File menu and select the Preferences... menu item to open the Preferences window. Select the Files and paths tab. Set alife.wbt as the Default world and indicate the absolute path to your my_alife directory, which may be /home/myname/my_alife on Linux or C:\My Documents\my_alife on Windows.

From there, you can modifiy the source code of the controllers in your controllers directory, recompile them and test them with Webots.

Modifiying and Compiling your controller

If you know a little bit of Java, it won't be difficult to understand the source code of the ALife0 and ALife1 controllers, which are stored respectively in the ALife0.java and ALife1.java. You may use any standard Java objects provided with the Java SDK. The documentation for the Controller class is actually the same as for the C programming interface, since all the methods of the Controller class are similar to the C functions of the Controller API described in the Webots Reference Manual, except for one function, robot_live which is useless in Java. Before modifying a controller, it is recommanded to try to compile the copy of the original controllers.

To compile the ALife0 controller, just go to the ALife0 directory and type the following on the command line:

javac -classpath "C:\Program Files\Webots\lib\Controller.jar;." ALife0.java on Windows.

javac -classpath "/usr/local/webots/lib/Controller.jar:." ALife0.java on Linux.

If everything goes well, it should produce a new ALife0.class file that will be used by Webots next time you launch it (or reload the alife.wbt world).

Now, you can start developing! Edit the ALife0.java, add lines of code, methods, objects. You may also create other files for other objects that will be used by the ALife0 class. Test your controller in Webots to see if it performs well and improve it as long as you think it is necessary.

7.4.4 Submitting your controller to the ALife contest

Once you think you have a good, working controller for your robot, you can submit it to the online contest. In order to proceed, you will have to find a name for your robot. Let's say "MyBot" (but please, choose another name). Copy your ALife0.java to a file named MyBot.java. Edit this new file and replace the line:

public abstract class ALife0 extends Controller {

by:

public abstract class MyBot extends Controller {

Save the modified file and compile it using a similar command line as seen previously. You should get a MyBot.class file that you could not test, but that will behave the same way as ALife0.class.

Register to the contest from the main contest web page, providing "MyBot" as the name of the robot. Then, upload all the necessary files in your MyBot directory. This includes the following:

  • MyBot.class file and possibly some other .class files corresponding to other java objects you created (it is useless to upload the ALife0.class file)

  • A text file named description.txt of about 10 lines that may include some HTML tags, like hyperlinks.

  • A PNG image named flag.png that will be used as a texture to decorate your robot, so that you can recognize it from the webcam. This image should be a 64x64 pixels with a bit depth of 24 or 32.

That's it. Once this material uploaded, your robot will automatically enter the competition with an initial score of 10. A contest supervisor program will use you controller to run matches and update your score and position in the hall of fame. You can check regularly the contest web site to see how your robot performs.

previous page go up next page
^ page top ^

  E-mail to webmaster Last updated: Copyright © 2002 Cyberbotics Ltd.