Lesson: Getting Started

Overview: 
Explore the procedures to install the software tools needed to develop Java programs for Tetrix/REV robots.
Objectives: 

Complete the installation of all of the software tools needed to program Tetrix/REV robots with Java.

Content: 

This course will not delve into Tetrix/REV 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 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. 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.


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).

The control system consists of a driver station device which connects to a robot controller device over WiFi. The controller device may be a cell phone connected to a REV Expansion Hub or the REV Control Hub. The Control Hub integrates the robot side cell phone into the Expansion Hub (video).

Here is a diagram of the REV control system hardware components using a robot controller cell phone and Expansion Hub. Here is a video discussing the wiring of the REV components. Here is a diagram of the REV control system hardware components using a Control Hub instead of a robot located cell phone.

As mentioned, the REV control system may consist 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 more on this later). Here is a video (watch to 4:42) on these two apps showing how to operate them. 

The control system may also consist of the driver stations phone and the REV Control Hub instead of the second robot-located phone. The driver station phone is set up the same as discussed in the previous paragraph. The Control Hub comes with the controller app preinstalled. The Control Hub must also be configured to know about the specific hardware devices (motors, sensors) that are part of your robot (we will cover more on this later). Here is a getting started video for the Control Hub. There are more Control Hub resources at the bottom of this page.

The control system may also consist of the REV Driver Hub and the Control Hub, thus eliminating both cell phones.

Note: The Control Hub setup instructions show you how to change the hub name (also the network name) to something custom to your environment. When you change the controller name, after you get the confirmation message, you need to power the hub off and back on before reconnecting. The Control Hub has three software components that may need updating, the firmware, the OS and the Robot Controller App. You can update these items by following the instructions here but the best way to update the Control Hub is with the REV Hardware Client found here. Expansion Hubs only have firmware that may need updating and you can do that with the REV Hub Interface found on the same page. You can also update either hub from the OnBot web page under the Manage tab (See the Start Programming lesson).

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 device. You access OnBot with a web browser and essentially write your code "on" the controller device. In this case, the Java tools and FTC SDK are installed on the device when you install the base controller app from Google Play or by compiling the FTC SDK at least once. 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 from github. On the github page for the SDK, click the Code button. Then click Download ZIP. As a suggestion, create a folder called FTC Java Projects in your My Documents folder and extract the FTC SDK (FtcRobotController-master folder) from within the zip file into the FTC Java Projects folder. Then rename that folder to include the FTC SDK version, ie: FtcRobotController-master-6.0. This will allow you to keep older versions of the SDK when you 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. You will need at least version 5.4 for the example code in the lessons. 

If you install a newer version of the SDK, locate the Team Code folder inside your previous FtcRobotController-master-n.n folder with Windows Explorer and copy your source code to the Team Code folder of the new version.

Here is a link to download Android Studio. This curriculum expects you to be on AS 3.4.2 or later. FTC SDK 6.0 requires you to be on AS 4.0 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.

Starting with FTC SDK version 5.5, robot controller and driver station phones must be Android 6.0 or later.

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 (FtcRobotController-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.

Finally, open File->Settings->Build->Experimental. 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.

Here is more documentation on robot controller programming.


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. Besides the video above, here are resources to help you get started with the Control Hub:

Control Hub Home Page

Control Hub User Manual

FIRST's Control Hub Documentation

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.

 

Navigation: