FRC robots are controlled by their on-board roboRIO computer. The computer runs software (programs) that are written by Control Systems students using a programming language. Programming languages are very compact, precise ways of telling the robot what to do. Programming languages are very different from spoken languages (English, Spanish, Chinese, etc.) and often consist of as few as 32 words! What's really cool about programming languages is that using that tiny set of words, you can write programs of amazing sophistication.
FRC supports many different programming languages, but Team 2537 uses Java. Java is the primary language taught by most high schools and colleges because the AP Computer Science exam requires Java. Although it is not an ideal language for robotics, using Java allows participation in robotics to help reinforce material learned through the school curriculum. Java is also among the most popular programming languages so it is well worth learning. Java is part of the family of programming languages that includes C, C++, and C# which collectively have dominated computer programming for the last several decades.
The small set of Java words includes verbs (words that invoke an action like 'do'), conditionals like 'if', and you can introduce nouns that are the subjects or objects that other words can act on. Let's examine the simple turtle-graphics exercise from the Control Systems Software Introduction of drawing a square and see how it might look written in Java:
|
---|
Like all languages, Java has specific rules of syntax (grammar, spelling, etc.) that dictate how the language is used. Learning the key words and syntax are the first challenges when learning Java. Notice that:
- Each Java command ends with a semi-colon
- Groups (blocks) of commands are enclosed in curly-braces.
- Details provided to a command (parameters) such as the color to set are placed in parentheses
These are all examples of Java syntax.
Like all programming languages, Java allows you to combine groups of commands into a single unit that forms an abstraction. For example, the words shown above that draw a square could be combined into a single new word that can be used to replace the individual words. This allows programs to be built with increasing abstraction so high level concepts such as 'put the ring on the peg' can be expressed clearly and concisely.