OS
Operating
Systems
and
Real
Time
Operating
Systems
General information

Project of Fall 2026: "Curling game"




Mindstorms NXT(TM)/EV3 robots are robots made of a main unit and a set of sensors and actuators. They have been sold by Lego for many years now, starting with the NXT version, and now with the ev3 version. Many very elaborate designs have been made using the standard kit (see for example "Mindstorms: Not just a kid's toy"). You may also watch interesting videos on youtube, such as a breakfast machine, marble conveyor, a car factory, a forklift truck, the "holononic drive", a rubik's cube solver, a printer, and a sumo game.

The project you will work on might not be as complex as some aforementioned systems, yet it requires spending quite a lot of design and programming time on the robot and its interfaces (sensors, actuators).

Once you have received your robot box, test your robot, motors, and sensors as soon as possible! We may be able to repair/order parts with a few weeks notice, but there is very little we can do the day before the competition.

Project description

Your objective is to build a robot capable of winning a curling duel. This section includes a description of the game and then a specification of the robot.

Note that the rules might evolve over the coming weeks until the final competition. I will always inform you whenever a rule evolves.

General description

The objective of the game is to score more points than the opposing robot by placing or launching game pieces into designated targets. Game pieces are either cubes or cylinders, as defined by the STL files provided below. A game piece that is entirely within a target scores 1 point. The piece closest to the center of each target scores 5 points instead of 1 point, provided that it is also entirely within the target. Points are calculated at the end of each round, see the scoring section below for details.

Groups of 5 students must also additionaly display a live map, in their laptop terminal, ascii format, of the position of their robot in the stadium, and also of the presumed location of objects, including the ones that have been dropped/sent.

Object specification

  1. Cube

  2. Cylinder

Scoring

  1. Central target. The closest object from the target's center, and entirely in the target, scores 5 points. All others entirely in the target score 1 point. This score is computed when the round ends. Distance is computed from the closest edge to the target's center. If several objects have the same distance to the center, with a one millimeter precision, all objects score 5 points.

  2. Starting areas are also targets. The scoring is the same as for the central target, but only the opponent robot can score in the starting area of a robot. This score is computed when the round ends.

  3. Entering a forbidden area: 1 point for the opponent each time, with at most 2 points per round. "Entering a forbidden area" means that at least one of the robot's wheels is over the middle line.

  4. A robot wrongly entering its forbidden area a second time during the same round is removed from the stadium. Its objects on target remain valid.

  5. Round winner. At the end of a round, the winner is the robot with the higher number of points

  6. Overall winner. Each robot will play the same number of rounds, with all possible opponents. At the end of the competition, we will decide on two different winners: the robot with the highest number of victories, and the robot with the highest number of points.




Stadium specification


The stadium is explained in the following picture. The overall game area is delimited by a wooden fence on the four sides (see figure below).
this is a PNG
Specification of the stadium





General rules

  • The robot may be re-programmed between game rounds, but it is forbidden to remotely control your robot.

  • Robots have the right to release obstacles, e.g. throwing obstacles against the opponent robot is encouraged. These obstacles are not taken into account for the target scoring.

  • Robots must be built with only the provided Lego pieces. You can also use: rubber, elastics, strings and adhesive (not provided).

  • Robots must start in their designated area.

  • A round lasts 3 minutes.




Specification of the robot

  • The program you run should have been totally written in C.

  • The robot must be contained in width=30cm, length=30cm, height=35cm maximum at start-up. They have to fit within the lines, they cannot touch the lines, nor the structure can go over the lines. After start-up, they may deploy elements and thus be larger/higher.

  • Robots can use up to four sensors and up to four motors. You are free to use any combination of the following sensors: touch sensor, light sensor, color sensor, ultrasonic sensor (i.e., distance sensor), compass sensor, gyroscope sensor, magnetic sensor.

  • The robot must contain a paper identification flag, on which the number of your group is clearly readable from at least two sides of your robot. The flag dimension must be 10x8cm. It may also contain a logo, a drawing, and the name of the robot.

  • A robot may change its shape (by deploying elements, or withdrawing them) during game phases.

  • Robots can contain a camera and send data over wifi to send out a video stream. We do not provide any camera for this, you have to do this on your own, for entertainment purposes only.

  • Destructive weapons are NOT allowed.

  • It is forbidden to send orders -remotely or not- to your robot while it is playing: it must be fully autonomous as soon as the game starts, and until it ends. Any kind of cheating will result in a 0 grade, just like for all exams at Eurecom.



Competitions and reports

