001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.apriltag; 006 007import java.io.UncheckedIOException; 008 009/** Loadable AprilTag field layouts. */ 010public enum AprilTagFields { 011 /** 2022 Rapid React. */ 012 k2022RapidReact("2022-rapidreact.json"), 013 /** 2023 Charged Up. */ 014 k2023ChargedUp("2023-chargedup.json"), 015 /** 2024 Crescendo. */ 016 k2024Crescendo("2024-crescendo.json"), 017 /** 2025 Reefscape Welded (see TU 12). */ 018 k2025ReefscapeWelded("2025-reefscape-welded.json"), 019 /** 2025 Reefscape AndyMark (see TU 12). */ 020 k2025ReefscapeAndyMark("2025-reefscape-andymark.json"); 021 022 /** Base resource directory. */ 023 public static final String kBaseResourceDir = "/edu/wpi/first/apriltag/"; 024 025 /** Alias to the current game. */ 026 public static final AprilTagFields kDefaultField = k2025ReefscapeWelded; 027 028 /** Resource filename. */ 029 public final String m_resourceFile; 030 031 AprilTagFieldLayout m_fieldLayout; 032 033 AprilTagFields(String resourceFile) { 034 m_resourceFile = kBaseResourceDir + resourceFile; 035 } 036 037 /** 038 * Get a {@link AprilTagFieldLayout} from the resource JSON. 039 * 040 * @return AprilTagFieldLayout of the field 041 * @throws UncheckedIOException If the layout does not exist 042 * @deprecated Use {@link AprilTagFieldLayout#loadField(AprilTagFields)} instead. 043 */ 044 @Deprecated(forRemoval = true, since = "2025") 045 public AprilTagFieldLayout loadAprilTagLayoutField() { 046 return AprilTagFieldLayout.loadField(this); 047 } 048}