Instructional Material: Getting Started

Printer-friendly version

This course will not delve into Tetrix hardware details or discuss how to build the physical robot. It is assumed you will learn about these topics elsewhere. The code exercises for this unit can be run on the classic example Tetrix robot "pushbot", build instructions here.


Note: Starting with 2019-20 season, FIRST has renamed pushbot to "basicbot" and changed it's construction. We think the original pushbot is a better match for this curriculum and recommend you use the pushbot guide linked above. 


Note: Previous to the 2019-20 season, FTC robots were only constructed from the Tetrix robot hardware platform. Consequently, we used the word Tetrix as the name for FTC robots throughout this curriculum. Starting with 2019-20, REV Robotics will also offer a hardware platform for constructing FTC legal robots. While these hardware platforms are different, the control system, motors and sensors are the same. So while our use of the word Tetrix as a name for FTC robots is not so accurate anymore, we are not changing this curriculum at this time as it applies equally to both hardware platforms.


Tetrix robots can use two different control systems, the older one by Modern Robotics (MR, see bottom of this page) and the newer system by REV Robotics (REV). This course is focused on REV hardware (see bottom of this page for more).

Here is a diagram of the REV control system hardware components. Here is a video discussing the wiring of the REV components.

As we discussed earlier, the Tetrix control system consists of two cell phones, a robot controller phone and a driver station phone. You download the driver station phone application (app) from Google Play. Search Play for "FTC Robot". You do not modify the driver station app. You should also download the basic version of the controller app onto the controller phone. This allows you to get some familiarity with the two apps and how they are configured for FTC use. The controller phone must be configured to know about the specific hardware devices (motors, sensors) that are part of your robot (we will cover this later). Here is a video (watch to 4:42) on these two apps showing how to operate them. Here is another useful tutorial (sections 4 through 7) on the REV control system hardware.

FIRST has official tutorials for robot construction and programming as well as kit of parts information on the firstinspires.org web site. Information resources for participation in the FTC competition can be found here. Information on team management can be found here.


With a basic introduction to the hardware done, we can now look at the two programming environments available, OnBot Java and Android Studio. OnBot Java is a much easier way to get started writing code since you don't have to install anything on your PC. Android Studio is far a more powerful tool, but is more complex to install, learn and use. It makes sense to start with OnBot and move to Android Studio later if appropriate.

OnBot Java is an IDE hosted by the robot controller phone. You access OnBot with a web browser and essentially write your code "on" the controller phone. In this case, the Java tools and FTC SDK are installed on the phone when you install the base controller app from Google Play. We will discuss how to use OnBot in more detail shortly.

Android Studio is a professional level tool used to create the complete robot control program from source code. The source code for the robot controller app is available to you to download and install into Android Studio (AS). This is now you create your own robot control programs, by modifying the FIRST supplied controller app source code (adding your robot programs into the controller app). This source code is called the FTC SDK. Experience with AS will carry over to using other advanced IDEs if you plan to move up to FRC and RoboRio. 

If you choose to develop your code using Android Studio, you will need to complete the installation of AS and the FTC SDK on your PC as described below. If you choose to use OnBot, you can skip to the last section of this lesson.


The procedures for installing the software tools you need to use Android Studio are discussed in this video. Links to the components discussed in the video are below. Review the rest of this page before starting.

Note: The Java runtime and SDK are now included in the Android Studio install. The links to these individual items are retained here should the need arise to install them manually, but normally you can skip that and they will be installed with AS.

Here is a link to download the Java runtime.

Here is a link to download the Java SDK. Download the i586 file for 32-bit Windows, x64 for 64-bit Windows. When installing, you only need the Development Tools, you can X out Source Code and Public JRE. The public JRE is the same as the Java runtime installed above. You could skip the Java runtime install above and include the public JRE during the SDK install. Either way works.

