EECE 258 Lab #6

E-Puck Robot Control

Spring 2013

OBJECTIVE: Students will learn how to use the robot control software simulator called the Webots by guiding an E-Puck robot to navigate in unknown environment using its own sensors.

OVERVIEW: Webots is a development environment used to model, program and simulate mobile robots. With Webots the user can design complex robotic simulation, with one or several, similar or different robots, such as E-Puck, Khepera or Koala, in a shared environment. The properties of each object, such as shape, color, texture, mass, friction, etc., are chosen by the user. A large choice of simulated sensors and actuators is available to equip each robot. The robot controllers can be programmed in C or C++ with the built-in IDE (Integrated Development Environment).

The E-Puck mini mobile robot was originally developed at a Swiss University named EPFL for teaching purposes by the designers of the successful Khepera robot. The e-puck hardware and software is fully open source, providing low level access to every electronic device and offering unlimited extension possibilities. The basic e-puck robot contains a large number of sensors and actuators, including two stepper motor wheels, 9 LEDs, a speaker, 8 infra-red sensors, 3 microphones, a VGA camera, a 3D accelerometer, a remote control IR receiver, a 16 position switch and a Bluetooth interface as shown in Fig.1.

The official e-puck community web site is www.e-puck.org.

Fig.1 E-Puck Robot

PRELAB: Visit the EECE258 Website at http://eecs.vanderbilt.edu/courses/eece258/Lab6/Lab6_Webot.htm to investigate how to use the simulator Webots.

The user guide and reference manual of Webots are found at

http://www.cyberbotics.com/

http://www.cyberbotics.com/cdrom/common/doc/webots/guide/guide.pdf

http://www.cyberbotics.com/cdrom/common/doc/webots/reference/reference.pdf

If you want to learn C programming in depth, you can go to the website and learn the basic C operations: http://www.tutorialspoint.com/cprogramming/index.htm

Investigate how IR sensors work.

Proximity Sensor:

http://www.e-puck.org/index.php?option=com_content&task=view&id=22

http://www.cyberbotics.com/dvd/common/doc/webots/curriculum.pdf Page 60-62.

Floor Sensor:

http://www.cyberbotics.com/e-puck/e-puck_ground_sensors.pdf

INLAB: Students will use a lab computer to control an E-Puck robot to satisfy requirements list below.

REQUIREMENTS: You are required to achieve the following design specifications:

a) Move an E-Puck robot in the environment shown in Fig.2. The robot must not collide with any objects.

b) Guide the robot to hit any points on the black stripe as shown in Fig.2.

c) Control the robot to track the black strip. (Starting from the hitting point, the robot should move along the black strip and go back to the hitting point)

Fig. 2 Experimental Environment

PROCEDURE:

Complete the following steps to perform the lab:

1. Start Windows;

2. Login in as “webots” (“Password: stobeW”);

3. Open the folder with your group name on desktop

4. Turn on the robot

5. Open e-puck.wbt in the worlds folder. You will see a simulation environment (world file) and a C file named “e-puck_line.c” opened automatically for you.

6. Modify the algorithms in the “e-puck_line.c”.

You need to design two algorithms: one is avoiding obstacles and the other is tracking the black strip in the environment.

Before the robot found that the black line has been hit:

void ObstacleAvoidanceModule(void) is the function used for robots to avoid obstacles in the environment.

Normally, the robot will analyze the distance between the obstacle and its left sensor by using the received sensory information: [PS_LEFT_45] and ps_value[PS_LEFT_00]; analyze the distance between the obstacle and its right sensors by using the received sensory information: ps_value[PS_RIGHT_00] and ps_value[PS_RIGHT_45]. If it finds that some of distance values are smaller than a threshold value, it means an obstacle is close to itself. Then if the distances values obtained from its left sensors is larger than the values obtained from its right sensors, the robot changes its wheel speed to avoid the obstacle which is closer to its right side; if the distances values obtained from its right sensors is larger than the values obtained from its left sensors, the robot also changes its wheels speed to avoid the obstacle which is closer to its left side. The computed speed values of its wheels are: oam_speed[LEFT] and oam_speed[RIGHT]

