Welcome to the first lesson in the FTC Programming series! Here we will cover the following material:
- Where to find the SDK
- Basic SDK functions to control your robot
SDK installation and Android Studio
First things first: The SDK (Software Development Kit) is on GitHub, and we recommend using GitHub to keep track of your repository (master directory where the whole project is stored) changes and who made what change.
To use the repository, first you have to download Android Studio from here, and install it.
Once Android studio is installed, then you can download a zip archive of the FTC SDK to your local hard disk using this button:
It will take about a minute due to the size being ~100MB.
Once it is downloaded, unzip it, and open Android Studio.
In Android Studio, click “Open Project”:
Or from the File menu:
And select your repository home, the folder that says FtcRobotController.
Once that happens, you will be able to see a new window that loads it, and you need to click “Trust Project”.
It will start automatically afterward “Syncing Gradle”, which is its way of ensuring itself that it has all necessary packages. Note that you must be connected to the Internet for this to work.
If all goes well you should see the following:
The sidebar on the left shows the “Android” hierarchy, which shows all programming files we want to modify. Our target files will be in the directory where
readme.md is located, which is under
A common error that occurs is the SDK license not being approved, which you can fix by clicking Tools > SDK Manager in the menu bar:
Then you need to select SDK version 29, and optionally deselect the selected one (should be 31):
Click Apply. It will request you to accept a license agreement, which you must do. Then it will download and unzip the correct SDK, after which you can click complete, and you will be all set from a configuration point of view!
Gradle and how to use it
Gradle is a compiler tool for Android, and it tells Android Studio how to compile and what resources to include for compilation and/or execution for the binary for the project.
There are nine total grade files, 4-5 of which are actually useful to modify.
The last 4 (
local.properties) are the ones which we should not modify, as they define core parameters like software versioning, SDK location, etc. We do not need to change any of this, and even if we did, the IDE (Android Studio) would ask us for permission to do it itself.
The first 5 however, are useful. Packages and Extensions to FTC, such as Roadrunner, ftc265, Dashboard, and EasyOpenCV are added through some lines in some of these files. Each package has specific installation instructions, which we will cover in detail in their respective articles.
A tree of the SDK looks like this:
All files you will need to modify for programming the robot will be in the OpModes section. They will either be OpModes or helper classes or enums, covered in the next section.
© The RoboMentors (Marc and Anne-Sarah)