Here is the link to download the FTC SDK on github (version 4.3 or earlier). Here is the link to download the FTC SDK on github (version 5.0 and later). Version 5.x will be the official version for the 2019/20 FTC season. On the github page for the SDK, click the green Clone or Download button. Then click download zip file. As a suggestion, create a folder called FTC Java Projects in your My Documents folder and extract the FTC SDK (ftc_app-master folder) from within the zip file into the FTC Java Projects folder. Then rename that folder to include the FTC SDK version, ie: ftc_app-master-5.0. This will allow you to keep older versions of the SDK and safely install new versions. You should not overlay an existing version with a newer version. You can find the version by scrolling down on the github page to the Release Information section. The version of the SDK will be shown there. If you install a newer version of the SDK, locate the Team Code folder inside the old ftc_app-master-n.n folder with Windows Explorer and copy your code to the Team Code folder in the new version folder. Starting with version 5.0, the ftc_app prefix will be replaced by the yearly game name, ie: Skystone-master.

Here is a link to download Android Studio. This curriculum expects you to be on AS 3.4.2 or later. The AS install process involves several long downloads so perform the AS install and the project import (below) on a fast internet connection.

As shown in the video, at the end of the AS install process,  you will be prompted to tell AS what project to start with. You will want to select Import Project (Gradle) and select the folder (and click Open) where you installed your FTC SDK (ftc_app-master-n.n) project. At this point AS will use Gradle to import and analyze your project.

Gradle is the name of the tool used with AS to compile and deploy the robot controller app. On first import of the controller project, Gradle will scan the project and determine what Android components are needed by the project and flag any missing components as errors along with a link you can double click to install the missing item. This scan/download process can take a long time. There can be a number of install operations flagged during the initial Gradle sync. Be patient and complete each flagged install. After the downloads complete, Gradle will run for some time to complete the import. Watch the status bar at the bottom of the AS screen to see when all Gradle activity ceases. When done you can minimize the status display area at the bottom of the screen with the minimize button just right of the gear icon on the status display area top bar.

After Gradle processing completes, AS will show a blank editing area on the right and the project navigation window on the left. AS may also show a single blank editing area. On the vertical bar left of the navigation window or editing area, select Project. Then on the tabs at the top of the project window, in the view drop down list, select Android. This will give you the simplest view of the project. You should see two main folders, FtcRobotController and TeamCode. FtcRobotController contains the low level FIRST provided components of the robot controller app. You will not need to modify any part of this code. However, the FIRST provided example code is located here. You can open the folders to java then org.firstinspires.ftc.robotcontroller (a package) then folder external.samples to see the example code. This example code is a very valuable resource to learn how to program many robot functions and use various sensor devices once you have completed this course.

The TeamCode folder is where you will put all of your source code. Open that folder and then java and then org.firstinspires.ftc.teamcode which is the folder (also the package) where your code will be.

Android Studio versions prior to 3.5 include a feature called "Instant Run". Some FTC teams have had problems with this feature interfering with deployment to the robot controller phone. It is recommended that you disable instant run by opening File->Settings->Build->Instant Run, uncheck the first box, then click Ok.

Next, open File->Settings->Build->Experimental. Click it and then uncheck Only Sync the Active Variant then click Ok.

Note: If you are in a class room or other situation where multiple users, with different Windows user names, will share a single PC to work on this curriculum, please see these instructions on Android Studio shared by multiple users on the same PC.

We will learn more about how to use Android Studio in a later lesson.


The rest of this curriculum assumes the use of REV control and sensor hardware.

If you are using the REV Robotics control hardware, here is a documentation package by REV that discusses using the Expansion Hub controller. Note that we will cover robot hardware configuration in a later lesson.

If you are still using Modern Robotics control hardware, here is a refresher (watch first 4:30) on the MR hardware environment. Here is a diagram of the MR system hardware components and a diagram of the basic wiring of the MR control system. Here is a lesson package by Modern Robotics that explores the hardware components in great detail. You don't need to explore this now but you may wish to look at this material later to gain much more detailed information about the hardware components, how they work and what you can do with them. When you visit the Modern Robotics Education web site, you will be prompted to login. Click on guest access below the login boxes to access the site without registering. 

A great resource to use while working with the FTC platform is the FTC Technology Forum.

 

Material Type: 
Lecture/Presentation
Education Level: 
HW Platform: 
SW Platform: 
Interactivity Style: 
Audience: