Saturday, 18 April 2015
NXT Setup

! This section is kept. Nevertheless, as the matches will be only simulated during this edition, the information can be obsolete !

In this section, you will set up the Lego® Mindstorms® bricks in order to obtain the behavior of a Rat's Life feeder. You need to compile a source file and upload the compiled file on the NXT brick. At the same time, you also need to prepare the RJ12 cables.


L'image “” ne peut être affichée car elle contient des erreurs.

Compiling of the source file

For programming the NXT brick, the NXC (for Not eXactely C) programming language is used. You need to download its last release of the command line compiler and install it. The source file to compile is located in:


where WEBOTS_HOME is the root directory of Webots. After the installation of the compiler execute in command line the following instruction (It is assumed here that the current directory is the nbc one) :

./nbc -T=NXT -O=rats_life_final.rxe WEBOTS_HOME/projects/contests/ratslife/nxt/rats_life_final.nxc

This instruction will generate the rats_life_final.rxe compiled file.

Upload the RXE file on the NXT brick

Before uploading, don't forget to switch on the NXT brick (orange button) and to plug the USB cable between the NXT brick and the computer.

The following part depends on your operating system.

For MAC OS X users:

NXC that you downloaded contains also a script called nxtcom. For sending the RXE file to your brick, you just need to type:

./nxtcomm rats_life_final.rxe

For Linux users:

Download this script and execute the following command (assuming that the t2n script and rats_life_final.rxe are in the same directory):

sudo ./t2n -put rats_life_final.rxe

If you have problems with this script, there exists also another one: LiNXT.

For Windows users:

You can compile and upload the source file by using a graphical interface: BrickCC.

Modify the RJ12 cables

The cheapest and easiest way we found to extend the NXT cables length is to buy standard flat RJ12 6:6 1:1 cables (2 meters) and to cut the plastic clip of the connectors by using an utility knife. The cut line is depicted in the following picture by the magenta dashed line.

L'image “” ne peut être affichée car elle contient des erreurs.

Launch the program on the NXT brick

Once the Rat's Life software uploaded and the feeders correctly plugged (see the top figure), verify that the NXT brick is switched on. Then, on the NXT brick, go in My Files | Software files | rats_life_final | Run. All the feeders would switch on and wait the presence of an e-puck to switch off.

Each time that an e-puck switches on, a calibration of the light sensor is performed. Moreover, after a while of inactivity, a calibration is also performed.

The light sensors are sensitive to light variations. For example, you can switch off one light sensor only by creating a shadow on the maze. You can modify the sensibility of the feeders by changing the SENSIBILITY macro variable in the source file.

By default, the NXT brick enters in sleep after a while. You can modify this parameter in  Settings | Sleep -> never.

Top! Top!