Lund University

BEST Summer 07

Course plan (old)

Schedule 2007

Contest Rules 2007

The Contest Map 2007

Software FAQ



Robots 2007




BEST Summer course 2007


There is a number of questions related to our software system you might have. If you would like to find a particular answer here, please let me know.

  • Q1.1: Why don't we use the software provided with LEGO MINDSTORMS?

    Because the software that comes with LEGO MINDSTORMS may be run solely on machines running M$Windows operating system. We do not have such hardware available. Even if we had, we wouldn't like to run it:-)

  • Q1.2: What software may I use for programming our robots?

    There is a number of systems that allow you to program an RCX using textual programming languages ressembling C, Java, or even Common LISP. Two of them are available in the laboratory: NQC (see below) and LeJOS. I expect to get BrickOS before the end of the first week of the course, otherwise I'll give up.

  • Q1.3: What is NQC?

    NQC is a system allowing you to program the RCX using a restricted C-like language. The system uses the original LEGO MINDSTORMS firmware (operating system). An NQC program is compiled into the byte code of RCX and transferred to the brick using IR connection, in order to be run (interpreted) on the robot.

  • Q1.4: What is BrickOS?

    BrickOS is an operating system used instead of the original LEGO MINDSTORMS firmware. It is much more powerful than the original OS, allowing you to use C or C++ languages for user programs. The programs are cross-compiled to the assembly code of the RCX microcontroller (Hitachi H8/300).

  • Q1.5: What is LeJOS?

    LeJOS is an alternative firmware for the RCX providing the Java Virtual Machine (actually it is based on TinyVM). RCX programming is done in this case in (restricted) Java.

  • Q1.6: What necessary hardware set-up needs to be done?

    • You need to plug in the IR tower into a free USB port (e.g., on the keyboard).
    • You need to put batteries in the RCX box.
    • You need to download firmware (Operating System) into the RCX - see Q3.1. In case of NQC you use the original firmware from LEGO: file firm0328.lgo found in the Firmware folder of the NQC system. In case of BricOS or LeJOS you substitute this file with something else. See explanations for the specific system.
    • Q1.7: What program does the sender brick run?

      The sending programs are send1.nqc (sends a 1), send2.nqc (sends a 2), send3.nqc (sends a 3), send4.nqc (sends a 3), send5.nqc (sends a 2).

  • Q2.1: How do I change the language to English (Spanish, French,...)?

    Perform the following sequence of actions:

    • Run "System Preferences" ("Systeminställningar" in Swedish), either by clicking on it in the dock, or by choosing it from the blue apple menu (top-left corner of the screen).
    • In the row entitled "Personal" ("Personligt" in Swedish) klick on "International" ("Internationellt" in Swedish)
    • Now you are presented with a list of available languages, in order of preference. In the standard set-up at our department "Svenska" comes first, followed by "English" and some other languages. Pick English (or some other language of your choice) by pointing to it with the mouse and pressing the mouse button, and move it above Swedish.
    • Close the application, e.g., by pressing the red button of the window, or via the menu.
    • You are done. The applications run since now on should speak the chosen language already. To get the system (Finder) speak it you have to log out and in again.

  • Q3.1: How do I set up NQC in the MacLab (aka 2121, aka \Sigma)?

    • Locate "MacNQCX4.0b3.sitx.hqx" in the /mosx/brickos/ folder. Drag it to your desktop.
    • Double-klick on the "MacNQCX4.0b3.sitx.hqx" icon on your desktop - you will get a folder called MacNQC, with a number of fils in it.
    • Read the README file there (and possibly some others, if you wish).
    • Drag the file "firm0328.lgo" from the /mosx/bricos/ folder to the "Firmware" folder inside MacNQC.
    • Double-klick on the yellow MacNQC icon - it starts NQC system. The first time you run it, you will be asked a number of questions about the IR tower setup - use default answers.
    • "Untitled" is the placeholder for your first NQC program. You may wish to use examples from the manual, or you may wish to open the "test.nqc" file instead.
    • Before you run your first program, you have to download the firmware to the RCX. Use appropriate menu item for this. You have only one firmware file so far - choose it.
    • Try compiling and downloading the test program.
    • Try modifying it, compiling and downloading again.
    Congratulations! You are ready to prepare and run application programs using NQC. Get acquainted with the system. Read the tutorial document.

  • Q3.2: How do I run NQC programs?

    NQC has a number of buttons that allow you to open, edit and save program files, compile them, download to the RCX and run. Investigate the menus and buttons (they should show a description if you move a pointer over them). Use the built-in help, if necessary.

  • Q3.3: What limitations do I have in NQC?

    The short answer is: whatever is imposed by the original RCX firmware. A more detailed answer is:

    • Maximum 32 variables.
    • Only integer values.
    • Only five programs downloaded to the RCX.
    • Maximum ten tasks per program.
    • No nesting of subroutines.
    • Maximum eight subroutines.
    • No parameter passing to/from subroutines.

  • Q4.1: How do I set up BrickOS?

  • Q4.2: What do I need a cross-compiler for?

  • Q4.3: How do I program using BrickOS?

  • Q4.4: How do I run my programs?

  • Q4.5: Why do I need to use NQC when developping BrickOS software?

  • Q5.1: How do I set up LeJOS?

    The short answer is: Follow the instructions contained in the MacOS X part of the official LeJOS Tutorial (see the Links page). A slightly more detailed prescription:

    1. Unpack the tarball using tar.
    2. If needed, set the paths of your environment so that JDK is visible.
    3. (Important in our setup!) Edit the Makefile in the directory rcxcomm and comment out the row "cd src; make".
    4. Issue make on the top level.
    5. Set up the environment so that LeJOS becomes visible.
    6. (Important in our setup!) Use only the C-based tools for compilation and download - the Java-based ones do not work here.

  • Q5.2: How do I run LeJOS?

    • Once for a while (i.e., when necessary) download the firmware using lejosfirmdl command.
    • Compile your application, link and download. Remember to use C-based tools, i.e., lejosc and lejos.

  • Q5.3: What limitations do I have in LeJOS?

    The major one is lack of garbage collection. Do not proliferate objects! Otherwise most of the expected things are there, inluding preemptive threads, multi-dimensional arrays, recursion, floating point math and java.lang.Math, to mention just some important things.

Last update:
Friday, 27-Jul-2007 10:38:22 CEST
© Institutionen för Datavetenskap 2004, 2005, 2007. Ansvarig: Jacek Malec

Valid HTML 4.01!

Valid CSS!