General information

Projects of Fall 2010: "Catch-the-ball game"

Mindstorms NXT(TM) robots are robots made of a main unit and a set of sensors and actuators. They are sold by Lego for a few years now. Many very tricky things have been made using the standard kit (see for example "Mindstorms: Not just a kid's toy"). You may also visualize interesting videos on youtube, and for example a car factory, a walking dog, a scorpion, a forklift truck, the "holononic drive", and a rubik's cube solver. You can also find some other nice systems on battlebricks.

The project you ought to do is not as complex as some aforementioned systems, but yet, it requires to spend quite a lot of programming / exploration time on the robot and its interfaces (sensors, actuators).

Project objectives

The robot you have to build shall be the winner of a catch-the-ball-like competition. The competition lasts 5 minutes - 5 rounds -, and is as follows:
  • Two robots are placed in an arena. The arena is 1.2 meters large and 2 meters long, and protected on all sides with a fence high of 10 cm. This arena is divided in two squares of equal size ("side of robot 1", "side of robot 2"), defining each robot side.

  • Each robot carries, at its back, one ball: one robot carries a red ball, and the other one carries a blue one. The ball shall be placed at a specific location. That ball shall be removeable from any quite slight kick on the ball coming from any direction. We'll define this "slight kick" when we'll be a bit more advanced on this project. Anyway, the base of the ball must be placed at exactly 6cm from the floor, in the middle of the back of the robot.

  • The two robots are started at the same time from a pre-defined initial location ("starting zone of robot 1", "starting zone of robot 2"). Inside the corresponding location, each team may place its robot as desired.

  • Robots shall try to remove the ball from the adversay robot (first phase). When they manage to do this, they score 2 points. By "manage", we mean that the ball was removed by the robot, and not by a collision between the adversary robot and the fence, for example. Also, when the two robots collide, no points are given to robots if a ball falls; but if a robot collides in the other non-moving robot, and the ball falls in the arena, the robot which collides the non-moving robot scores 2 points.

  • If a robot manages to bring back to its side the ball of the adversary robot, it scores 3 points (second phase). To score those three points, it must play a sound (e.g., "I win!") to signal that it was aware that he has brought back the ball to its side.

  • If a robot manages to keep its ball until the end of a round, it scores one point.

  • At the end, the winning robot is the one with the highest score
Tournaments will be organized between robots so as to select winners (gold, silver and bronze medals). We'll also try to organize competitions with more than two robots in the arena.

Specification of the robot

  • The robot must be contained in a cube of 30 cm maximum on each dimension, apart from the height, to support the compass sensor, and apart from the ball.

  • It may change its shape (by deploying elements, or withdrawing some) during game phases, but it must remain all the time in the aforementioned dimensions.

  • Your robot is allowed to lose parts on purpose - or not ;-) - during the game.

  • It is forbidden to send orders - remotely or not - to your robot while it is playing: it must be autonomous as soon as the game starts, and until it ends.

Deadlines and reports

There are two deadlines:
  1. The 6th of January, 2011, before the lecture on OS starts: the draft of your web site must be ready, and a first version of your robot shall be available. First competitions will be organized during the second part of the OS lecture.
  2. We'll first test each robot alone. Each robot - alone in the arena - shall be able to:
    • remove the ball (or even better: grab it!) from a tee positionned right in the middle of the arena.

    • remove the ball from a tee located on the middle line.

    • remove the ball from a tee located on a random place in the adversary side.
    Thus, we'll first evaluate, for each robot, the three aforementioned points. Then, we'll make competitions for the first phase only, i.e., removing the ball from a robot.

  3. The 10th of February: final competition. For this competition, the website must be fully completed. Also, during the competition, I will interview each member of the group, so as to understand the contribution of each member.

Your report consists in a website. The web site 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 game stages. Don't provide a 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.

  • 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 made what. Be clear about that. Each member of groups will get an individual grade.


  1. Alfredo: Manuel Di GIUSEPPE, Andrea ENRICI, Andrea MASCHERONI, Thibault VILON


  3. Rufus: Nour AL ANSARI, Anne-Elisabeth GAZET, Malek MAHERSI

  4. Inchou: Arnaud BROUSSEAU, Joe SOUEDI, Nicolas GIRAULT


The NXT box, and batteries

  • Robots may be borrowed from Marie-Laure Victorin, at the IT Department's (First office on the left, in the corridor starting from the Forum, West direction). Please, take care not to loose parts, especially cables and sensors.

  • Batteries may be borrowed from Frank Heurtematte (IT department). When they are discharged, you may pick up a new set of charged batteries from his office.

Working with NXC (Not eXactly C)

A good way to program your robot is to use the C language, and more specifically the NXC environment. That environment provides a compiler for programs written in NXC, and an uploader to upload to resulting program to the NXT robot. Good points about NXC is that:
  • It is free

  • You don't need to change the firmware of the NXT robot, i.e., nothing has to be changed on the robot to be able to use NXC.

  • NXC is a language which is very close to the C language: you don't need to learn a new language. There are several tutorials on the web site, as well as a reference guide.

I have tested it on my Mac, under MacOS X, it works fine.
Here is how I have made on my Mac (it should work quite the same on a PC running Windows, very good intructions are provided on the NXC environment web site):
  1. I have first installed the package provided in "beta releases" (menu on the left, on the web site).

  2. Then, I have uncompressed it, installed it in /Applications/nxt

  3. I have modified my .bashrc file so as to be able to execute NXC applications from a shell. More precisely, I have added the following line to my .bashrc file:
  4. export PATH= $PATH:/Applications/nxt

  5. I have downloaded the tutorial samples code, and I have unzipped it, let say in /Users/ludovic.apvrille/code

  6. I have compiled the "5_light.nxc" code as follows, from a terminal:
  7. $ cd /Users/ludovic.apvrille/code
    $ nbc -O=program.rxe 5_light.nxc

  8. I have plugged my NXT robot on a USB port, and switched it on. Then, I have run the following command:
  9. $nxtcom program.rxe
This last command uploads the program on the NXT robot. Then, from the NXT robot, you may run that program, by selecting it using menus of the NXT.

Competitions results

First competition

Second competition