Unofficial FLL FAQ06-c - General Programming

UFAQ Table of Contents

Q11.1) Should I use RoboLab, RIS, or NXTG for programming the robot?
A1) NXTG only works with an NXT. RIS works only with RCX. Robolab 2.9 or better will work with NXT or RCX. Earlier versions only work with RCX.
A2) They each have their own advantages and disadvantages.
A2) RCX: Use RoboLab if you are using Windows NT or a Mac (RIS does not work on NT or Mac).
A3) Most coaches who have used RIS and RoboLab agree that RoboLab is more capable but a little less intuitive. Neither should prevent you from attaining high scores. If you have the time, try both and see what your team thinks. If most of your team already is used to one, go with that.
A4) NXT: Selecting Robolab over NXTG is still TBD. Your input welcome!

Q11.2) RCX: What is Mindscripts?
A) Mindscript is the foundation of RIS. It is a text based language that the RIS user interface reads and writes. Your programs are stored as Mindscript files. A 'compiler' turns these files into code when you ask to download your program to the RCX.

Q11.3) RCX: Can we use Mindscripts to program out robot?
A1) Using Mindscripts directly as your programming language is legal. Mindscripts is not called out as a legal language directly, but as it is the foundation of RIS it is allowable.
A2) Consider introducing Mindscripts to a veteran team in the off season to teach a 'traditional' text based language. Be warned that the error messages are not very good and it will take some time to learn.

Q11.4) RCX: No matter how hard we try, we can't get a program to load into slot 1 or 2. What are we doing wrong?
A) By default, slots 1 and 2 are write protected. During firmware installation two generic programs are downloaded to slots 1 and 2. You can free these slots for your own programs by:

Q11.5) RCX: Which is better RIS or RoboLab?
A) This is a hard question to answer. There is no one right way to go. If there was, we would not have two choices!
There are three versions of RIS. 1.0, 1.5, and 2.0. There is little argument that RIS 2.0 is far better than 1.0 and even 1.5. If you have an old copy of RIS, getting an upgrade to 2.0 is highly advised unless you want to consider RoboLab.
There are several versions of RoboLab as well. These are 1.5, 2.0, 2.5, 2.5.1, 2.5.2, 2.5.3, and 2.5.4. For owners of 2.5, the patches to make it 2.5.3 are free and available on the web (http://www.ceeo.tufts.edu/robolabatceeo/resources/Service_Pack/default.asp). Version 2.5.4 is not a patch and requires a purchase from Pitsco. The advantages of 2.5.x over 2.0 are the introduction of the automatic wiring feature, support for the USB tower, and support for the new firmware features.
Here are comments from users of the forum. Some editing has taken place.
I think that RIS 2.0 has a definite advantage over RoboLab due to the simplicity of the programming. When I competed in Volcanic Panic last year I found that it can take days of practice to master RoboLab. I highly recommend RIS 2.0 over RoboLab and I hope you will use it.
-Thoughts from a 10 year old RIS user
RoboLab 2.0 is far more powerful than RIS, though it lacks the capability of some of the new firmware. RoboLab 2.5 supports the new firmware and the USB tower. (Both versions are legal for FLL). From my perspective as a programmer for over 15 years, RoboLab offers a better analogue to "real" programming than RIS. I am also annoyed by limitations of RIS that force multiple tasks, each watching a different sensor, etc. than straight-forward sequential programming that allows "if/else" type constructs, etc. using the sensors. I firmly believe RoboLab will leave students better prepared for programming with more traditional languages than RIS. There are FAST line following algorithms that can be coded in RoboLab that cannot be coded in RIS.
-Peter
RoboLab is available from Pitsco through their latest catalog. Major differences: support for the USB tower, programming the RCX, the Scout, and the Dacta control lab, auto-wiring, support for the new RCX firmware functionality, better Internet + direct control, support for a camera as a sensor (via infrared messages and a PC interface to the camera). The functional icons have been more hierarchically arranged and the interface is a little "cleaner" w.r.t. picking commands. All in all, a nice improvement, but not critical to FLL unless you need the USB tower (a big help for me since my laptop handles USB better than serial).
-Peter
If you are Macintosh based, RoboLab becomes a requirement as RIS does not run on a Macintosh.
-Mark
RoboLab is a vast improvement over RIS. I have programmed for the past two years with the RIS programming, and this year we bought the Tech upgrade just to get RoboLab. It is vastly more powerful, but harder to use. You have to learn how to string things together (it doesn't attach programming blocks together automatically like RIS), and figure out how to program some of the sensors, but it much more productive. I recommend RoboLab, but allow some training time for your programmers.
RIS was designed to make it easy to program, make it impossible to create a "compile error", and to minimize technical support. As a consequence of this design criterion, some programming tasks are more difficult to program using RIS, and some are downright impossible. This competition is for the kids, and my opinion is let the kids choose the programming environment. My team chose RoboLab because they understood it, which is more important than any theoretical "programming power".
RoboLab is more powerful and versatile, but it takes longer to learn, if you have gifted / talented kids or older kids that can work on it by themselves - go for it.
-A second year coaches opinion
RoboLab is my choice. RoboLab is dual platform, and more powerful and versatile. My recommendation is buying the teacher manuals from LEGO. I have the kids begin by reading and working through examples in the manual. They quickly become familiar with the interface and logic. There is more room to grow with RoboLab. There is a reason LEGO markets RIS to the toy stores and RoboLab to the educational community.

Our kids are coming along with RoboLab. We used it this year because one of our kids uses a Mac and he was the most interested in the programming, so RIS was not an option. It does take a bit longer to figure it out, but now that they have been using it for awhile, they like it. On the average our team has older kids than the team we coached last year, so RoboLab hasn't been a problem.


Q11.6) How can we make our robot follow a black line?
A1) This question is beyond the scope of a FAQ. Following a line is more art than science. It is best to have the team work this issue early to come up with an algorithm that works on your robot. A search of the web will turn up lots of raw information you can use to get started.
A2) Have you read "Toeing the Line” or the “Coaches’ Primer”? Both documents are available for download at http://www.fll-freak.com.

