WestlakeLEARN
FTC · Java

FIRST Tech Challenge

FTC · Java

  • Driver Control
  • Field-Centric Driving
  • Driver Ergonomics and Safe TeleOp
  • Write a Full Command-Based TeleOp

Field-Centric Driving

Rotate driver input using IMU heading.

Module 5: TeleOp and Driver ControlIntermediate

In this lesson, you will:

  1. 01Explain robot-centric vs field-centric.
  2. 02Reset heading intentionally.
  3. 03Diagnose heading sign errors.

Concept narrative

Field-centric drive changes the driver’s frame of reference. Instead of forward meaning the robot’s front, forward means the chosen field direction after heading reset.

This lesson should be read as a robotics lesson first and a programming lesson second. The code matters because it lets the team create repeatable behavior under match pressure. Students should slow down long enough to name the inputs, outputs, assumptions, and safety limits before they touch the robot.

Robot mental model

The code rotates the joystick vector by negative robot heading before feeding it into mecanum math. The driver experiences a robot that moves relative to the field even when it is turned around.

A good mental model gives the team a shared language. When a driver, builder, and programmer can point to the same behavior and use the same words, debugging gets calmer and code review becomes useful instead of personal.

Implementation walkthrough

Choose a field zero, reset yaw, read heading in radians, rotate x/y, then use the normal mecanum formula. Test at 0, 90, 180, and 270 degrees.

Keep the implementation staged. First create the smallest version that compiles. Then add telemetry that proves it is running. Then connect one hardware device or one decision. Finally, repeat the test from a cold init so the team knows it was not a lucky hot reload.

FieldCentric.javaJava

if (gamepad1.options) imu.resetYaw();
double heading = imu.getRobotYawPitchRollAngles().getYaw(AngleUnit.RADIANS);
double rotX = x * Math.cos(-heading) - y * Math.sin(-heading);
double rotY = x * Math.sin(-heading) + y * Math.cos(-heading);

Common mistakes and debugging

If controls feel rotated, check reset procedure, heading units, heading sign, and hub orientation. Do not tune strafe constants to fix a coordinate-frame bug.

Use the five-value debugging habit: input, state, target, measurement, output. If one of those values is missing, add it before rewriting logic. The goal is to make the robot tell the truth about what it thinks is happening.

Practice

Implement a heading reset button and run the same forward-stick test at four robot orientations.

Checkpoint

  • Reset direction is documented.
  • Forward stick is field-consistent.
  • Heading telemetry is visible.

Reflection check

Check your understanding before moving on.

What is the most important habit in Field-Centric Driving?

0 of 1 answered

References

FIRST FTC DocsOfficial SDK, Robot Controller, and programming reference.Learn Java for FTCFTC-focused Java book and exercises by Alan G. Smith.Game Manual 0FTC community reference for programming, controls, and robot design.

Finished reading?

Mark this lesson complete — “Driver Ergonomics and Safe TeleOp” is up next.

Driver ControlDriver Ergonomics and Safe TeleOp