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 Mecanum
  • 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 AprilTags3/3
  • 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

08 / OpenCV and AprilTags

AprilTags and Field Pose

Use AprilTag detections, metadata, and estimated pose to align and localize.

80 minVisionOpenCV and AprilTags

You will

  1. 01Read AprilTag id, metadata, range, bearing, and pose data.
  2. 02Use known field tags for alignment decisions.
  3. 03Understand the difference between detection and localization.

Why AprilTags and Field Pose matters

This lesson is about turning camera images into trustworthy robot decisions. The goal is not to make vision seem magical; it is to show how camera setup, processor output, telemetry, and fallbacks make an autonomous decision safe enough to use.

Starting point

AprilTags are known field landmarks

FIRST field tags have known positions. A detection gives the robot information about a visible landmark, which can support alignment, scoring, or pose correction when used carefully.

Metadata matters

A tag id is useful only when the program knows what that id represents. Metadata connects detections to the field layout and prevents code from treating every tag the same.

Build path

Start with a visible stream and raw telemetry before making decisions. Then add regions, detections, metadata, or pose estimates. Autonomous should receive a simple result and confidence, not a pile of image-processing details.

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.

AprilTagTelemetry.java · Java

for (AprilTagDetection detection : aprilTags.getDetections()) {
    if (detection.metadata == null) continue;

    telemetry.addData("Tag", detection.id);
    telemetry.addData("Name", detection.metadata.name);
    telemetry.addData("Range", detection.ftcPose.range);
    telemetry.addData("Bearing", detection.ftcPose.bearing);
    telemetry.addData("Yaw", detection.ftcPose.yaw);
}

Debugging and failure modes

Vision fails through lighting, camera placement, exposure, cable issues, wrong tag assumptions, and thresholds that only worked in the shop. The debugging habit is to show the image, print raw scores or detections, and define a safe fallback when the robot is not confident.

Practice

Detect a known field tag and write telemetry that a driver could use to align: id, name, range, bearing, and yaw.

Checks

  • Unknown tags are handled safely.
  • Telemetry uses meaningful labels.
  • Alignment logic uses tag id or metadata intentionally.

Check your understanding

Module check

Why check AprilTag metadata before using a detection?

0 of 1 answered

References

FTC VisionPortal DocsOfficial VisionPortal overview and examples.FIRST FTC DocsOfficial FTC SDK and robot programming documentation.Game Manual 0Community FTC programming, control, and robot design reference.

Finished reading?

Mark this lesson complete.

You'll move on to “Road Runner 1.0 Install and Drive Class” next.

OpenCV Color and Region ProcessorsRoad Runner 1.0 Install and Drive Class