Don't Blink LogoFTC Stack

Gamepads

Control your robot using driver input.

Gamepads allow drivers to control the robot.

FTC provides two gamepads:

gamepad1
gamepad2

Usually:

  • gamepad1 controls driving
  • gamepad2 controls mechanisms

Buttons

Buttons are boolean values.

Example:

if (gamepad1.a) {
    intake.start();
}

Triggers

Triggers return values from 0.0 to 1.0.

gamepad1.left_trigger
gamepad1.right_trigger

Example:

double speed = gamepad1.right_trigger;

Joysticks

Joysticks return values from -1.0 to 1.0.

gamepad1.left_stick_y
gamepad1.right_stick_x

Example:

double forward = gamepad1.left_stick_y;

Basic Drive Example

double drive = -gamepad1.left_stick_y;
double turn = gamepad1.right_stick_x;

leftMotor.setPower(drive + turn);
rightMotor.setPower(drive - turn);

Deadzones

Joysticks may not return exactly zero.

A deadzone ignores small values.

if (Math.abs(gamepad1.left_stick_y) < 0.1) {
    drive = 0;
}

This prevents unwanted movement.

Key Takeaways

  • gamepad1 and gamepad2 provide driver input.
  • Buttons are boolean values.
  • Triggers and joysticks return numbers.
  • Deadzones prevent joystick drift.
  • Most TeleOp programs are built around reading gamepads.

Was this resource helpful?

On this page

Was this resource helpful?