The FTC SDK, Programming Tools and Robot Configuration
Meet the FTC SDK and its three programming tools, then create a robot configuration on the Control Hub whose device names match your code exactly.
In this lesson you will
- Describe what the FTC SDK, the Robot Controller app and the Driver Station app each do.
- Compare Blocks, OnBot Java and Android Studio and choose a starting tool for your team.
- Create, save and activate a robot configuration on the Control Hub.
- Explain why every configuration name must exactly match the name used in
hardwareMap.get.
Lesson
The FTC SDK (Software Development Kit) is the official software from FIRST that every team builds on. It contains the Robot Controller app that runs on the Control Hub, the libraries for motors, servos and sensors, and many sample OpModes. Your programs, called OpModes, become part of the Robot Controller app. The Driver Station app runs on the Driver Hub or phone: it lets drivers pick an OpMode, start and stop it, sends gamepad input to the robot and shows messages from the robot.
Follow the path of one action. A driver pushes a joystick. The Driver Station reads the gamepad and sends the values over Wi-Fi. Your OpMode on the Control Hub reads gamepad1, calculates a power, and calls setPower. The Control Hub sends that power to a motor port, and the wheel turns. Messages you send with telemetry travel back the same way to the Driver Station screen. The 12 V battery powers everything on the robot through the main power switch.
Three ways to program
| Tool | Where you write code | Strengths | Trade-offs |
|---|---|---|---|
| Blocks | A web browser connected to the Control Hub | Drag-and-drop, no typing errors, quick to learn | Large programs become hard to read and organise |
| OnBot Java | A web browser; code is stored and compiled on the Control Hub | Real Java with nothing to install | Simple editor and no built-in version control |
| Android Studio | A full IDE on your computer, using the FtcRobotController project from GitHub | Autocomplete, Git, libraries, best for big projects | Needs installation and setup; you deploy code over USB or Wi-Fi |
To open Blocks or OnBot Java, connect your laptop to the Control Hub's Wi-Fi network and open the Robot Controller Console in a browser at 192.168.43.1:8080. A good path for a new team is to start in OnBot Java, because the code is exactly the Java you will later use in Android Studio. Blocks is a fine choice if your programmers have never typed code before: the ideas (variables, loops, hardwareMap, gamepad) are identical. This module shows Java.
Robot configuration: telling the hub what is plugged in
The Control Hub cannot see what kind of device is on each port or what you want to call it. A robot configuration is a saved list that says: 'on motor port 0 there is this type of motor, and its name is left_front'. Your code then asks for devices by those names. You can store several configurations, but only the active one is used.
- 1ConnectPower on the robot and make sure the Driver Station shows it is connected to the Control Hub.
- 2Open the menuOn the Driver Station, open the menu (three dots) and choose Configure Robot, then New.
- 3Select the hubChoose the Control Hub Portal, then the Control Hub (and the Expansion Hub, if you have one).
- 4Add motorsOpen Motors, choose the matching motor type for each used port, and type a name for each one.
- 5Add servos and sensorsOpen Servos and set the type (Servo or Continuous Rotation Servo) and a name. Add sensors on the I2C or digital ports the same way.
- 6Save and activatePress Done until asked to save, give the configuration a clear name, and make sure it is shown as the active configuration.
| Hub | Port | Device type | Name in code |
|---|---|---|---|
| Control Hub | Motor 0 | Your motor model (for example a goBILDA or REV HD Hex motor) | left_front |
| Control Hub | Motor 1 | Same model | left_back |
| Control Hub | Motor 2 | Same model | right_front |
| Control Hub | Motor 3 | Same model | right_back |
| Control Hub | Servo 0 | Servo | claw |
| Control Hub | I2C bus 0 | Built-in IMU (usually added automatically) | imu |
Hardware mapping: names must match exactly
In code, the hardwareMap object gives you devices from the active configuration. You tell it the device class and the configuration name. Java then gives you an object you can control. The name in quotes must match the configuration character for character, including capital letters, underscores and spaces.
1// Inside runOpMode(), before waitForStart()
2DcMotor leftFront = hardwareMap.get(DcMotor.class, "left_front");
3DcMotor rightFront = hardwareMap.get(DcMotor.class, "right_front");
4Servo claw = hardwareMap.get(Servo.class, "claw");
5
6// Needed imports at the top of the file:
7// import com.qualcomm.robotcore.hardware.DcMotor;
8// import com.qualcomm.robotcore.hardware.Servo;
- Use short, lowercase names with underscores, such as
left_frontorarm_motor. - Describe position or job, not the port number, so the name still makes sense if you move a cable.
- Put a label on each cable and port so the wiring matches the configuration.
- Write the full configuration table in your engineering portfolio and on the team whiteboard.
Key terms
- FTC SDK
- The official software kit from FIRST containing the Robot Controller app, hardware libraries and sample OpModes that teams build on.
- OpMode
- A program you write that the drivers can select and run from the Driver Station, either TeleOp or Autonomous.
- Robot configuration
- A saved list on the Control Hub that gives each port a device type and a name.
- hardwareMap
- The SDK object that returns devices from the active configuration when you ask for them by class and name.
- Robot Controller Console
- The web page served by the Control Hub where you write Blocks and OnBot Java programs and manage files.
Practical exercise
Configure your robot
- 1Update the Control Hub and Driver Station with the REV Hardware Client and confirm the app versions match.
- 2Draw a table of every motor and servo on your robot with its hub, port and a planned name.
- 3Create a new configuration on the Driver Station using exactly those names, then save and activate it.
- 4Open the Robot Controller Console at
192.168.43.1:8080and create a new OnBot Java (or Blocks) OpMode file. - 5Write the
hardwareMap.getlines for every device and build the code with no errors.
hardwareMap.get line per device.Knowledge check
Answer every question, then check your answers.
Further resources
- FTC Docs: control system and programmingOfficial guides for configuring the robot and each programming toolftc-docs.firstinspires.org
- REV Robotics documentationControl Hub, Driver Hub and REV Hardware Client guidesdocs.revrobotics.com
- FtcRobotController on GitHubOfficial SDK project used with Android Studiogithub.com