All pages
Powered by GitBook
1 of 1

Loading...

AprilTag Guide

Introduction

AprilTags are coded images similar to barcodes or QR codes. Using a webcam, robots can determine where they are in relation to the image by looking at the size and shape of the AprilTag.

Teams that want to use AprilTags to navigate the playing field should begin by printing PDF AprilTag images. Then, use the provided sample program to test the webcam and printed images. Finally, build off this program to make it your own!

Possible benefits include:

  • Allows teams to track robot translation (forward, right, left) and rotation (roll, yaw, pitch)

  • Knowing the location of the robot relevant to a goal can help teams release scoring elements more consistently

  • Drive team visibility of certain parts of the field may be limited

2026 FIRST Global Challenge

The 2026 FIRST Global Challenge — Igniting Innovation Robotics Challenge uses five AprilTags, labeled 100–104, located on the front and sides of each SUPPRESSION UNIT, and on the front face of the EXTINGUISHER.

Depending on where a robot is located on the playing field, multiple AprilTag images may be visible at the same time. Robots may use these AprilTags to assist in navigating around the field.

Igniting Innovation Robotics Challenge AprilTag Locations

The following resources are required to use AprilTags:

  • Printed PDF files with the AprilTag images used on the playing field

  • Sample program for detecting and using AprilTags with Blocks or OnBot Java programming

  • Tag library (.jar file) containing information about the AprilTags used on the field

AprilTag Image Files

AprilTags for the 2026 FIRST Global Challenge – Igniting Innovation Robotics Challenge can be downloaded using the buttons below

AprilTag Printable Files - A4AprilTag Printable Files - Letter Size (8.5 x 11 in)

AprilTag Library and Samples

The Igniting Innovation Robotics Challenge AprilTag library files, and Blocks and Java samples are available for download using the buttons below.

You will need to upload the IgnitingInnovationAprilTagLibrary-1.0.jar file to OnBot Java before the Blocks or Java samples will work.

2026 AprilTag Library File (.jar)

2026 AprilTag Code Samples - Blocks2026 AprilTag Code Samples - Java

Printing the AprilTags

Print the PDF AprilTag files, making sure to print at the original size (100% scaling) and not “fit to page” or a different scaling percentage.

A PDF viewer is required to view and print the tags. PDF files are provided above in two sizes:

  • US and Canada printers (Letter 8.5 in x 11 in)

  • International (A4)

Here are examples of the correct print settings in Windows (left) and macOS (right):

Important: AprilTag images must be printed at the correct size. If the image prints at the wrong size, the AprilTag will report the wrong distance.

After printing, check that the size of the marker (which includes the thin black border surrounding the black blocks) matches the size written at the bottom of the page (the thickness of the lines is included in the measurement). At close range, the distances reported by AprilTags should be accurate to within a few millimeters.

Setting Up the Webcam

Plug in the Webcam

The 2026 FIRST Global REV Robotics Kit of Parts includes a Logitech C270 webcam for teams to use in the Igniting Innovation Robotics Challenge. To use the webcam, plug in the USB cable to one of the available USB ports on the Control Hub. The Logitech C270 is a USB 2.0 device, so it will work on either of the Control Hub's USB Ports.

It is a best practice to plug the webcam into the blue USB 3.0 Port to prevent

USB Ports on the Control Hub

Configure the Camera

Once the webcam is plugged in, it must be added to the robot configuration. For detailed information about creating or modifying a robot configuration, refer to the following documentation linked here:

An outline of the process is included below.

1

Power on the Control Hub and Driver Hub.

2

Ensure the webcam is plugged into the Control Hub.

3

Open the Driver Station application on the Driver Hub.

4

Using the menu in the top-right, tap Configure Robot.

5

Choose to Create a Configuration file.

It’s recommended when adding a camera to your robot to create a new configuration file. Tap New in the top-left corner to create a new Configuration.

If you wish to use an existing configuration file, tap Edit.

6

Tap Scan to look for new hardware if the webcam does not automatically populate.

If the webcam is plugged in correctly, it should appear as Webcam 1.

Note: The sample program and code assume that the webcam is named Webcam 1. If necessary, tap and rename the webcam.

Tapping Scan on an existing configuration may erase all existing configured hardware.

7

Add any other needed hardware to the configuration within the Control Hub Port.

8

Tap Save and provide a name for the configuration file.

Uploading the Tag Library

Detecting AprilTags in Blocks and OnBot Java requires uploading the correct library. If the AprilTag library is not present, a build error will occur when using the provided sample program. Follow this process to upload the AprilTag Library for programming in either language.

1

Download the Igniting Innovation Robotics Challenge AprilTag Library.

Save the .jar file on your computer and ensure it is named IgnitingInnovationAprilTagLibrary-1.0.jar

