Legend:
Most topics have three options: Overview, Reference, and Visualize. Occasionally the format differs to accomodate certain materials.
If the material is hosted on this site, a (same tab) link will appear. This will open that material in the same tab rather than a new tab, if you wish to simply use the navigation links on the pages themselves to get around the site.
-
It's worth setting it up now so you can just think about code later.
- If you are a brand new programmer, consult with your mentors (or, better yet, a family member who is a programmer) to determine whether Blocks or Java is best for you. Blocks is often considered to be easier for new programmers to understand, and we would recommend choosing that if you cannot consult with anyone. Otherwise, ask someone who knows you better than this paragraph of text does in case there is a better path for you.
- If you are more used to a Blockly language (code.org, Scratch, AppInventor), want a more visual representation of your code, or are part of a team that exclusively uses Blocks code, then Blocks could be a good option for you. However, Java has important advantages (libraries, full access to the SDK, more support materials) that you cannot get with Blocks, so remember it as an option if you ever need that functionality in the future. It shouldn't be too hard to switch over. If you wish to proceed with Blocks, you will be using the REV Hardware Client, so skip the Android Studio section of this page.
- Perhaps you noticed that we didn't list Snap! as an example of a Blockly language. It is, in fact, the finest example of a Blockly language overall, and its "more advanced" nature, featuring object-oriented programming and other important concepts, is such that programmers who are confident in Snap! will likely have a better time in Java than they would dealing with the abstractions and lack of language features present in Blocks.
- If you have fallen through all of the conditions above [OR] have done some programming in a text-based language and been at least reasonably confident in what you were doing, then you should consider programming in Java. This appears to be the most popular option with the widest library of support, and it allows you full access to the SDK (Despite what REV might say, not everything is available in Blocks) and Java language features. There are two environments available in which to program in Java - OnBotJava and Android Studio - and the best option is probably just the one your team uses. However, there are two notable advantages to Android Studio:
- The code is edited from a location other than the robot itself, then the TeamCode package is built onto the robot. It is possible to create and edit code without a Control Hub on hand, which is awesome if you enjoy writing code at home rather than at school.
- Studio can integrate with a Version Control System (VCS), such as Git (covered below) or Subversion (coming soon). Many teams who use Studio host their code on a GitHub repository to enable all their programmers to write code from home, and the VCS lets multiple people modify the same file and have their changes safely merged together. Once everyone is back at the shop, the code can be built onto the actual robot.
-
REV Control Hubs are Android devices, and this IDE (Integrated Development Environment) is used to write and build code that runs on them.
Part 1 - Installation and Configuration
- As with most programs, Android Studio (which is actually Jetbrains IDEA with some extra tools included for Android development specifically) has a guided installer, which can be found here.
- Guided tutorial on installing Android StudioAndroid Developers (official)
- You do not need to install the "Virtual Device" (an Android phone emulator) if you are only going to use this installation for robot programming. (It cannot emulate a robot, so it is not very helpful for us.) This will save about a gigabyte of space.
Part 2 - Basic Usage and Features
- A large IDE can be intimidating if you're not used to it, but a basic familiarity with IDEA's features will make it a lot more friendly, and over time you will find ways to make it more powerful.
Part 3 - Git Integration
- Check with your returning teammates or mentors to see if this section applies to you. Many teams use Git / GitHub to track their code, but not all teams do, or they may use a different system. (If you fall into the last case, we hope to add information for other systems to the Springboard soon, but the Jetbrains materials below also have information on other ways to integrate VCS into the IDE.)
Part 1 - Connect Android Studio (IDEA) to Git
- We need to tell the IDE where our code is.
Part 2 - Git
- To take full advantage of this version control system, we need to understand how it operates.
Part 3 - Git from within Android Studio
- We can use Git right inside Android Studio! This is convenient - you can edit a file, go to a tab in the same editor, and stage and commit those changes.
-
Learn the basics of the language and Object-Oriented Programming (OOP)
- Overview: W3Schools Java Tutorial (Go through the "Tutorial" and "Methods" sections, then stop. The Oracle tutorial below ("For your second season") covers the remaining concepts more effectively.)W3Schools
- If you want to try some of the exercises yourself but don't want to install the Java runtime, Replit lets you write and run code online for free. (At the time of writing, it's all branded up for GPT integration. You can safely ignore all that.) Alternatively, you could just wait until we start writing code for a robot.
- Reference: Java API Documentation (Javadoc)Oracle
- For your second season: Oracle's Java tutorial - You're ready to start utilizing Object-Oriented Programming concepts and creating your own libraries and interfaces. This tutorial will introduce you to OOP and some of the mroe unique Java language features. Start with the "Learning the Java Language" trail.Oracle
-
The SDK created by FIRST which provides functions to interact with the robot
- FTCsim is a good way to experiment with code if you do not have a robot readily available.
- Overview: Hello Robot - Introduction to ProgrammingREV Robotics (official)
- Blocks [OR] OnBotJava: Read through the entire tutorial.
- Android Studio: Read through
- Reference: FtcRobotController API Reference (Javadoc)FIRST (official) via javadoc.io
- Most of what you will need to know is in the RobotCore (com.qualcomm.robotcore) package. The hardware devices (motors, servos, sensors, etc.) provided are in com.qualcomm.robotcore.hardware.
What is an "OpMode"?
- Let's make this clear: An "OpMode" is a program, just like any other. It's really no more complicated or confusing than that. Still, for FTC it must follow a basic structure. This involves making your class extend either OpMode or LinearOpMode, and deciding which to use can be a bit tricky. Here's the simple answer:
- If you are brand new to this, LinearOpMode is probably your best bet for writing your first programs.
- If you have only worked with procedural programming (Lightbot, basic programs with no callbacks (functions as objects), etc.), then you will want to start with LinearOpMode.
- If you are at least reasonably confident in handling callbacks (functions as objects) OR have ever programmed for Arduino, you will almost certainly prefer OpMode.
- Programming a Mecanum Drivetrain - Beware the box about which direction the motors turn and which side to reverse - they got their lefts and rights mixed up! Here's how that works (same tab).Game Manual 0
You will never memorize everything. You have already become a confident programmer when you can gather the information you need to complete a task on your own. Plenty of good resources are available on the internet, and here's a few reliable sources to help you start exploring. Additionally, a great project for your first off-season is to just go make something - perhaps a well-made OpMode or an interface you wish you had during the season - that requires knowledge and expertise you don't have yet. (Quick tip: A good first skill to gain is a basic understanding of object-oriented programming. Here's an introduction.) Once you start looking up how to do a few things, you will become comfortable with using the search engine as a resource very quickly.
When you can learn new things on your own, you don't need the Springboard anymore! Enjoy your time as a confident FTC programmer!
- You will need the official API (Application Programming Interface) documentation. - This tells you all the classes and methods available, what arguments they take, what they will return, and their general purpose. This covers literally everything provided to you by the FtcRobotController SDK.FIRST (official) via javadoc.io
- The FTC Forum - If your mentors don't know the answer to a question or there's a weird technical problem, you can ask about it here.FIRST (official)
- Also the FTC Forum (the old one, because they might not have brought all the old posts forward when they migrated...)FIRST (official)
- Official FIRST FTC documentation (although there's not much there that you haven't already learned here)FIRST (official)
- FtcRobotController (the SDK) on GitHub - Make sure to check out the repository Wiki. Follow links in the README to official resources, open an issue to report a bug or suggest a new feature, or fork the repository to make your team's own GitHub repo. The advantage of forking is that updates made to the SDK can also be applied to your fork while leaving your code intact.FIRST (official) via GitHub
- The wonderful Game Manual 0
- ftctutorials.com
- FTC Tricks
Bonus notes
- Tidbits that might give you good ideas
A random note: Most forum and Q&A sites are trustworthy. If you don't feel comfortable with it, you can look for another one, but the helpfulness of a particular thread usually only has to do with its relevancy, or at least the relevancy of any of its answers, to your problem. It's the users of a site that determine its trustworthiness, not the site itself.
🄯 2023. Any copyrights given in the remainder of this statement are collectively held by the "MI-FTC" GitHub organization and all its members. The FTC Springboard (this particular page) has only one license term associated with it: No person or other entity can sell this work or access to it. It should be freely accessible. Of course, if you use it as a portion of a larger profit-making work, that's fine. We just don't want people to have to pay for this. Otherwise, do literally anything else you want with it. A non-exhaustive list of examples: It can be included in any larger work, whether commercial or noncommercial, profit-making or not. You can publish modified versions of the Springboard or derivative works. You can also just publish it verbatim if you want to mirror it, archive an older version or whatever. We don't really care, just don't sell the work itself. Thank you for being a kind member of the FTC community!