# Cyberbotics' Robot Curriculum/E-puck and Webots

This chapter introduces you to a couple of useful robotics tools: e-puck, a mini mobile robot and Webots, a robotics CAD software. In the rest of this book, you will use both of them to practice hands-on robotics. Hopefully, this practical approach will make you understand what robots are and what you can do with them.

## E-puck
### Introduction

The e-puck robot was designed by Dr. Francesco Mondada and Michael Bonani in 2006 at EPFL, the Swiss Federal Institute of Technology in Lausanne (see Figure). It was intended to be a tool for university education, but is actually also used for research. To help the creation of a community inside and outside EPFL, the project is based on an open hardware concept, where all documents are distributed and submitted to a license allowing everyone to use and develop for it. Similarly, the e-puck software is fully open source, providing low level access to every electronic device and offering unlimited extension possibilities. The e-puck robots are now produced industrially by GCTronic S.à.r.l. (Switzerland) and Applied AI, Inc. (Japan) and are available for purchase from various distributors. You can order your own e-puck robot for about 950 Swiss Francs (CHF) from Cyberbotics Ltd.
The e-puck robot was designed to meet a number of requirements:
* Neat Design: the simple mechanical structure, electronics design and software of e-puck is an example of a clean and modern system.
* Flexibility: e-puck covers a wide range of educational activities, offering many possibilities with its sensors, processing power and extensions.
* Simulation software: e-puck is integrated in the Webots simulation software for easy programming, simulation and remote control of real robot.
* User friendly: e-puck is small and easy to setup on a table top next to a computer. It doesn't need any cable (rely on Bluetooth) and provides optimal working comfort.
* Robustness and maintenance: e-puck resists to student use and is simple to repair.
* Affordable: the price tag of e-puck is friendly to university budgets.
The e-puck robot has already been used in a wide range of applications, including mobile robotics engineering, real-time programming, embedded systems, signal processing, image processing, sound and image feature extraction, human-machine interaction, inter-robot communication, collective systems, evolutionary robotics, bio-inspired robotics, etc.

### Overview

The e-puck robot is powered by a dsPIC processor, i.e., a Digital Signal Programmable Integrated Circuit. It is a micro-controller processor produced by the Microchip company which is able to perform efficient signal processing. This feature is very useful in the case of a mobile robot, because extensive signal processing is often needed to extract useful information from the raw values measured by the sensors.
The e-puck robot also features a large number of sensors and actuators as depicted on the pictures with devices and described in the table. Each of these sensors will be studied in detail during the practical investigations later in this book.
Features of the e-puck robot :
| Features | Technical information |
| Size, weight | 70 mm diameter, 55 mm height, 150 g |
| Battery autonomy | 5Wh LiION rechargeable and removable battery providing about 3 hours autonomy |
| Processor | dsPIC 30F6014A @ 60 MHz (~15 MIPS) 16 bit microcontroller with DSP core |
| Memory | RAM: 8 KB; FLASH: 144 KB |
| Motors | 2 stepper motors with a 50:1 reduction gear, resolution: 0.13 mm |
| Speed | Max: 15 cm/s |
| Mechanical structure | Transparent plastic body supporting PCBs, battery and motors |
| IR sensors | 8 infra-red sensors measuring ambient light and proximity of objects up to 6 cm |
| Camera | VGA color camera with resolution of 480x640 (typical use: 52x39 or 480x1) |
| Microphones | 3 omni-directional microphones for sound localization |
| Accelerometer | 3D accelerometer along the X, Y and Z axis |
| LEDs | 8 independent red LEDs on the ring, green LEDs in the body, 1 strong red LED in front |
| Speaker | On-board speaker capable of WAV and tone sound playback |
| Switch | 16 position rotating switch on the top of the robot |
| PC connection | Standard serial port up to 115 kbps |
| Wireless | Bluetooth for robot-computer and robot-robot wireless communication |
| Remote control | Infra-red receiver for standard remote control commands |
| Expansion bus | Large expansion bus designed to add new capabilities |
| Programming | C programming with free GNU GCC compiler. Graphical IDE (integrated development environment) provided in Webots |
| Simulation | Webots facilitates the use of the e-puck robot: powerful simulation, remote control, graphical and C programming systems |

