> For the complete documentation index, see [llms.txt](https://docs.revrobotics.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.revrobotics.com/first-global/apriltags-fgc.md).

# 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.&#x20;

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.

<figure><img src="/files/1KoxHHdhEwMh8X93X8Xh" alt=""><figcaption><p>Igniting Innovation Robotics Challenge AprilTag Locations</p></figcaption></figure>

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

<p align="center"><a href="https://revrobotics.com/content/technical-resources/FIRST_Global/A4-AprilTags-IgnitingInnovation26.zip" class="button primary" data-icon="download">AprilTag Printable Files - A4</a><a href="https://revrobotics.com/content/technical-resources/FIRST_Global/Letter-AprilTags-IgnitingInnovation26.zip" class="button primary" data-icon="download">AprilTag Printable Files - Letter Size (8.5 x 11 in)</a></p>

### 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.&#x20;

{% hint style="warning" %}
You will need to upload the IgnitingInnovationAprilTagLibrary-1.0.jar file to OnBot Java before the Blocks or Java samples will work.
{% endhint %}

<p align="center"><a href="https://revrobotics.com/content/technical-resources/FIRST_Global/IgnitingInnovationAprilTagLibrary-1.0.jar" class="button primary" data-icon="download">2026 AprilTag Library File (.jar)</a></p>

<p align="center"><a href="https://revrobotics.com/content/technical-resources/FIRST_Global/IgnitingInnovationAprilTagBlocksSample.blk" class="button primary" data-icon="download">2026 AprilTag Code Samples - Blocks</a><a href="https://revrobotics.com/content/technical-resources/FIRST_Global/IgnitingInnovationAprilTagSample.java" class="button primary" data-icon="download">2026 AprilTag Code Samples - Java</a></p>

## 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.&#x20;

A PDF viewer is required to view and print the tags. [PDF files are provided above in two sizes:](#apriltag-image-files)&#x20;

* US and Canada printers (Letter 8.5 in x 11 in)&#x20;
* International (A4)

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

<div><figure><img src="/files/b4btID68ymRrfE1FSZA4" alt=""><figcaption></figcaption></figure> <figure><img src="/files/B7N9lndRpIp25Ln2tZ6M" alt=""><figcaption></figcaption></figure></div>

{% hint style="danger" %}
**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.&#x20;
{% endhint %}

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.

<figure><img src="/files/gd9EuSoC1upNvG5RaL6o" alt=""><figcaption></figcaption></figure>

## Setting Up the Webcam&#x20;

### 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.

{% hint style="success" %}
It is a best practice to plug the webcam into the blue USB 3.0 Port to prevent [ESD issues involving your robot's camera.](/duo-control/troubleshooting-the-control-system/troubleshooting-the-control-system.md#esd-mitigation-techniques)
{% endhint %}

<figure><img src="/files/SwcSKB3zh3CT2r7U7AS1" alt=""><figcaption><p>USB Ports on the Control Hub</p></figcaption></figure>

### 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:

<p align="center"><a href="/spaces/UOOiQ4S2QcMWmVoSmeQ8/pages/-MJhSpWDdVL6coLFLgIi" class="button primary">Blocks Configuration Tutorial</a>  <a href="/spaces/UOOiQ4S2QcMWmVoSmeQ8/pages/kqE2ImKic4K9iNCHZ8Uo" class="button primary">OnBotJava Configuration Tutorial</a></p>

An outline of the process is included below.

{% stepper %}
{% step %}

#### Power on the Control Hub and Driver Hub.

{% endstep %}

{% step %}

#### Ensure the webcam is plugged into the Control Hub.

{% endstep %}

{% step %}

#### Open the Driver Station application on the Driver Hub.

{% endstep %}

{% step %}

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

<figure><img src="/files/UOXTSKx1cjUZftOGFk1w" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### 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.&#x20;

<figure><img src="/files/Xgw2Eexn4AWQzcIaiAh5" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If you wish to use an existing configuration file, tap Edit.
{% endhint %}
{% endstep %}

{% step %}

#### Tap Scan to look for new hardware if the webcam does not automatically populate.&#x20;

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

<figure><img src="/files/BFVQzqKrlyJKcmHIQ0Jm" alt=""><figcaption></figcaption></figure>

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

{% hint style="danger" %}
Tapping Scan on an existing configuration may erase all existing configured hardware.&#x20;
{% endhint %}
{% endstep %}

{% step %}

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

{% endstep %}

{% step %}

#### Tap Save and provide a name for the configuration file.

{% endstep %}
{% endstepper %}

## Uploading the Tag Library

{% hint style="success" %}
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.&#x20;
{% endhint %}

{% stepper %}
{% step %}

#### Download the [Igniting Innovation Robotics Challenge AprilTag Library](#apriltag-library-and-samples).

Save the .jar file on your computer and ensure it is named *<mark style="color:$primary;">**IgnitingInnovationAprilTagLibrary-1.0.jar**</mark>*
{% endstep %}

{% step %}

#### 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.&#x20;

<figure><img src="/files/2S59EG6lkbqDhWEUzzMN" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Select the AprilTag Library to upload

<div><figure><img src="/files/YXQZTQyDgUEauYkqoDoL" alt=""><figcaption></figcaption></figure> <figure><img src="/files/BSqFUrjBL56S5UApY68s" alt=""><figcaption></figcaption></figure></div>

Selecting the AprilTag Library in Windows (Left) and macOS (Right)
{% endstep %}

{% step %}

#### Check that the Library has been uploaded to your Control Hub.&#x20;

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

<figure><img src="/files/8rKw3uy4sF75JhKlfafp" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

## 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.&#x20;

<p align="center"><a href="/pages/9mI33UoY1wadWq7J4vBQ#blocks" class="button primary">Programming AprilTags with Blocks</a><a href="/pages/9mI33UoY1wadWq7J4vBQ#onbot-java" class="button primary">Programming AprilTags with OnBot Java</a></p>

{% tabs %}
{% tab title="Blocks" %}

## Programming AprilTags with Blocks

{% hint style="success" %}
Blocks is a visual programming language available on the Control Hub. For more information about the programming options available, see the [Hello Robot Intro to Programming Tutorial](/duo-control/hello-robot-blocks/welcome.md) from REV.
{% endhint %}

## 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:&#x20;

* 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:

<p align="center"><a href="https://revrobotics.com/content/technical-resources/FIRST_Global/IgnitingInnovationAprilTagBlocksSample.blk" class="button primary" data-icon="download">2026 AprilTag Code Samples - Blocks</a></p>

{% stepper %}
{% step %}

#### 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.&#x20;

See the ["Setting up the Webcam" section](/first-global/apriltags-fgc.md#setting-up-the-webcam) of the FGC AprilTag Guide for help creating a configuration.&#x20;
{% endstep %}

{% step %}

#### Ensure the sample file is saved as IgnitingInnovationAprilTagBlocksSample.blk.

{% endstep %}

{% step %}

#### Open the Blocks programming interface and select Upload OpMode.

<figure><img src="/files/rTZkadGDdiG4UKeGY6Ch" alt=""><figcaption></figcaption></figure>

This can be done using a web browser or the REV Hardware Client.
{% endstep %}

{% step %}

#### Select the sample program IgnitingInnovationAprilTagBlocksSample.blk to upload.

<div><figure><img src="/files/EF5WorJENIyRcmfdPQnV" alt=""><figcaption></figcaption></figure> <figure><img src="/files/LHEc18qoXGTgH8dPLzYf" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Save the OpMode after it opens.

{% endstep %}
{% endstepper %}

## Running the Sample Blocks Program

The sample program is now available to run on the Driver Hub. Select <mark style="color:$primary;">**IgnitingInnovationAprilTagBlocksSample**</mark> from the second drop-down menu, and tap INIT.

<figure><img src="/files/k0Wo5bfHiqWRGMm40yDG" alt=""><figcaption></figcaption></figure>

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.
{% endtab %}

{% tab title="OnBot Java" %}

## Programming AprilTags with Blocks

{% hint style="success" %}
OnBot Java is a text-based programming tool available on the Control Hub. For more information about the available programming options, see the [Hello Robot Intro to Programming Tutorial](/duo-control/hello-robot-java/welcome.md) from REV.
{% endhint %}

## 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:&#x20;

* 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:

<p align="center"><a href="https://revrobotics.com/content/technical-resources/FIRST_Global/IgnitingInnovationAprilTagSample.java" class="button primary" data-icon="download">2026 AprilTag Code Samples - Java</a></p>

{% stepper %}
{% step %}

#### 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.&#x20;

See the ["Setting up the Webcam" section](/first-global/apriltags-fgc.md#setting-up-the-webcam) of the FGC AprilTag Guide for help creating a configuration.&#x20;
{% endstep %}

{% step %}

#### Ensure the sample file is saved as IgnitingInnovationAprilTagSample.java.

{% endstep %}

{% step %}

#### Open the OnBot Java programming interface and select Upload files.

<figure><img src="/files/2S59EG6lkbqDhWEUzzMN" alt=""><figcaption></figcaption></figure>

This can be done using a web browser or the REV Hardware Client.
{% endstep %}

{% step %}

#### Select the sample program IgnitingInnovationAprilTagSample.java to upload.

<div><figure><img src="/files/698wwF3U2ra0ttsJIq3E" alt=""><figcaption></figcaption></figure> <figure><img src="/files/PNZFBL580kh8Xjh5Aqps" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

#### Verify the upload and build the code.

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.

{% hint style="warning" %}
Note: If the build was not successful, ensure the AprilTag library appears in the ExternalLibraries folder.&#x20;
{% endhint %}
{% endstep %}
{% endstepper %}

## 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.

<figure><img src="/files/jtWARdBwOf62sAcwlzMp" alt=""><figcaption></figcaption></figure>

\
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.
{% endtab %}
{% endtabs %}

## 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.