There are two "competitions", as described below. Your project grade takes into account the two competitions.
  1. Competition #1: the 14th of December, 2026
    Each group must provide access to its GitLab repository before the evaluation. The following tests will assess the robot's basic capabilities. Each robot will be tested individually in the stadium, without an opponent. Groups may combine several tests into a single execution. The tests are intended primarily to provide feedback on the progress of the project. Their contribution to the final grade is described in the Grading section.

    • Test #1. Be able to pick up an object located right in front of the robot.
    • Test #2. Be able to pick up an object (of your choice) from the starting point.
    • Test #3. Be able to place an object in the middle target.
    • Test #4. Be able to send an object, placed in front of your robot, to the starting area target from the starting position.
    • Test #5. Be able to send an object that your robot must first pick up, to the starting area target, starting from the robot's starting position.
    • Test #6 - for groups of 5 students. Be able to display a draft map of the robot navigating in the stadium.


  2. Final competition: the 11th of January, 2027: final competition. For the final competition, your gitlab must be complete, and a website advertising your robot (this plays the role of a report) must be fully completed. Also, during the final competition, I will interview each member of the group, so as to understand the contribution of each group member, and to see the understanding of each one of the C code used during the competition.


Your report consists of a website (which could be integrated into your gitlab) and the source code of your robot. The website shall contain the following information:
  • Description of the architecture of the robot: sensors and actuators, etc. Pictures of your robot on the web site would be appreciated.

  • Algorithms used for the two most important points: strategy for the different rounds (placing objects in targets, defending). Don't provide source code here, just try to describe the algorithms using a pseudo C language. Also, do comment those algorithms, and explain why you think they are efficient.

  • Source code, and instructions on how to use that source code: how to compile it, how to download it on the robot, and how to start the robot. To protect your work, you can set a password to access the code, but make sure to give us access in order to grade it (e.g., private git repository). You could even put a fake code on your website until the very last moment ;-). I strongly advise you to rely on a versioning system (git) to work on the code. Also, frequently backup your code.

  • Videos / pictures of your robot in action [we may provide you with cameras and video recorders if necessary].

  • How you have worked in the group, i.e., who was responsible for each task. All groups members must be involved in at least one coding task. Each member of groups will get an individual grade. All members of a team must contribute to the source code. You are allowed to use AI tools to generate or modify C code. However, you must clearly identify the parts of your code that were produced with AI assistance. All group members are expected to understand the complete source code, regardless of whether it was written manually or generated using AI tools. During the final evaluation, each student may be asked to explain, modify, or debug any part of the submitted code, including AI-generated code.

Grading

  • Report: 5 points

  • Algorithms: 5 points

  • Code: 5 points

  • Competition (ranking): 5 points for each winner, less for the others.

  • Bonus, including test session: 2 points.

Don't forget to split the work. Also, I expect all students to work on the code, and to push in their project's git in a regular way. A student not committing code nor being active in the project (this includes sessions of the schedule) will get a (much) lower grade than other members of the group.

Groups


The group leader is listed first. Follows name of the other students, then the name of the robot and finally the link to the website. Total of 4 groups of 5 students, and 3 groups of 4 students).
  1. Group #1 (4 students): Adelin Mae EVERGREEN, Adam JELINEK, Espen BENTDAL, Gabriele TARANTELLO

  2. Group #2 (5 students): Antoine CARDILES, Zide YANG, Florentin LIU, Gaultier BERNARD, Elliot VITORES

  3. Group #3 (5 students): Dimitrios VAMVAKAS, Carl SVENSSON, Konstantinos ANTIOCHOS, Alina JIBOY, Ingrid Frida SUNDELIN

  4. Group #4 (5 students): Emilio González ACOSTA, Carlos LUGO TORRES, Kim JIEUN, Margarita SYTCHEVA, Vignesh RAMKUMAR

  5. Group #5 (4 students): Zhoutianbo LIU, sai-Ling TING, Mayavan MARIMUTHU, Jiahong YAN

  6. Group #6 (4 students): Mikhail SHCHUKIN, Michiel KUHN, Edouard KURKIJAN, Eric De MALET

  7. Group #7 (5 students): Matthew Blake FOUST, Muhammad FAIZAN, Mac-Angelo ANYANWU, Lin SUN




How do I borrow a robot?