## Webots
### Introduction

Webots is a software for fast prototyping and simulation of mobile robots. It has been developed since 1996 and was originally designed by Dr. Olivier Michel at EPFL, the Swiss Federal Institute of Technology in Lausanne, Switzerland, in the lab of Prof. Jean-Daniel Nicoud. Since 1998, Webots is a commercial product and is developed by Cyberbotics Ltd. User licenses of this software have been sold to over 400 universities and research centers world wide. It is mostly used for research and education in robotics. Besides universities, Webots is also used by research organizations and corporate research centers, including Toyota, Honda, Sony, Panasonic, Pioneer, NTT, Samsung, NASA, Stanford Research Institute, Tanner research, BAE systems, Vorverk, etc.
The use of a fast prototyping and simulation software is really useful for the development of most advanced robotics project. It actually allows the designers to visualize rapidly their ideas, to check whether they meet the requirements of the application, to develop the intelligent control of the robots, and eventually, to transfer the simulation results into a real robot. Using such software tools saves a lot of time while developing new robotics projects and allows the designers to explore more possibilities than they would if they were limited to using only hardware. Hence both the development time and the quality of the results are improved by using a rapid prototyping and simulation software.

### Overview

Webots allows you to perform 4 basic stages in the development of a robotic project as depicted on the figure.
The first stage is the modeling stage. It consists in designing the physical body of the robots, including their sensors and actuators and also the physical model of the environment of the robots. It is a bit like a virtual LEGO set where you can assemble building blocks and configure them by changing their properties (color, shape, technical properties of sensors and actuators, etc.). This way, any kind of robot can be created, including wheeled robots, four legged robots, humanoid robots, even swimming and flying robots! The environment of the robots is created the same way, by populating the space with objects like walls, doors, steps, balls, obstacles, etc. All the physical parameters of the object can be defined, like the mass distribution, the bounding objects, the friction, the bounce parameters, etc. so that the simulation engine in Webots can simulate their physics. The figure with the simulation illustrates the model of an e-puck robot exploring an environment populated with stones. Once the virtual robots and virtual environment are created, you can move on to the second stage.
The second stage is the programming stage. You will have to program the behavior of each robot. In order to achieve this, different programming tools are available. They include graphical programming tools which are easy to use for beginners and programming languages (like C, C++ or Java) which are more powerful and enable the development of more complex behaviors. The program controlling a robot is generally a endless loop which is divided into three parts: (1) read the values measured by the sensors of the robot, (2) compute what should be the next action(s) of the robot and (3) send actuators commands to performs these actions. The easiest parts are parts (1) and (3). The most difficult one is part (2) as this is here that lie all the Artificial Intelligence. Part (2) can be divided into sub-parts such as sensor data processing, learning, motor pattern generation, etc.
The third stage is the simulation stage. It allows you to test if your program behaves correctly. By running the simulation, you will see you robot executing your program. You will be able to play interactively with you robot, by moving obstacles using the mouse, moving the robot itself, etc. You will also be able to visualize the values measured by the sensors, the results of the processing of your program, etc. It is likely you will return several times to the second stage to fix or improve your program and test it again in the simulation stage.
Finally, the fourth stage is the transfer to a real robot. Your control program will be transferred into the real robot running in the real world. You could then see if your control program behaves the same as in simulation. If the simulation model of your robot was performed carefully and was calibrated against its real counterpart, the real robot should behave roughly the same as the simulated robot. If the real robot doesn't behave the same, then it is necessary to come back to the first stage and refine the model of the robot, so that the simulated robot will behave like the real one. In this case, you will have to go through the second and third stages again, but mostly for some little tuning, rather than redesigning your program. The figure with two windows shows the e-puck control window allowing the transfer from the simulation to the real robot. On the left hand side, you can see the point of view of the simulated camera of the e-puck robot. On the right hand side, you can see the point of view of the real camera of the robot.