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  /** 2026 Rebuilt Welded. */
022  k2026RebuiltWelded("2026-rebuilt-welded.json"),
023  /** 2026 Rebuilt AndyMark. */
024  k2026RebuiltAndymark("2026-rebuilt-andymark.json");
025
026  /** Base resource directory. */
027  public static final String kBaseResourceDir = "/edu/wpi/first/apriltag/";
028
029  /** Alias to the current game. */
030  public static final AprilTagFields kDefaultField = k2026RebuiltWelded;
031
032  /** Resource filename. */
033  public final String m_resourceFile;
034
035  AprilTagFieldLayout m_fieldLayout;
036
037  AprilTagFields(String resourceFile) {
038    m_resourceFile = kBaseResourceDir + resourceFile;
039  }
040
041  /**
042   * Get a {@link AprilTagFieldLayout} from the resource JSON.
043   *
044   * @return AprilTagFieldLayout of the field
045   * @throws UncheckedIOException If the layout does not exist
046   * @deprecated Use {@link AprilTagFieldLayout#loadField(AprilTagFields)} instead.
047   */
048  @Deprecated(forRemoval = true, since = "2025")
049  public AprilTagFieldLayout loadAprilTagLayoutField() {
050    return AprilTagFieldLayout.loadField(this);
051  }
052}