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

     

10.7 Transfer to real robot

In this section, we address the question of how to use your controller, written using the Webots controller API, with your real Aibo robot. There are typically two ways to do that:

  • cross-compilation mode, wherein the controller code is cross-compiled to produce a binary executable which then runs on the real robot directly;

  • remote-control mode, wherein the controller runs as part of the Webots simulation engine, but commands are forwarded to and feedback obtained from the live robot by means of a remote (wireless) connection, effectively emulating direct remote execution.

Only the cross-compilation method is supported in Webots.

10.7.1 Cross-compilation

Software for the Aibo robot is written using Sony's proprietary object-oriented API called OPEN-R. Webots controller source is written in C or C++ using Webots' controller API. The basic idea of cross-compilation is this: an OPEN-R wrapper object running on Aibo translates all Webots robot controller API calls into OPEN-R instructions for the live robot. Because OPEN-R programs are written in C++, it is actually rather straightforward to combine the Webots controller program with the OPEN-R wrapper object to obtain a binary code executable on the live robot. Diagrams of this procedure are shown in figure 10.14.

Important: The actual cross-compiler is Sony's OPEN-R cross-compiler, included in the OPEN-R SDK available for download from the official OPEN-R website. In order to take advantage of controller cross-compilation in Webots, the OPEN-R SDK must therefore be installed first.

aibo-cross-fig

Figure 10.14: Aibo cross-compilation scheme

Cross-compiling your controller

For the sake of simplicity, we will describe the cross-compilation procedure on the default ers210 controller for the Aibo ERS-210 which comes with Webots (see subsection 10.6.2). It is quite straight-forward to adapt the procedure described here to any other Aibo controller.

The default Aibo ERS-210 controller is located in the projects / robots / aibo / controllers / ers210 directory. The controller code is contained in the ers210.c file. There are two makefiles:

  • Makefile is for the compilation of the controller for simulated execution;

  • Makefile.openr creates a binary object executable on Aibo.

The source code files to be compiled by both makefiles are listed in Makefile.sources.

For cross-compilation, the transfer / openr directory contains intermediate cross-compiled files for the Controller OPEN-R object. The Makefile.openr makefile compiles all source code files specified in Makefile.sources (.c, .cc or .cpp) using Sony's cross-compiler and links them with the already existing files. If there is not yet a directory called OPEN-R/ in the controller directory, a default OPEN-R/ directory is copied from transfer/openr/. Calling

$ make -f Makefile.openr clean

will remove this OPEN-R/ directory. The controller binary file CONTROLL.BIN resulting from the controller cross-compilation is then placed into the OPEN-R / MW / OBJS subdirectory in the controllers / ers210 controller directory. The binary files for the other remote software objects are also located in this target subdirectory. (Initially, the CONTROLL.BIN binary corresponds to a void controller.) Four MTN motion sequence files are already present in OPEN-R / MW / DATA / P, and thus do not need to be uploaded separately.

Important: The files in the OPEN-R/ directory must not be modified, renamed, moved or deleted. This OPEN-R/ directory may be directly copied to the Memory stick in order to install the remote software together with the cross-compiled controller. If you have already set up the remote software, as explained in section 10.2 (subsection 10.2.2 in particular), you need only copy the OPEN-R/MW/OBJS/CONTROLL.BIN controller binary file to the corresponding location on the Memory stick, or use the Cross feature of the Control Panel (see subsection 10.5.1).

Using external data files in cross-compiled controllers

When cross-compiling a controller which reads or writes to external data files, such as MTN motion sequence definition files, it is a good idea to reference them by filename only (no absolute or relative paths), e.g.:

MTN* mtn = mtn_new("WWFWD.MTN");

instead of the usual:

MTN* mtn = mtn_new("../../data/mtn/ers210/WWFWD.MTN");

Otherwise, Aibo will not be able to find the file. To run such a controller in simulation, e.g., a controller which uses MTN playback, you must have the external files in the same directory as your controller; you can either make a local copy of the file(s), or (if you're running Linux) simply create soft links. To run the controller on the real robot, you must also copy the required data files to the Memory stick.

Important: Remember: all Aibo data files are located in the / MS / OPEN-R / MW / DATA / P directory on the Memory stick. This is where you need to copy any MTN file your controller uses if you want to do it by hand; using the MTN Upload functionality of the Control Panel uploads the file automatically to the correct location.

previous page go up next page
^ page top ^

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