Webots User Guide - chapter 8 - section 1

Webots User Guide


8.1 Using the e-puck robot

In this section, you will learn how to use Webots with the e-puck robot (figure 8.1). E-puck is a miniature mobile robot originally developed at the EPFL for teaching purposes by the designers of the successful Khepera robot. The hardware and software of e-puck is fully open source, providing low level access to every electronic device and offering unlimited extension possibilities. The official e-puck web site provides the most up-to-date information about this robot. E-puck is also available for purchase from Cyberbotics Ltd.

8.1.1 Overview of the robot

e-puck_real

Figure 8.1: The e-puck robot at work

E-puck was designed to fulfill the following requirements:

E-puck is equipped with a large number of devices, as summarized in table 8.1.

FeatureDescription
Size7.4 cm in diameter, 4.5 cm high
Weight150 g
Batteryabout 3 hours with the provided 5Wh LiION rechargeable battery
ProcessorMicrochip dsPIC 30F6014A @ 60MHz (about 15 MIPS)
Motors2 stepper motors with 20 steps per revolution and a 50:1 reduction gear
IR sensors8 infra-red sensors measuring ambient light and proximity of obstacles in a 4 cm range
Cameracolor camera with a maximum resolution of 640x480 (typical use: 52x39 or 640x1)
Microphones3 omni-directional microphones for sound localization
Accelerometer3D accelerometer along the X, Y and Z axis
LEDs8 red LEDs on the ring and one green LED on the body
Speakeron-board speaker capable of playing WAV or tone sounds.
Switch16 position rotating switch
BluetoothBluetooth for robot-computer and robot-robot wireless communication
Remote Controlinfra-red LED for receiving standard remote control commands
Expansion busexpansion bus to add new possibilities to your robot
ProgrammingC programming with the GNU GCC compiler system
SimulationWebots EDU or PRO facilitates the programming of e-puck with a powerful simulation, remote control and cross-compilation system.

Table 8.1: e-puck features

8.1.2 Simulation model

e-puck_simulation

Figure 8.2: The e-puck model in Webots

The e-puck model in Webots is depicted in figure 8.2. This model includes support for the differential wheel motors (encoders are also simulated), the infra-red sensors for proximity and light measurements, the accelerometer, the camera, the 8 surrounding LEDs, the body and front LEDs; the other e-puck devices are not yet simulated in the current model. The table table 8.2 displays the names of the simulated devices which are to be used as an argument of the function wb_robot_get_device() (see the Robot section of Reference Manual).

DeviceName
Differential wheelsdifferential wheels
Proximity sensorsps0 to ps7
Light sensorsls0 to ls7
Floor sensorsfs0, fs1 and fs2
LEDsled0 to led7 (e-puck ring), led8 (body) and led9 (front)
Cameracamera
Accelerometeraccelerometer

Table 8.2: Devices names

Main specificationsValues
Robot radius37 mm
Wheel radius20.5 mm
Axle length52 mm
Encoder resolution159.23
Speed unit0.00628 rad/s
Maximum angular speed1000 units

Table 8.3: e-puck specifications

The e-puck dimensions and speed specifications are shown in table 8.3. The functions wb_differential_wheels_set_speed(), wb_differential_wheels_get_left_encoder() and wb_differential_wheels_get_right_encoder() will allow you to set the speed of the robot and to use its encoders.

Devicex (m)y (m)z (m)Orientation (rad)
ps00.0100.033-0.0301.27
ps10.0250.033-0.0220.77
ps20.0310.0330.000.00
ps30.0150.0330.0305.21
ps4-0.0150.0330.0304.21
ps5-0.0310.0330.003.14159
ps6-0.0250.033-0.0222.37
ps7-0.0100.033-0.0301.87
camera0.0000.028-0.0304.71239

Table 8.4: Devices orientations

