# Cyberbotics' Robot Curriculum/Cognitive Benchmarks

The cognitive benchmark topic was already introduced in section Enjoy Robot Competition. This chapter provides first a quick introduction about this topic. Then, it introduces one cognitive benchmark in more details: Rat's Life. To avoid redundancy with Rat's Life official web site we provide only a quick description of the contest and some clues to start quickly with this benchmark. The last part is dedicated to other active cognitive benchmark.

## Introduction

Generally speaking, a benchmark is a method for quantifying a specific attribute. For example, in the computer field, if one wants to establish a list of CPUs sorted by their performance, a CPU benchmark is performed on each CPU. A typical CPU benchmark consists to solve a long computation. Quicker the CPU finishes this computation, more efficient it is. Once every CPU performance is quantified, it's easy to rank them according to this metric.
Similarly, cognitive benchmark is a method for quantifying the intelligence (and not only the artificial intelligence). For example, the mirror test measures the self-awareness. An odorless mark is placed on the animal without him noticing it. Then, the animal is placed in front of a mirror. The animals can be sorted in three classes: the animal doesn't take interest in the mark, the animal takes interest in the mark of its reflection, or the animal takes interest in its own mark. If the animal belongs to the last class, it is self-awareness (the inverse is not necessary right). An animal ranking can be done according to this criterion.
In robotics, cognitive benchmarks are used to compare the quality of the artificial intelligence of several robot controllers. This comparison is performed on a measurable criterion as the time to solve a problem or the victory in a round of a game. The rules of the benchmark must be unambiguous. To increase the motivation of the participants, the cognitive benchmarks are often shaped as contests. Thanks to this competition spirit, at the end of the contest, the participants achieve often to very good solutions for the given problem.
A chess game is given as example of a cognitive benchmark. The rules of this game are limited and unambiguous. If a player wins a game he gets three points, if he loses he doesn't get any point, and if the two players tie each of them get one point. In a tournament where each player meets all the others, the number of points describes precisely the chess level of each participant. Moreover, this cognitive benchmark is an hybrid benchmark, i.e., completely different entities (for example, humans and computer programs) can participate.
In robotic research, the cognitive benchmarks are useful mainly for comparing the research results. Indeed, some techniques advocated by the researchers in scientific publication lack comparison with other related research results. Thanks to this kind of event, pros and cons of a technique can be observed in comparison with another one. Generally speaking, cognitive benchmarks stimulate the research.
About the life span of a benchmark, the EURON website says: ”A benchmark can only be considered successful if the target community accepts it and uses it extensively in publications, conferences and reports as a way of measuring and comparing results. The most successful benchmarks existing today are probably those used in robot competitions.”
Finally, when one knows that the RoboCup official goal on the long view (”By 2050, develop a team of fully autonomous humanoid robots that can win against the human world champion team in soccer.”), one can still expect a lot of surprises in the robotic field.

## Rat's Life Benchmark

This section presents you the Rat's Life contest. This section gives only a quick presentation of this contest. On the other hand, you'll find here clues about robot programming to take a quick start in the contest.

### Presentation

Rat's Life is a cognitive benchmark. In an unknown maze, two e-pucks are in competition for the resources. They have to find energy in feeders to survive. When a feeder has been used, it is unavailable for a while. The contest can be done either in simulation or in reality. The real mazes are composed of Lego© bricks. The figure depicts a simulation of contest on the 6th maze.
The aim of the contest is to implement an e-puck controller in order to let your e-puck survive longer than its opponent. If you have done the previous exercises, you have all the background needed to participate to this contest. Except that the programming language is Java instead of C. But as the Webots API is quite identical and since Java is more user-friendly than C, the transition will be easy.
The world file is available in Webots (even in its free version) and located in:
where webots_root corresponds to the directory where webots is installed.
On the official Rat's Life website, you will find the precise contest rules, information about the participation, the current ranking, information about the real maze creation, etc. At this step, I suggest you to refer to the official Rat's Life website before going on with this curriculum: ratslife.org
From now on, we expect you to know the rules and the specific vocabulary of Rat's Life.

### Main Interest Fields and Clues

The main robotic challenges of the Rat's Life contest are the visual system, the navigation in an unknown environment and the game strategy. The best solutions for each of these topics are still an open question, i.e., there is no well-defined solution. At the end of the contest, a solution may distinguish itself from the others for some topics. Actually it isn't the case yet. This section gives a starting point for each of these topics, i.e., some standard techniques (or their references) and the topic difficulties to start the contest quickly. Obviously, these clues aren't exhaustive and they must not restrain your creativity and your research.

#### Visual-System - Pattern Recognition