Q11.7) RCX: How big can each of the 5 programs be?
A) Individual program slots do not have a size limit. Memory management inside the RCX divides up the total memory on an as needed basis. There is no simple answer to how large all programs can be. It would depend on the firmware version and other factors. The bottom line is that it would be fairly unusual for an FLL team to exhaust available memory. What is possible is that the memory becomes fragmented to the point that there is no one chunk large enough for your program. The solution is to delete all programs in all slots and start fresh.
Also note that in RIS there is a maximum size for each stack. This is not an RCX issue but a limitation of RIS. There are ways around this problem.

Q11.8) How can you program a "break" to prematurely abort a loop?
A) Use the traditional "abort flag" mechanism. This is hardly "simple" but it works. Here is the concept in text form. Converting to RIS, NXTG, or RoboLab is left as an exercise to the reader.
   Set "container/variable of choice" = 0
   Loop while "container/variable of choice" = 0
   |    (Body of loop goes here)
   |    IF on 'normal exit criteria'
   |    |    Set "container/variable of choice" = 1
   |    End IF
   |    IF 'abort exit criteria' 
   |    |    Set "container/variable of choice" = 1
   |    End IF
   End loop

The flag ("container of choice") starts out cleared. When either the normal or the abort exit condition occurs the flag gets set, and the loop exits.

Q11.9) How can you program a loop to terminate on one of two conditions not just one?
A) Look at the above question and think "second exit criteria" rather than "abort exit criteria".

Q11.10) What should be in the program's pre-amble?
A) The preamble is a section of code that you execute first before you start in on your mission code. Not all teams will use a pre-amble. The preamble would set up variables and sensors. Other things include:
1) Display the team number or some other number to the display. This lets you know it is YOUR code and not injected by mistake by some other team.
2) A 1/2 second delay. This allows fingers to get out of the way before the robot lurches off.
3) Initialization of needed constants.

Q11.11) Our robot is not stopping at the specified rotation sensor count. Why?
A) To understand this problem, you need to understand that the RCX/NXT will not be able to evaluate the stop condition for each and every rotation sensor count. It may only see counts of 97, 98, 101, 102, 105, ... If you wait for the rotation sensor to equal 100 it will never stop! What small change to the stop condition can you make to compensate for the occasional skipped number?