As is the case for any Differential Wheels robot set at its default position in Webots, the forward direction of the e-puck is given by the negative z-axis of the world coordinates. This is also the direction the eye of the camera is looking to; in keeping with the VRML standard, the direction vector of the camera is pointing in the opposite direction, namely the direction of the positive z-axis. The axle's direction is given by the positive x-axis. Proximity sensors, light sensors and LEDs are numbered clockwise; their location and orientation are shown in table 8.3 and table 8.4. The last column of table 8.4 lists the angles between the negative x-axis and the direction of the devices, the plane zOx being oriented counter-clockwise. Note that the proximity sensors and the light sensors are actually the same devices of the real robot used in a different mode, so their direction coincide. Proximity sensors responses are simulated in accordance with the lookup table in figure 8.3; this table is the outcome of calibration performed on the real robot.

e-puck_distance_sensor_lookup_table

Figure 8.3: Proximity sensor response against distance

The resolution of the camera was limited to 52x39 pixels, as this is the maximum rectangular image with a 4:3 ratio which can be obtained from the remote control interface with the real robot.

The standard model of the e-puck is provided in the EPuck.proto prototype file which is located in the resources/projects/robots/e-puck/protos directory of the Webots distribution (see also EPuck_DistanceSensor.proto); you will find complete specifications in it.

e-puck_sensors_leds_and_camera

Figure 8.4: Sensors, LEDs and camera

Several simulation examples are located in the projects/robots/e-puck/worlds directory of the Webots distribution. The e-puck_line.wbt world (see figure 8.5) especially examplifies the use of floor sensors. Floor sensors can be added to a real e-puck robot by inserting a special extension card with three sensors just below the camera of the robot. These sensors are actually simple infra-red sensors which allow the e-puck robot to see the color level of the ground at three locations in a line across its front. This is particularly useful for implementing line following behaviors. The e-puck_line controller program contains the source code for a simple line following system which, as an exercise, can be improved upon to obtain the behavior demonstrated in the e-puck_line_demo.wbt demo, in which the e-puck robot is able to follow the line drawn on the floor, but also to avoid obstacles and return to the line following behavior afterwards. This model was contributed by Jean-Christophe Zufferey from the EPFL, who sets up a series of exercises with Webots and extended e-puck robots.

e-puck_line

Figure 8.5: An e-puck extension for line following

The directory webots/projects/samples/curriculum contains a rich collection of simulations involving the e-puck robot. You will find inside it all the worlds and controllers corresponding to the exercices of Cyberbotics robotics curriculum. Written in collaboration with professors and master students of EPFL, Cyberbotics curriculum is an educational document intended for all level of learnings in robotics. It addresses a dozen of topics ranging from finite state automata to particle swarm optimization, all illustated through the real or the simulated e-puck robot; you can browse it here. The e-puck models of Webots distribution are open source and you are welcome to modify them. If you develop a useful modification and would like to share it, please let us know so that we can improve these models using your contribution.

8.1.3 Control interface

Control window

e-puck_control

Figure 8.6: The e-puck control window for simulation

When opening a world containing an e-puck robot, Webots displays the e-puck control window (which also appears when you double-click on the e-puck robot). This window is depicted in figure 8.6. It allows visualizing the devices of the robot. The distance measurements are displayed in red, outside the body of the robot. The light measurements are displayed in yellow, above the distance measurements. The 10 LEDs are displayed in black when off and red (or green) when on. The motor speeds are displayed in blue, and the motor position is displayed in the Encoder box in the bottom right hand corner of the window. The camera image (if present), the floor sensor values (if present) and the accelerometer values are displayed in the corresponding boxes on the right side of the window.

This e-puck control window appears because the robotWindow field of the DifferentialWheel node in the world file was set to "libepuckwindow". Changing this robotWindow to an empty string will disable this control window.

BotStudio

