NXT
Project
November 2009 to February
2010
Ludovic Apvrille
Mindstorms NXT(TM)
robots are robots made of a main unit and a set of senors 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 that publication). You may
also visuliaze 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.
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
rugby-like competition. The competition lasts 5 minutes, and
is as
follows:
- Two robots are placed in an arena. The arena is 1 meter
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 ("area of robot 1",
"area of robot 2"), defining each robot camp.
- A red ball is placed right in the middle of the arena.
The red ball which is used is the one provided with the robot
kit.
- 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.
- First game
phase: robots
must try to grab the ball. Since the ball may be moved by
robots
(but not thrown away from the arena!), you shall not assumed that the
ball is always at its initial location.
- Once the ball has been grabbed by a robot, that robot must
signal
to the other robot that it has grabbed the ball, using its bluetooth
interface. (The robot
which has grabbed the ball scores one point). Also, it must
play a sound: "I've got the ball".
- Then begins the second
game phase:
the robot having the ball - the attacking robot - has 1
minute at
most to bring the ball (and release it) along the "scoring
fence" of its opponent area. Of course, the other robot - the
defending robot - shall try to prevent
the attacking robot from releasing the ball. By releasing the
ball, we mean that the ball must be at most at 5 cms from the fence,
and not hold by the robot anymore. The ball must not be thrown, but put
on the floor so that its does not move. By "prevent",
we mean that the defending robot shall try to act so as to modify the
attacking robot trajectory by pushing it for example, or trying to
raise it so as its wheels are not longer functional, etc. Of course, "prevent" does not
mean "destroy" or "damage" i.e. no "destrutive weapons" are allowed,
e.g. sending chlorhydric acid
to the other robot is forbidden. If the attacking robot
manages to release the ball in the right place, it scores
two points.
Note that after that one minute phase, both robots must deactivate
themselves automatically. Also, when the attacking robot scores, it
must inform the defending robot - again using its bluetooth interface -, and both robots must automatically stop.
- Then, another first game phase is played between the two
same
robots, until the 5 minutes have elapsed: The ball is positionned again
in the middle of the field, except if a robot scored during previous
round: in that case, the ball is placed on the line between the two
opponents'area, at a location decided by the team not scoring at
previous step.
- 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).
First competition: the 17th of
December
We'll first test each robot alone.
Each robot - alone in the arena - shall be able to:
- Grab the ball when it is positioned in the middle of the
arena.
- Grab the ball when it is positioned on the middle
line.
- Grab the ball when it is at a random position of
the arena.
Thus, we'll first evaluate, for each robot, the three aforementioned
points. Then, we'll make competitions for the first phase only. When a
robot grabs the ball, it must play a sound such as: "I've grabbed the
ball". That robot scores one point, and another competition starts, the
loosing team of previous round deciding of the position of the ball on
the middle line.
Pictures and video of this first
competition are there (from a Microsoft Windows explorer):
\\karma.eurecom.fr\public\COMMUNICATION\PHOTOTHEQUE\robot_cours_Apvrille
Results of the first competition:
Specification of the
robot
- The robot must be contained in a cube of 30 cm maximum on
each dimension, part from the height, to support the compass sensor.
- 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 not allowed to lose parts on purpose 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.
How to work? A few advices..
- Start experimenting with NXT robots, especially with the
default
graphical environment. Try to make different robots so as to evaluate
how sensors work, and more specifically, the precision of those sensors
i.e. how reliable is the information they provide.
- Then, be imaginative about the structure of your robot...
- ... but do not invent very complicated algorithms
that you
may never finish to implement. At first, experiment with basic ideas,
then improve your robot's algorithms if we've got some time left.
- You will not be able to make a working robot if you do not
split the work inside of the group: in
a group, each member shall work on different elements of the
project. Otherwise,
you won't reach the objectives.
- The "LabView" environment provided by LEGO Mindstorms might
be
quite an important limitation when programming complex algorithms. I
suggest to use other programming environments, and more specifically
the "Not eXactly C" (NXC) one. More information on NXC are provided
below.
Reports and deadlines
- There are two deadlines:
- The first one the 17th
of December, 2009,
before the lecture on OS starts: the draft of your web site must be
ready, and "the seek for the ball and grab the ball" stage must be
working (the second game phase will not be experimented). First
competitions will be organized during the second part of the OS
lecture.
- The second deadline is the 28th of January, 2010, 23:59.
The web site shall be ready, and your NXT robot fully functional i.e.
it shall implement the two phases: a draft of the source code shall be
on the web site, as well as algorithms. You have the right to modify
your source code after that date, until the last deadline.
- The last deadline is the 17th of February.
Your final source code shall be on the website. Competitions will be
organized the 17th of February in the morning. I will also interview
each member of the group, so as to understand the contribution of each
member.
- Your report consist 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.
Groups (to be defined)
- Group #1: Edward John Fulda, Bachir
Chraibi, Wenting Li, Yara Kazma (4 students)
- Group
#2: Corentin Mauran, Matthias Hernandez, Quentin Marchal,
Thomas Kahn, Alexis Hafner (5 students)
- Group #3: Maria Giovanna Cucca, Pietro Pezzolla,
Adriano di Martino, Francesco Albanese and Yao Liu (5 students)
- Group #4: Olivier Bouvet, Nicolas Dumont, Léo
Goffic, Louis-Marie de Penfentenyo (4 students)
The NXT box, and batteries
- Robots may be borrowed from Marie-Laure Victorin,
at the
Computing Department Secretary's. Please, take care not to loose parts,
especially cables and sensors.
- Batteries may be borrowed from Laurent Castledine.
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):
- I have first installed the package provided in "beta
releases" (menu on the left, on the web site).
- Then, I have uncompress it, installed it in
/Applications/nxt
- 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:
export PATH=
$PATH:/Applications/nxt
- I have downloaded the tutorial
samples code, and I have unzipped it, let say in
/Users/ludovic.apvrille/code
- I have compiled the "5_light.nxc" code as follows, from a
terminal:
$ cd
/Users/ludovic.apvrille/code
$ nbc -O=program.rxe 5_light.nxc
- I have plugged my NXT robot on a USB port, and switched it
on. Then, I have run the following command:
$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.