Tesla Summer Training

Pre-Class Homework

Hello there. I'm very excited to begin this year's Tesla Summer Training. Before we can get started, however, there are a few things you'll need to do on your own. Please complete the following tasks on each of the laptops and robots you'll use during the course to make sure everything is set up correctly.


Each item is covered in more detail below.

When you've successfully downloaded and run the NullOp program using every laptop and every robot, you're ready for class.

Java Development Kit

The Java Development Kit (JDK) contains all of the tools necessary to compile your code (written in Java) into something the Android phones can understand. You may already have the Java Runtime Environment installed on your computer in order to run Java code, but this isn't enough. The JDK is available from Oracle at http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html.

Once there, under Java SE Development Kit 8u131 (or a similar number after the u), click Accept License Agreement and then choose the download link corresponding to your computer's operating system.

Once downloaded, install the software. Installation instructions for your particular operating system can be found at http://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html.

Android Studio

Android Studio is a code editor and environment with tools to help us build and download our code to the Robot Controller phone. It can be downloaded from https://developer.android.com/studio/index.html.

When the application is first opened, it will need to install a number of additional libraries. The default SDK location, as well as the default library downloads (usually the Android SDK, and the Android SDK Platform) are good choices during the initial setup wizard.

In addition to these default libraries, we need to install a few other packages. We can either (1) attempt to build the FTC App and simply follow the prompts provided during the initial build, or (2) manually install the necessary packages using the SDK manager.

If the welcome screen is open, we can access the SDK manager by going to Configure and selecting SDK Manager. If a project is already open, we can instead go to Tools > Android > SDK Manager. Once the manager is open, select the Show Package Details checkbox in the lower right corner. Here are the packages that should be checked (there may be others checked as well, and that's okay):

Under the SDK Platforms tab:

Under the SDK Tools tab (you may need to check the Show Package Details checkbox again):

* These definitely need to be installed manually. The others may have been installed during the first time Android Studio launched.

FTC App Project

The folks at FIRST Tech Challenge host the code necessary for running robots on GitHub. If you're familiar with git and GitHub, feel free to clone down the project (ftctechnh/ftc_app) and checkout the v3.1_fixed tag.

Otherwise, it's easiest to simply download a ZIP file with the current version of the app, which can be found here: https://github.com/ftctechnh/ftc_app/archive/master.zip. Extract this archive somewhere safe, as it will ultimately hold your code from the course.

Importing the FTC App

Assuming you've already done the steps related to the first time Android Studio opens, we're ready to import the FTC App into Android Studio. If you see the Welcome to Android Studio screen, select Import project (Eclipse ADT, Gradle, etc.). Otherwise go to File > New > Import Project.... Look for the folder you just extracted (probably called ftc-app_master) and select it. Then, select OK to import it.

Android Studio will index the project and do an initial build. During this process, a number of items may pop up. If a message comes up about missing android-23, select the link that says Install missing platform(s) and sync project. Perform a similar action for missing build tools. Do not, however, update the version of Gradle associated with the project.

If the project continues to throw errors during the Gradle sync, return to SDK Manager as described in the Android Studio section above, and ensure all of the relevant packages have been installed. Contact me before the beginning of the course if you continue to have trouble.

Creating the NullOp

Next we're going to create a simple program that just displays how long it has been running. This isn't very interesting, but running it will ensure that our laptops and phones are set up correctly.

In Android Studio, open the FTC App project we previously imported and look at the left sidebar. Here you should find a directory structure (select the horizontal label 1: Project and ensure Android is selected in the adjacent dropdown). Expand the TeamCode and java items in that directory. Right click the label org.firstinspires.ftc.teamcode and select New > Java Class. Give the new class a name of NullOp (capitalization is important) and leave the remaining settings as they are. If Android Studio prompts you to add the new file to Git / version control, you can say No. Remove what's in the new file and copy in the following:

package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.util.ElapsedTime;
@Autonomous(name = "NullOp", group = "Testing")
public class NullOp extends OpMode {
    private ElapsedTime runtime = new ElapsedTime();
    public void init() {
        telemetry.addData("Status", "Initialized");
    /* This method will be called ONCE when start is pressed */
    public void start() {
    /* This method will be called repeatedly in a loop */
    public void loop() {
        telemetry.addData("Status", "Run Time: " + runtime.toString());

This is a basic program that simply prints out the elapsed time. Android Studio should automatically save the file as NullOp.java inside of the org.firstinspires.ftc.teamcode directory you selected.

Build and Download

The next step requires your Robot Controller phone. It's a good idea to go ahead and uninstall any old FTC Robot Controller apps you may have on the phone right now. Plug the phone into the laptop with the code and look for any popups that may appear on the phone screen. We may need to confirm that we want to allow the laptop to debug the phone. If you have not already, you may need to go to the phone's Settings app, under Connect to PC, and select Media device (MTP) and Enable USB debugging.

Now, in Android Studio, hit the green play button at the top of the screen (alternatively go to Run > Run 'TeamCode'). We should see a list that includes the connected phone; select it, and continue.

At this point, the code will be downloaded and run on the phone. When it is finished, the FTC Robot Controller app should open automatically. Now we're ready to update the Driver Station phone.

Update the Driver Station

Using the Google Play store app, ensure the FTC Driver Station app has been updated to the latest version. Otherwise, it will not be able to talk to the updated Robot Controller software.

Pair and Run NullOp

Ensure both phones (Driver Station and Robot Controller) are in competition-ready mode:

If the Driver Station phone says Network: [Team Number]-RC and the ping time is a fluctuating number, the phones are happily connected. If this is not the case, we need to go to the driver station app's menu (the three-dot button in the upper-right) and select Settings. Choose Connect with Robot Controller at the top, and find your robot controller phone in the list (disabling the filter if necessary). Select it, and go back twice to return to the main screen. The phones should be connected now. If they aren't, take a look at Section 2.3 of the Control System Troubleshooting Guide from last year, found at https://www.firstinspires.org/sites/default/files/uploads/resource_library/ftc/control-system-troubleshooting-guide.pdf.

Once the phones are connected, select NullOp from the left-hand dropdown menu on the Driver Station phone, and hit Init, and Run. If the program runs successfully and shows you the elapsed time counting up at the bottom, this set of laptop + phones is ready to go!

Code School Account

During this course, we'll be using some of Code School's technology to complete interactive challenges. In order to access them, you'll need to create a free account at https://www.codeschool.com/. (No need to enroll or pay any money.) Please create one account per person, so that we can track your progress individually. Once you've done so, please email: (1) your name, (2) your team name / number, and (3) the email you used to sign up, to first@aj-foster.com.

Need Help?

If you aren't able to make it through part of this homework, please contact me at first@aj-foster.com. Otherwise, we'll see you at 8:45am on June 10th at Code School in downtown Orlando.