BotStudio is a user interface for programming graphically the e-puck thanks to a finite state automaton. Behaviors such as wall follower, collision avoider or line follower can be implemented quickly thanks to this interface. BotStudio is typically destinated for the education field, particularly for beginners in robotics.

An automaton state of BotStudio corresponds to a state of the e-puck actuators while a transition corresponds to a condition over its sensor values. A transition is fired when all of its conditions are fulfilled (logical AND). A logical OR can be performed by several transitions between two states.

The actuators available in BotStudio are the LEDs and the motors. Each automaton state have two sliders for setting the motor speed value. Note that these values can be unset by clicking on the cursor of the slider. Each state have also 10 square buttons for setting the LEDs states. A red button means the LED is turned on, a black one means it is turned off and a grey one means there is no modification.

The sensor available in BotStudio are the distance sensors and the camera. Moreover a timer can be used to temporize the conditions by dragging the corresponding slider. Conditions over the IR sensors can be set by dragging the 8 red sliders. A condition can be reversed by clicking on the grey part of the slider. Finally, the camera is used for giving a clue on the front environment of the e-puck. An algorithm is applied on the last line of the camera and returns a integer between -10 and 10 indicating if a black line is perceived respectively at the left and at the right of the e-puck field of view. A condition can be set on this value for getting a line follower behavior.

BotStudio is depicted in the figure figure 8.7. An example of BotStudio can be found by opening the projects/robots/e-puck/world/e-puck_botstudio.wbt world file.

The BotStudio windows appears when the e-puck's controller points on a .bsg file.

e-puck_botstudio

Figure 8.7: BotStudio

Bluetooth remote control

E-puck has a Bluetooth interface, allowing it to communicate with Webots. This Bluetooth interface must be set up according to your operating system, following the instructions of the e-puck robot. It has been tested successfully under Windows, Linux and Mac OS X. Once properly set up, your Bluetooth connection to your e-puck should appear in the popup menu of the control. If it doesn't appear there, it means that your computer was not properly configured to interface with your e-puck robot through Bluetooth. Please refer to the instructions in the e-puck documentation.

When selecting a specific Bluetooth connection from the popup menu of the control window, Webots will try to establish a connection with your e-puck robot. Once connected, it will display the version of the e-puck serial communication software on the Webots console (e.g. 'Running real e-puck (Version 1.4.3 March 2010 (Webots))'), and will switch the control to the real robot. That is, it will send motor commands to the real robot and display sensor information (proximity, light, camera image, etc.) coming from the real robot. This makes the transfer from the simulation to the real robot trivially simple. Note that in the same popup menu, the Refresh ports menu item can be used for updating the COM ports.

The remote control has two requirements: the Bluetooth must be correctly set up (computer side) and the e-puck must be programmed with the Webots last firmware. For setting up Bluetooth, please refer to the official e-puck website. For uploading the last firmware on your robot, switch on your robot, press the Upload to e-puck robot... button on the control window and finally select the select the COM port which corresponds to your robot and the transfer/e-puck/firmware/firmware-x.x.x.hex file located in your Webots directory (x.x.x has to be replaced by the current firmware's version).

Cross-compilation

An alternative to the remote-control session for running the real e-puck is to cross-compile your code and to upload it on the e-puck.

For using this feature, your code has to be written in C and to use the C Webots API. Moreover, you need to define a specific Makefile called Makefile.e-puck in the controller directory. This Makefile must include the following file:

include $(WEBOTS_HOME_PATH)/transfer/e-puck/libepuck/Makefile.include

Thanks to this, it is possible to cross-compile with Webots by using the Build > Cross-compile menu item of the text editor. Note that the Upload to e-puck robot... button of the e-puck control window allows you to upload a file generated by the cross-compilation extended by .hex on the e-puck robot.

An example of cross-compilation is given in the projects/robots/e-puck/controllers/e-puck_crosscompilation subdirectory of your Webots directory.

release 7.0.2
Copyright © 2012 Cyberbotics Ltd. All right reserved.