← Back to Resources

Basic FTC Robot Programming

Master the fundamentals of FTC programming with comprehensive guides on TeleOp and Autonomous modes.

TeleOp Programming

TeleOp (short for Tele-Operated) is the part of an FTC match where drivers control the robot in real time using gamepads. This period usually lasts 2 minutes, and your code must respond instantly to driver input while safely controlling motors, servos, and mechanisms.

This guide walks you through how TeleOp works and how to write a simple, reliable TeleOp program.

What TeleOp Code Does

During TeleOp, your robot:

  • Reads input from gamepads
  • Converts that input into motor and servo movement
  • Continuously updates while the match is running

Unlike Autonomous, TeleOp code runs in a loop and reacts to driver actions every frame.

Step 1: Understanding a TeleOp OpMode

FTC TeleOp programs use a class called an OpMode.

There are two main types:

  • Iterative OpMode (simpler for beginners)
  • LinearOpMode (more common and flexible)

Most teams use LinearOpMode, so we'll focus on that.

A basic TeleOp OpMode looks like this:

Java
@TeleOp(name = "Basic TeleOp")
public class BasicTeleOp extends LinearOpMode {

    @Override
    public void runOpMode() {
        // Initialization code goes here

        waitForStart();

        while (opModeIsActive()) {
            // Driver control code goes here
        }
    }
}

Step 2: Hardware Mapping

Before you can control anything, you must connect your code to the robot hardware.

Example code for basic hardware mapping:

Java
DcMotor leftMotor;
DcMotor rightMotor;
Servo armServo;

@Override
public void runOpMode() {
    // Map hardware to code variables
    leftMotor = hardwareMap.get(DcMotor.class, "left_motor");
    rightMotor = hardwareMap.get(DcMotor.class, "right_motor");
    armServo = hardwareMap.get(Servo.class, "arm_servo");

    waitForStart();

    while (opModeIsActive()) {
        // Control code here
    }
}
⚠️ Important Tips:
  • The names must match exactly what you set in the Robot Configuration
  • Hardware mapping happens before waitForStart()

Step 3: Reading Gamepad Input

FTC gamepads give you access to:

  • Joysticks
  • Buttons
  • Triggers
  • D-pad

Example joystick input:

Java
double forward = -gamepad1.left_stick_y;
double turn = gamepad1.right_stick_x;

Why the negative sign?

  • Pushing the joystick forward returns a negative value

Step 4: Using Buttons for Mechanisms

Buttons are commonly used for:

  • Intakes
  • Slides
  • Arms
  • Claws

Example:

Java
if (gamepad1.a) {
    intakeMotor.setPower(1.0);
} else if (gamepad1.b) {
    intakeMotor.setPower(-1.0);
} else {
    intakeMotor.setPower(0);
}

This ensures:

  • The motor only moves when a button is pressed
  • The motor stops when no input is given

Step 5: Controlling Servos

Servos move to a position between 0.0 and 1.0.

Example:

Java
if (gamepad1.right_bumper) {
    clawServo.setPosition(1.0); // open
}

if (gamepad1.left_bumper) {
    clawServo.setPosition(0.0); // close
}

Step 6: The TeleOp Loop (Very Important)

Everything inside:

Java
while (opModeIsActive()) {
    // Code here
}

runs repeatedly during the match.

Rules of the loop:

  • Do NOT use sleep() inside TeleOp
  • Keep logic fast and responsive
  • Always update motor powers every loop

Step 7: Telemetry (Debugging for Drivers)

Telemetry sends information to the Driver Station.

Example:

Java
telemetry.addData("Left Power", leftDrive.getPower());
telemetry.addData("Right Power", rightDrive.getPower());
telemetry.update();

Use telemetry to:

  • Debug issues
  • Show sensor values
  • Help drivers understand robot state

Common Beginner Mistakes

  • Forgetting waitForStart()
  • Using sleep() inside the TeleOp loop
  • Not stopping motors when buttons are released
  • Hardware names not matching the configuration

What to Learn Next

Once you have a basic TeleOp working, consider learning:

  • Motor direction and braking modes
  • Encoders for precise movement
  • Subsystems and command-based structure
  • Driver control smoothing

Autonomous Programming

Program your robot to complete tasks autonomously without driver input. Explore path planning, sensor feedback, and movement strategies.

Content coming soon...