When the robot found that the black line has been hit:

void LineFollowingModule(void) is the function used for robots to track the line in the environment.

Normally, the robot will analyze the size of the strip obtained from its left sensor by using the received sensory information: fs_value[FS_LEFT]; analyze the size of the strip obtained from its right sensor by using the received sensory information: fs_value[FS_RIGHT]. Based on the analysis of these two values, the robot changes its wheels speed to change the moving direction of itself to minimize the difference of these two values. The computed speed values of its wheels are: lfm_speed[LEFT] and lfm_speed[RIGHT];

7. Compile and build your algorithm. (Click yes if a new window pops up asking you to revert the simulation).

8. Double click the e-puck model in the world file. In the new window “e-puck”, choose COM3 in the drop down menu.

9. Start running the program in E-Puck robot by pressing ► button on the dialog menu.

10. Watch the movement of the robot and modify the algorithm in the text file “e-puck_line.c” if not satisfied;

11. Repeat 6 to 10 until all the requirements are satisfied.

NOTES:

Design of Control Sequence for Obstacle Avoidance:

Your designed control sequence could be considered as a sequence of operations.

At the beginning of this sequence, you have to obtain sensed distance between the robot and the obstacles. Eight proximity sensors are mounted on the robot automatically for you-PS_RIGHT_00, PS_RIGHT_45, PS_RIGHT_90, PS_RIGHT_REAR, PS_LEFT_00, PS_LEFT_45, PS_LEFT_90, PS_LEFT_REAR. You need to use four of them. The sensed distances are put in four variables for you to use.

“ps_value[PS_LEFT_00]” is the distance between the robot and the obstacle measured by the left front proximity sensor.

“ps_value[PS_LEFT_45]” is the distance between the robot and the obstacle measured by the left 45 degree front proximity sensor.

“ps_value[PS_RIGHT_00]” is the distance between the robot and the obstacle measured by the right front proximity sensor.

“ps_value[PS_RIGHT_45]” is the distance between the robot and the obstacle measured by the right 45 degree front proximity sensor.

At the end of the control sequence, you have to define the speed of the wheels of the robot.

“oam_speed[LEFT]” is the speed of the left wheel.

“oam_speed[RIGHT]” is the speed of the right wheel.

You can set the two variables with certain values according to your own control method.

“wb_differential_wheels_set_speed (speed[LEFT], speed[RIGHT]” can set the speeds of the two wheels of the robot. You can use this function after the values of “speed[LEFT]” and “speed[RIGHT]” are set.

Design of Control Sequence for Strip Tracking:

Your designed control sequence could be considered as a sequence of operations.

At the beginning of this sequence, you have to obtain sensed area of the black strip between the robot in the two sensors.

“fs_value[FS_LEFT]” is the sensed value by the left floor sensor.

“fs_value[FS_RIGHT]” is the sensed value by the right floor sensor.

At the end of the control sequence, you have to define the speed of the wheels of the robot.

“lfm_speed[LEFT]” is the speed of the left wheel.

“lfm_speed[RIGHT]” is the speed of the right wheel.

You can set the two variables with certain values according to your own control method.

“wb_differential_wheels_set_speed(speed[LEFT], speed[RIGHT]” can set the speeds of the two wheels of the robot. You can use this function after the values of “speed[LEFT]” and “speed[RIGHT]” are set.

AFTERLAB:

Follow lab report guidelines to write a final report and submit. Make sure that the following files are included in your final report:

1) Submit your own “e-puck_line.c” which is related to your collision avoidance and tracking algorithm.

2) Submit a description file describing your algorithm (NOT the code! It is good if you can use block diagram to describe your algorithm).

3) Submit your experimental results.

1. Sketch the path of how the robot hit a point on the black strip

2. Measure the time when the robot goes back to the hitting point on the black strip.