In the Rat's Life contest, two e-puck sensors are used: the IR sensor and the camera. The first one is simple to use. The information returned by an IR sensor is quite intuitive and its use is more or less limited to distinguish the walls. However, the information returned by the camera is much more difficult to treat. Moreover, the camera has to distinguish and estimate the position and the orientation of several patterns, an alight feeder, an off feeder, another e-puck and especially a landmark.
Pattern recognition is a huge subject in which a lot of techniques exist. The goal of this document is not to give you a complete list of the existing solution but to give you a way to start efficiently the contest. So, a simple solution would be to use a blob detection algorithm. If the blob selection is calibrated on the appropriate set of pixels, the problem becomes easier.
The first figure depicts a possible workflow to detect an alight feeder. The first operation is to get the value channel (with a simple RGB to HSV color space conversion). Then, a blob detection algorithm is applied in order to get the blob corresponding to the source light. Finally, some extreme blobs (too small size, too up blob, etc.) are removed. The resulting blob x-position can be sent more or less directly to the motor. To improve the robustness of the present workflow one may add another blob detection which searches a red glow around the light point.
The second figure depicts a possible workflow to detect a landmark. This problem is trickier than the previous one. Here is a possible solution. First, the hue channel of the image can be computed. With this color space, it is easy to distinguish the four landmark colors. Then, a blob detection is performed on this information. The size of the blob gives clues about the distance of the landmark. The blob which seems to be a landmark is straightened out (for example with a homography), and is normalized (for example on a 4x3 matrix). It's now easy to compare the result with a database to get the number of the landmark.
Generally speaking, a computer vision workflow is composed of:
* The image acquisition: This part is simply performed by using the camera_get_image function. This returns either the simulated or the real camera pixel values.
* The pre-processing: The pre-processing part aim is to increase the quality of the image. For example, a Gaussian blur can be applied on the image in order to remove the noise. In the previous examples, the pre-processing corresponds to the conversion from the RGB to the HSV color space.
* The feature extraction: This part is the most difficult to choose. In the previous examples, a blob detection was used. But a completely other way can be used like the edge detection (to start with this topic, refer to the Canny edge detector and the Hough transform). More complex techniques may be related to texture, shape or motion.
* Detection/segmentation: The detection part aim is to remove the unusable information. For example, to remove all the too small blobs or to select the interest area.
* High-level processing: At this step, the information is almost usable. But, the landmark blob for example must be treated for knowing to which class it belongs. This part is often a machine learning problem. This is also a huge field in computer science. If I had to refer only two completely different methods, it would be the bio-inspired back propagation algorithm which uses an artificial neural network for the classification, and the statistical-inspired Support Vector Machine (SVM).

#### Vision-based Navigation - Simultaneous Localization and Mapping (SLAM)

The vision-based navigation and the mapping are without any doubt the most difficult part of the Rat's Life contest. To be competitive, the e-puck has to store its previous actions. Indeed, if an e-puck finds the shortest path between the feeders, it will probably win the match. This requires building a representation of the map. For example, a simple map representation could be to generate a graph which could link the observations (landmark, feeder, dead end) with the actions (turn left, go forward). We introduce here a powerful technique to solve this problem. Once the map is created, there are techniques to find the shortest path in a maze (refer to Dijkstra's or A* algorithms).
Simultaneous Localization And Mapping (SLAM) is a technique to build a map of an unknown environment and to estimate the robot current position by referring to static reference points. These points can be either the maze walls (using the IR sensors: distance sensor-based navigation), or the landmarks (using the camera: vision-based navigation). Refer to the exercise on SLAM for more information.

#### Game Strategy

Rat's Life is a contest based on the competition. Establishing an efficient strategy is the first step to win a match. The game strategy (and so the e-puck behavior) must solve the following key points:
* Maze exploration: How must the e-puck explore the maze (randomly, right hand algorithm)? When can it explore the maze?
* Coverage zone: How many feeder are necessary to survive? What will be the e-puck behavior when it has enough feeder to survive?
* Reaction to the opponent strategy: What the e-puck has to do if the opponent blocks an alley? What should its behavior be if the opponent follows it?
* Energy management: From which battery level the e-puck has to dash for a feeder? Is it useful to destroy the energy of a feeder?
* Opponent perturbation: How can the e-puck block its opponent? Which feeder is used by the opponent?

## Other Robotic Cognitive Benchmarks

Throughout the world, there exists a huge number of robotic contests. In most of them, the contest starts with the design and the building of the physical robot. In this case, the comparison of the cognitive skills of the robots is difficult because it is too much influenced by hardware choices. In order to be able to benchmark the cognitive capabilities of the robots, standardized platforms and environment are needed. Rat's Life uses the e-puck as standard platform and Lego mazes for the environment. Similarly, the RoboCup and FIRA organization have a contest category where the used robot is identical and the environment is carefully defined.

### RoboCup - Standard Platform League

The RoboCup organizes contests of soccer game for robots. There are several categories. One of them uses a standard platform: a biped robot called Nao (see the figure). The first contest using this platform was held in 2008. Two teams of four Naos compete in a soccer game match.
More information is available from the official website of RoboCup: http://www.robocup.org
A Webots-based simulation version of this competition is available at RobotStadium : http://www.robotstadium.org

### The Federation of International Robot-soccer Association (FIRA) - Kheperasot

The FIRA also organizes a robot soccer competition including a standard league based on the Khepera differential wheels robot.
The FIRA official website is: http://www.fira.net

## Notes

* ↑ More information on wikipedia: Mirror test
* ↑ Source: http://www.euron.org/activities/benchmarks/index.html
* ↑ More information on: http://www.robocup.org/
* ↑ More information on: Blob detection
* ↑ More information on: HSV color space
* ↑ More information on wikipedia: Homography
* ↑ More information on wikipedia: Canny edge detector
* ↑ More information on wikipedia: Hough transform
* ↑ More information in exercises on Pattern recognition, Particle Swarm Optimization and on wikipedia: Machine learning
* ↑ More information on wikipedia: Support vector machine