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