NXT-G Programs for SuGO.
In order for a SuGObot to be able to play, it needs a program. This program must know how to read the line and eye sensors, and drive the motors to perform the game strategy.
When we run our monthly " SuGO Sunday" competitions at GEARS, we require that all the SuGO bots are pre-loaded with the same standard program. This way the robots all use a similar strategy, so it's all up to the mechanical design and game play to produce a winning SuGObot.
However, for other competitions, if people are designing their own robots at home and bringing them to a "Bring'n Battle" style competition, there's no reason why the team can't also develop it's own programs.
A SuGO program can be written in many different languages. The most common programming language used for the MINDSTORMS NXT is NXT-G. NXT-G is the graphical language that comes bundled with the retail NXT kit.
You can also use C, LabVIEW or even Java to program the NXT, but for this page, we'll limit our discussion to NXT-G.
The following program files are known as a Pack and Go files. They have an .rbtx extension. This file not only contains the main program, but it also contains all the other files needed to run the program (eg: sound files, MyBlocks etc.) If you download this file, you can open it with NXT-G Version 2.0 or later, and then download it into the NXT.
Two Styles of SuGObot programs are presented here. The first PV1 style assumes that the robot has two light sensors to detect the black line around the ring. The second C2 style assumes you have one lignt sensor, and one color sensor. Depending on what type of sensors you have, you should download the corrosponding programs and manuals.
PV1 programs for Two Light sensors and the LEGO Education version of NXT-G.
C2 programs for One Light sensor, One Color Sensor and the LEGO NXT 2.0 version of NXT-G.
Good Programming Practices.
At GEARS we are FIRM believers in taking the time to develop Good Programming Practices. These two programs are good illustrations of what we mean by that.
Both programs make strong use of Subroutines (or MyBlocks). These appear as blocks with a teal colored band across them. Each MyBlock can be double clicked to show further detail. The idea is that MyBlocks enable the program to be divided into smaler portions that can be tested or modified independantly. MyBlocks can also be shared between programs to make it easier to create new SuGO programs with more sophisticated strategies, based on pre-tested functions.
These programs also make extensive use of text files to save SuGO setup information, and variables to share this information between the different MyBlocks.