Please, take care not to lose parts, especially cables and sensors. Also, a micro SD card and a wifi dongle come with the robot. The procedure to borrow a robot is as follows:
  1. Make a group of 4 or 5 students, and decide on a group leader.
  2. The group leader sends me an email with the list of students of the group. List of: first_name, LAST_NAME, email. The leader shall be the first student in the list.
  3. I will validate the group. If the group is not validated for some reason I will provide, go back to stage 1. Otherwise, go to next step. Note that I validate groups with a First Come First Served policy (Date of email sent).
  4. Once I've answered your group with "validated", the group leader can go to Tom ZENATTI's office (327), Tom.Zenatti AT eurecom.fr, in the IT Department. You will be granted an ev3 box. Only the group leader may enter the office of Mr Zenatti, and only during the morning or the afternoon breaks (do not go during lunch break).

Access to stadium

  • The stadium is located in room 52. You are free to use it whenever you want but please do take care about the stadium, especially the accessories.



ev3

For the ev3 system, the idea is to flash on the provided SD card a Debian GNU/Linux system. Then, you will be able to use the C language to make your program.

Installing Linux on ev3

All information to install Linux on your ev3 is given here. This page also explains how to connect your ev3 to your PC via the usb cable, bluetooth, or wifi.

Using and programming ev3

  • Connect to the EV3 by ssh
  • If you have difficulties to connect to your robot via WIFI, Bluetooth ou USB, please contact us.
    Once your robot has access to Internet, it should display its IP address in the upper left corner of its display (let's assume it is 192.168.2.2). Then, you can try to ssh to the robot (the default password is maker):
    $ ssh robot@192.168.2.2
    
    The robot user is a sudoer, i.e. it can execute commands with root privileges when using the command sudo first.

    Once you are logged on the robot, do verify that you really have an internet access. For instance, try to do:
    $ ping www.ev3dev.org
    

  • Now, update the robot with the latest packages
  • $ sudo apt update&&sudo apt upgrade
    

  • Install extra packages you will need for the project:
  • $ sudo apt install gcc make build-essential git
    
    If the previous command fails, you need to edit the references for finding packages. For this, you need to change the references to packages:
    $ sudo apt edit-sources
    
    And use the following lines for your package configuration, assuming you use debian stretch:
    deb http://archive.debian.org/debian stretch main contrib non-free
    #deb-src http://archive.debian.org/debian stretch main contrib non-free
    
    deb http://archive.ev3dev.org/debian stretch main
    #deb-src http://archive.ev3dev.org/debian stretch main
    
    Save, and re-run:
    $ sudo apt update&&sudo apt upgrade
    

  • You are now ready to compile a basic example, and to run it. To do so, you first need to install the development environment on the robot:
  • $ cd /home/robot
    $ git clone https://github.com/in4lio/ev3dev-c.git
    $ cd ev3dev-c
    $ git submodule update --init --recursive
    $ cd source/ev3/
    $ make
    $ sudo make install
    $ make shared
    $ sudo make shared-install
    

  • Now, you need to get the example. The tester file runs all 3 motors, then tests the color, touch, sonar, and compass sensors, and is provided on the project git. You can either clone the git with the code on the robot, or on your host computer.
  • $ GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/ludovic.apvrille/OS_Robot_Project_Fall2020.git
    $ cd OS_Robot_Project_Fall2020/client
    
    If you are on your host computer, you then need to copy the example files to the robot:
    $ scp tester.c Makefile robot@192.168.2.2:
    

  • Then, on the robot, you can compile the example main file, and then run it. You need tachos and sensors to be connected to the brick if you want the program to correctly execute.
  • To compile:
    $ make tester
    
    or
    $gcc -I./ev3dev-c/source/ev3 -O2 -std=gnu99 -W -Wall -Wno-comment -c tester.c -o tester.o
    
    or $ gcc tester.o -Wall -lm -lev3dev-c -o tester or:
    $ make
    
    To run the code:
    $ ./tester
    
    or to compile and run:
    $ make tester&&./tester
    
note that the code and Makefile I provide are for the version of Debian Jessie that I have installed on my robot. The code and/or Makefile may fail for your robot: in that case, try to understand the error(s) you get and accordingly adapt the Makefile or the code.

Other examples

  • Sample code is also provided in the ev3c-master repository. Samples of how to control the motors and sensors are included in tester.c. The Ultrasonic Sensor is described here.

  • If your compass sensor does not correctly work with the test_sensor program, we provide a code specific to the use of this sensor. Use the "i2c" target of the provided Makefile to compile the file.

  • Other examples can be downloaded from the ev3dev C library here. Examples are provided in eg/tacho and eg/sensor.

  • rfcomm-client.c is an example of how to communicate with the server over wifi. Compile with gcc rfcomm-client.c -o rfcomm-client.

  • If you can't get your robot working, bring it along to course staff.


Cross compilation

Basic

You have to compile your source code on your laptop, e.g. to check the syntax of your code and to speed up the compilation process. Indeed, if small examples are fast to compile on the robot, your final code will take minutes to compile, possibly even 5 to 10 minutes, making it too slow to iterate on your code. This is why cross-compilation is really necessary. Cross-compilation for ev3 is available as an ev3 docker image. Here is what I've made to make this work on my Debian GNU/Linux computer:
  1. I have first installed docker, created a docker group, added myself to the docker group, and started the docker service. Installing docker may require more than a simple apt, so please refer to the documentation of your OS, e.g. for the one for ubuntu
  2. $ sudo apt update
    $ sudo apt install docker.io
    $ sudo apt install docker-engine
    $ sudo groupadd docker
    $ sudo gpasswd -a ${USER} docker
    $ sudo systemctl enable --now docker
    
    You may have to log-out for the group modification to be effective.
  3. Then, I have installed the ev3 docker image:
  4. $ docker pull ev3dev/debian-stretch-cross
    
  5. Once done, I've created a helloworld in C:
  6. $ cat > /tmp/hello.c
    #include 
    
    int main(int argc, const char *argv[])
    {
        printf("OS is fantastic!!\n");
    
        return 0;
    }
    
    (do "CTRL D" at the end of this command).
  7. I've compiled the file using the cross compiler provided within the docker image, and tested the generated file. The following command assumes that hello.c is located in /tmp on your host system (but you can place it wherever you want: update the following command accordingly). The following instructions are the one that I have used on my debian/jessie GNU/Linux PC.
  8. $ docker run -e LOCAL_USER_ID=`id -u $USER`  --rm -it -v /tmp:/src -w /src ev3dev/debian-stretch-cross
    [Shell in container]$ arm-linux-gnueabi-gcc -static -o hello hello.c
    
    Then, if you want to execute the generated ARM executable, you first need to install the ARM emulation environment. Then, you can execute "hello":
    $ sudo apt-get install qemu-user-static
    [Shell in container]$ ./hello
    OS is fantastic!!
    
For handling the compilation for your ev3, you need to make additional stages (thanks to Paolo!):
  1. Tag the docker image:
  2. $ docker tag ev3dev/debian-stretch-cross ev3cc
    
  3. Install ev3 lib, put them in the project directory, and start the docker image:
  4. $ git clone https://github.com/in4lio/ev3dev-c
    $ docker run --rm -it -h ev3 -v PATH/TO/PROJECT/:/src -w /src ev3cc /bin/bash
    
  5. In the container, run the following commands:
  6. [Shell in container]$ cd ev3dev-c/source/ev3/&&make&&sudo make install&&make shared&&sudo make shared-install
    
    In the Makefile for compiling your code, do not forget to substitute "gcc" with "arm-linux-gnueabi-gcc". For running your project, add "export LD_LIBRARY_PATH=~/ev3dev-c/lib" in the Makefile.

Alternative cross-compilation method

(Way suggested by Fredrik Flornes Ellertsen. Note: on our side, for the tester.c file, we had to put the exact location of included files such as ev3.h. And also we had to remove the lines that use 'ev3_brick_addr', which the compiler cannot understand)

This has been tested on native Ubuntu 17.04 and on Windows using the Windows Subsystem for Linux.
  1. In an empty folder (here called robot_code/) on your computer, clone the ev3dev repository:
  2. $ git clone https://github.com/in4lio/ev3dev-c
    
  3. Install the cross compiler (source: https://www.acmesystems.it/arm9_toolchain):
  4. $ sudo apt-get install gcc-arm-linux-gnueabi
    
  5. In order to compile code that links to the ev3dev-c and/or other libraries, we need to use the robot's own versions of these libraries e.g. libev3dev-c.a. By linking statically we eliminate the need to install anything on the robot itself. Place these files in robot_code/libraries.

  6. Create a Makefile to simplify the compilation process. The following example Makefile expects the project to be organized like illustrated below, but will naturally depend on the group's project:
  7. 	robot_code/
    		Makefile
    		ev3dev-c/
    		libraries/
    			libev3dev-c.a
    		include/
    			movement.h
    			sensors.h
    		source/
    			movement.c
    			sensors.c
    			main.c
    
    Running 'make' in the robot_code/ directory should yield an executable called 'main' in the same directory. Using a file transfer tool like scp, copy this file to the robot and run it.


Competitions results

First tests, December the 14th, 2026




    Final competition, January the 11th, 2027