2

Open OnBot Java in the Robot Controller Console and select Upload Files.

You can do this step using the REV Hardware Client or a web browser.

3

Select the AprilTag Library to upload

Selecting the AprilTag Library in Windows (Left) and macOS (Right)

4

Check that the Library has been uploaded to your Control Hub.

If the upload is successful, the AprilTag library will appear in a folder called ExternalLibraries.

Programming AprilTags with Blocks and OnBot Java

Sample programs are available to provide an introduction to AprilTag programming. Teams may use portions of this code in their own programs.

Programming AprilTags with BlocksProgramming AprilTags with OnBot Java

Programming AprilTags with Blocks

Blocks is a visual programming language available on the Control Hub. For more information about the programming options available, see the from REV.

Uploading the Sample Blocks Program

The sample Blocks program (.blk file) detects all five AprilTag images and reports the webcam’s location relative to the image. Location is reported in three ways:

  • XYZ: Right, forward, and up distance (in centimeters) from the tag

  • PRY: Pitch, roll, and yaw (in degrees) relative to the tag

  • RBE: Range (in centimeters), bearing, and elevation (in degrees) relative to the tag

Before you begin, download the Igniting Innovation Robotics Challenge Blocks sample program using the button below:

2026 AprilTag Code Samples - Blocks

1

Activate a configuration for your robot that includes a camera named Webcam 1.

The sample program expects the robot configuration to include a webcam called Webcam, if your configuration does not include a webcam or it has a different name it will not work.

See the "Setting up the Webcam" section of the FGC AprilTag Guide for help creating a configuration.

2

Ensure the sample file is saved as IgnitingInnovationAprilTagBlocksSample.blk.

3

Open the Blocks programming interface and select Upload OpMode.

This can be done using a web browser or the REV Hardware Client.

4

Select the sample program IgnitingInnovationAprilTagBlocksSample.blk to upload.

5

Save the OpMode after it opens.

Running the Sample Blocks Program

The sample program is now available to run on the Driver Hub. Select IgnitingInnovationAprilTagBlocksSample from the second drop-down menu, and tap INIT.

Tap the play button to run the program. You can now hold the webcam in front of an AprilTag and read the information provided on the Driver Hub display. The sample program will list which AprilTag is visible and calculate the webcam’s location relative to the image.

Programming AprilTags with Blocks

OnBot Java is a text-based programming tool available on the Control Hub. For more information about the available programming options, see the from REV.

Uploading the Sample OnBot Java Program

The sample OnBot Java program (.java file) detects all five AprilTag images and reports the webcam’s location relative to the image. Location is reported in three ways:

  • XYZ: Right, forward, and up distance (in centimeters) from the tag

  • PRY: Pitch, roll, and yaw (in degrees) relative to the tag

  • RBE: Range (in centimeters), bearing, and elevation (in degrees) relative to the tag

Before you begin, download the Igniting Innovation Robotics Challenge Blocks sample program using the button below:

2026 AprilTag Code Samples - Java

1

Activate a configuration for your robot that includes a camera named Webcam 1.

The sample program expects the robot configuration to include a webcam called Webcam, if your configuration does not include a webcam or it has a different name it will not work.

See the "Setting up the Webcam" section of the FGC AprilTag Guide for help creating a configuration.

2

Ensure the sample file is saved as IgnitingInnovationAprilTagSample.java.

3

Open the OnBot Java programming interface and select Upload files.

This can be done using a web browser or the REV Hardware Client.

4
5

If the upload is successful, the sample program will appear in a folder called com.firstinspires.ftc.teamcode. You can select the file and click the build icon to build the sample program. The build was successful if the message Build SUCCESSFUL! appears in the bottom console.

Running the Sample OnBot Java Program

The sample program is now available to run on the Driver Hub. Select EcoEquilibriumAprilTag sample from the second drop-down menu, and tap INIT.

Tap the play button to run the program. You can now hold the webcam in front of an AprilTag and read the information provided on the Driver Hub display. The sample program will list which AprilTag is visible and calculate the webcam’s location relative to the image.

Additional Information

  • The Logitech C270 webcam is calibrated at a resolution of 640x480. Although the resolution of the webcam can be set higher, this will disrupt the distance calculations performed by the AprilTag software. It is recommended that teams do not change the resolution in their code.

Select the sample program IgnitingInnovationAprilTagSample.java to upload.

Verify the upload and build the code.

Note: If the build was not successful, ensure the AprilTag library appears in the ExternalLibraries folder.

Blocks Configuration Tutorial
OnBotJava Configuration Tutorial
ESD issues involving your robot's camera.
Hello Robot Intro to Programming Tutorial
Hello Robot Intro to Programming Tutorial