WestlakeLEARN
FTC / Java

First Tech Challenge

FTC / Java

01 · Java for FTC
  • OpMode Anatomy and Hello Robot
  • Variables, Math, and Decisions
  • Methods, Classes, and Robot Helpers
02 · FTC Hardware Essentials
  • Hardware Map and RobotHardware
  • Motors, Servos, and Sensors
  • IMU, Encoders, and Bulk Caching
03 · TeleOp and Mecanum1/3
  • Robot-Centric Mecanum Drive
  • Field-Centric Driving
  • Driver Ergonomics and Safe TeleOp
04 · Subsystems and Commands
  • Subsystem Lifecycle
  • Enums and Finite State Machines
  • Command-Based OpModes
05 · From Timed Steps to Actions
  • Timed and Encoder Autonomous
  • Autonomous State Machines
  • Actions and Sequencing
06 · PID and Feedforward
  • PID Basics
  • Feedforward and PIDF
  • Dashboard Tuning Workflow
07 · Motion Profiling
  • Motion Profile Concepts
  • Implementing a Profiled Mechanism
  • Testing Profiles and Failure Modes
08 · OpenCV and AprilTags
  • VisionPortal Camera Setup
  • OpenCV Color and Region Processors
  • AprilTags and Field Pose
09 · Setup and Tuning
  • Road Runner 1.0 Install and Drive Class
  • Feedforward Tuning
  • Localization and Validation
10 · Trajectories, Actions, and MeepMeep
  • Action Builder and Trajectories
  • MeepMeep Preview
  • Full Road Runner Autonomous
11 · Git, Debugging, and Competition Readiness
  • Git Workflow for FTC Teams
  • Telemetry-First Debugging
  • Competition Readiness Checklist
12 · Driver Control
  • Driver Control
13 · Autonomous Build
  • Simple Autonomous
14 · Debugging
  • Debugging with Telemetry

03 / TeleOp and Mecanum

Robot-Centric Mecanum Drive

Convert gamepad drive, strafe, and turn into four motor powers.

60 minCoreTeleOp and Mecanum

You will

  1. 01Read gamepad axes consistently.
  2. 02Calculate mecanum wheel powers.
  3. 03Normalize powers while preserving direction ratios.

Why Robot-Centric Mecanum Drive matters

This lesson is about the interface between drivers and robot behavior. Good TeleOp code is not just mathematically correct; it is predictable under pressure, easy to recover, and readable enough that the drive team can describe what the robot is supposed to do.

Starting point

Mecanum drive combines three motions

A mecanum drivetrain can drive forward/back, strafe left/right, and rotate. The formulas are simple, but axis signs and motor directions must be tested deliberately.

Normalize after mixing

Combining drive, strafe, and turn can produce values larger than 1.0. Dividing all powers by the same denominator keeps the robot's intended direction while staying in the legal output range.

Build path

Test driver code in movement primitives and mechanism primitives instead of full-match chaos. Add deadbands, slow modes, edge detection, and safe states only after students can explain the raw input and final output for each control.

For this specific lesson, students should first restate the goal in robot terms, then identify the value or behavior they expect to observe, then run the smallest test that proves the idea. The lesson should feel like a guided lab: predict, run, observe, explain, and only then extend.

MecanumDrive.java · Java

double y = -gamepad1.left_stick_y;
double x = gamepad1.left_stick_x * 1.1;
double rx = gamepad1.right_stick_x;

double denominator = Math.max(Math.abs(y) + Math.abs(x) + Math.abs(rx), 1.0);
double frontLeftPower = (y + x + rx) / denominator;
double backLeftPower = (y - x + rx) / denominator;
double frontRightPower = (y - x - rx) / denominator;
double backRightPower = (y + x - rx) / denominator;

robot.frontLeft.setPower(frontLeftPower);
robot.backLeft.setPower(backLeftPower);
robot.frontRight.setPower(frontRightPower);
robot.backRight.setPower(backRightPower);

Debugging and failure modes

When TeleOp feels wrong, translate driver feedback into small tests: forward, strafe, rotate, precision mode, button press, held button, and safe recovery. Print raw inputs and final commands so the team can separate driver feel from wiring, math, and mechanism bugs.

Practice

Test forward, backward, strafe, rotate, and diagonals one at a time. Fix motor direction before changing formulas.

Checks

  • Forward stick moves the robot forward.
  • Strafe does not create heavy unwanted rotation.
  • The highest absolute motor power is never above 1.0.

Check your understanding

Module check

What does mecanum power normalization preserve?

0 of 1 answered

References

FIRST FTC DocsOfficial FTC SDK and robot programming documentation.Game Manual 0Community FTC programming, control, and robot design reference.Learn Java for FTCFTC-focused Java fundamentals by Alan G. Smith.

Finished reading?

Mark this lesson complete.

You'll move on to “Field-Centric Driving” next.

IMU, Encoders, and Bulk CachingField-Centric Driving