Q11.12) RCX: We can't download programs anymore!
A) Look for these issues:

Q11.13) My RCX seems dead. What can I do?
A) On occasion the RCX gets very confused and needed to be 'rebooted'. Simply remove a battery and wait 2 minutes by the clock. Reinstall the battery and download the firmware. This normally takes care of most problems. If this fails, you may need to replace the RCX. LEGO is very good about sending replacements.

Q11.14) Repeated insertion and extraction of the RCX serial tower plug is damaging my computer's serial port connector. What can I do?
A1) The molded plastic connector on the serial tower is fairly tight. It can do damage to a weak computer connector. A solution is to replace the cable with a standard 'straight through' 9 pin female to 9 pin female serial wire available at most computer stores. Bring the tower with you to make sure the new cable will fit properly.
A2) Purchase a serial extension cable.
A3) Replace with a USB tower.

Q11.15) Can my team use NQC, Java, or ...
A) No. The only legal languages are RIS, and RoboLab of any version.

Q11.) The RCX sometimes does not behave properly.
A) One possibility is mismatched firmware. If you are using RIS and RoboLab or different versions of RIS you may experience this problem. You may have downloaded an older less capable version of the firmware into the RCX from one program and trying to use advance features of the other. The solution is to pick one language and reload the firmware from that program only.

Q11.16) FLL allows 2 light, 2 touch, and 1 rotation sensor, but there are only 3 input ports on the RCX. What gives?
A1) Who said you have to use all the sensors? You can pick what you want.
A2) A trick allows you to use all the sensors at the same time. It's called piggybacking. Some sensors can be connected to the same port on the RCX. You can connect both touch sensors to one port and the RCX will report 'touched' when either switch is depressed. You can also piggyback a touch sensor and a light sensor. As long as the touch sensor is not depressed, the light sensor will report as it should. When the touch sensor is depressed, the RCX reports that it saw a light value of 100. Unless you are working close to the sun, you can therefore tell the difference between a light sensor value (<100) and the switch being pressed (=100).
A3)It has yet to be shown possible to piggyback a light sensor with a rotation sensor, two or more light sensors, or two or more rotation sensors together.

Q11.17) Why does our robot not stop when it reaches the end of our program?
A) The RCX does exactly what you tell it to do. If the last motor instruction was to turn in on, it will stay on even after the end of the program. The solution is to stop all motors at the end of all programs.

Q11.18) This year's competition has more than 5 missions but the RCX can only hold 5 programs? What are we supposed to do?
A) You can:
  1. Only run 5 missions.
  2. Combine 2 missions into one program. Do ABC and XYZ before returning to base.
  3. Have one program slot run two missions based on some external input. Hint: Remember a program can branch as a function of a sensor input. Just remember not to violate the green button rule.
  4. Brainstorm the problem and come up with an even better solution.


Q11.19) Is there such a thing as a global variable/container that can be used across all 5 RCX program slots?
A) Variables/containers are a function of the firmware and are both global and persistent. Persistent indicating that they keep their values from one run to the next. In Robolab the containers support both global and persistent features.
In RIS, variables are reset to zero before your program starts rendering the firmware global and persistence useless. You can modify this default behavior by modifying the default macro in RCX2DEF.h located in the script\include directory of the RIS program directory. The default is to define:
var MyVariable = 0
Which both defines the variable and initializes it. If you change it to:
var MyVariable
It will only define the variable and not initialize it. Now you may use this variable as a global variable. Just make sure you initialize it someplace, typically in program 1.

UFAQ Table of Contents
Home

Disclaimer: This FAQ is not an official FIRST document. It is an accumulation of knowledge derived from six thousand messages posted to the FLL forum over three seasons. It has been reviewed by numerous people, but may still contain errors. Use at your own risk.
Readers are encouraged to submit errors, suggested wording changes, new topics, or comments to Skye Sweeney at skye@fll-freak.com
Copyright 2003-2006 Skye Sweeney; Last Updated on 10/28/2006