Webots User Guide

previous page go up next page

Foreword

Thanks

1. Installing Webots

2. Getting Started with Webots

3. Sample Webots Applications

4. Tutorial: Modeling and simulating your robot

5. Programming Controllers and Plugins

6. Using the e-puck robot

7. Using the KheperaTM robot

8. Using the IPRTM robots

9. Using the LEGO MindstormsTM robots

10. Using the AiboTM robots

11. Robot Soccer Lab

     

9.2 Transfering to the real Rover robot

9.2.1 leJOS

Now that you have a simulation model running, you may transfer it to the real robot to see if it behaves the same way. In order to proceed, you will need to install the leJOS software. The leJOS software is a replacement firmware for the LEGOTM MindstormsTM RCX brick. It is a Java Virtual Machine (JVM) that fits into the 32KB memory on the RCX, thus allowing you to program your RCX in Java. The leJOS software is included on the Webots CD-ROM. Windows users will find a Windows version named lejos_win32_2_1_0.zip in the devel subdirectory of the windows directory. Macintosh and Linux users will find a source version named lejos_2_1_0.tar.gz in the devel subdirectory of the common directory. The documentation, including installation instructions, is located in the common / doc / robots / rcx directory. Please take some time to read this documentation and understand how leJOS works. leJOS is also available from the leJOS web site.

9.2.2 Installation

Once you have installed leJOS, as described in the installation instructions, you will have to upload the leJOS firmware into the RCX brick, replacing the LEGOTM operating system. Please follow the leJOS instructions to perform this installation. Note that you can easily revert to the LEGOTM operating system using the LEGOTM CD-ROM. Finally, you will have to set the LEJOS_HOME environment variable to point to the location where leJOS was installed. It is also necessary to add the leJOS bin directory into your PATH environment variable, so that you can use the leJOS tools from the command line.

9.2.3 Cross-compilation and upload

If everything was installed properly, cross-compilation and upload should be an easy task. Be sure that your robot is ready to receive a leJOS program. Go to the Rover controller directory and simply type make -f Makefile.lejos to launch the cross-compilation and upload processes. Note that it may be necessary to perform a make clean first to remove any class files used for simulation. The cross-compilation process uses a different class file. Upload should happen just after cross-compilation, and you should then be able to run your controller on the real Rover robot.

9.2.4 How does it work ?

The Makefile.kros links your controller with a special Java wrapper class named Controller. This class is located in the Webots lib directory, in the RCXController.jar archive. It is a simple wrapper class between Webots' Java API and the leJOS API. Thanks to this system, the same Java source code can be used for both simulated robots and real robots. However, you should read the limitations of the leJOS Java implementation carefully in order to avoid using Java features or libraries that are not supported by leJOS.

previous page go up next page
^ page top ^

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