Interface FieldBase


public interface FieldBase
Base field class for generic info.

Extend this class in your project to add season specific field data.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final AprilTag[]
    Array of all AprilTags on the field.
    static final edu.wpi.first.math.geometry.Pose2d
    EMPTY FIELD POSES
    static final edu.wpi.first.math.geometry.Pose3d
     
    static final edu.wpi.first.wpilibj.smartdashboard.Field2d
     
    static final double
    The height of the field.
    static final double
    The width of the field.
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static void
    clearFieldObject(edu.wpi.first.wpilibj.smartdashboard.FieldObject2d fieldObject)
     
    static edu.wpi.first.math.geometry.Pose2d
    conditionallyTransformToOppositeAlliance(edu.wpi.first.math.geometry.Pose2d pose)
    Conditionally transform a pose to the opposite of the current alliance.
    static edu.wpi.first.math.geometry.Pose3d
    conditionallyTransformToOppositeAlliance(edu.wpi.first.math.geometry.Pose3d pose)
    Conditionally transform a pose to the opposite of the current alliance.
    static edu.wpi.first.math.geometry.Translation2d
    conditionallyTransformToOppositeAlliance(edu.wpi.first.math.geometry.Translation2d translation)
    Conditionally transform a translation to the opposite of the current alliance.
    static List<edu.wpi.first.math.geometry.Pose2d>
    conditionallyTransformToOppositeAlliance(List<edu.wpi.first.math.geometry.Pose2d> poses)
    Conditionally transform a list of poses to the opposite of the current alliance.
    static int[]
    Get all AprilTag IDs.
    static AprilTag
    getTag(int id)
    Get an AprilTag by its ID.
    static boolean
    isValidTag(int id)
    Check if an AprilTag is valid.
    static edu.wpi.first.math.geometry.Pose2d
    transformToOppositeAlliance(edu.wpi.first.math.geometry.Pose2d pose)
    Transform a pose to the opposite of the current alliance.
    static edu.wpi.first.math.geometry.Pose3d
    transformToOppositeAlliance(edu.wpi.first.math.geometry.Pose3d pose)
    Transform a pose to the opposite of the current alliance.
    static edu.wpi.first.math.geometry.Translation2d
    transformToOppositeAlliance(edu.wpi.first.math.geometry.Translation2d translation)
    Transform a translation to the opposite of the current alliance.
    static List<edu.wpi.first.math.geometry.Pose2d>
    transformToOppositeAlliance(List<edu.wpi.first.math.geometry.Pose2d> poses)
    Transform a list of poses to the opposite of the current alliance.
  • Field Details

    • FIELD2D

      static final edu.wpi.first.wpilibj.smartdashboard.Field2d FIELD2D
    • WIDTH

      static final double WIDTH
      The width of the field.
    • LENGTH

      static final double LENGTH
      The height of the field.
    • APRILTAGS

      static final AprilTag[] APRILTAGS
      Array of all AprilTags on the field.
    • EMPTY_FIELD_POSE2D

      static final edu.wpi.first.math.geometry.Pose2d EMPTY_FIELD_POSE2D
      EMPTY FIELD POSES
    • EMPTY_FIELD_POSE3D

      static final edu.wpi.first.math.geometry.Pose3d EMPTY_FIELD_POSE3D
  • Method Details

    • conditionallyTransformToOppositeAlliance

      static edu.wpi.first.math.geometry.Pose3d conditionallyTransformToOppositeAlliance(edu.wpi.first.math.geometry.Pose3d pose)
      Conditionally transform a pose to the opposite of the current alliance.
      Parameters:
      pose - The pose to transform.
      Returns:
      The transformed pose.
    • conditionallyTransformToOppositeAlliance

      static edu.wpi.first.math.geometry.Pose2d conditionallyTransformToOppositeAlliance(edu.wpi.first.math.geometry.Pose2d pose)
      Conditionally transform a pose to the opposite of the current alliance.
      Parameters:
      pose - The pose to transform.
      Returns:
      The transformed pose.
    • conditionallyTransformToOppositeAlliance

      static edu.wpi.first.math.geometry.Translation2d conditionallyTransformToOppositeAlliance(edu.wpi.first.math.geometry.Translation2d translation)
      Conditionally transform a translation to the opposite of the current alliance.
      Parameters:
      translation - The translation to transform.
      Returns:
      The transformed translation.
    • conditionallyTransformToOppositeAlliance

      static List<edu.wpi.first.math.geometry.Pose2d> conditionallyTransformToOppositeAlliance(List<edu.wpi.first.math.geometry.Pose2d> poses)
      Conditionally transform a list of poses to the opposite of the current alliance.
      Parameters:
      poses - The poses to transform.
      Returns:
      The transformed poses.
    • transformToOppositeAlliance

      static edu.wpi.first.math.geometry.Pose3d transformToOppositeAlliance(edu.wpi.first.math.geometry.Pose3d pose)
      Transform a pose to the opposite of the current alliance.
      Parameters:
      pose - The pose to transform.
      Returns:
      The transformed pose.
    • transformToOppositeAlliance

      static edu.wpi.first.math.geometry.Pose2d transformToOppositeAlliance(edu.wpi.first.math.geometry.Pose2d pose)
      Transform a pose to the opposite of the current alliance.
      Parameters:
      pose - The pose to transform.
      Returns:
      The transformed pose.
    • transformToOppositeAlliance

      static edu.wpi.first.math.geometry.Translation2d transformToOppositeAlliance(edu.wpi.first.math.geometry.Translation2d translation)
      Transform a translation to the opposite of the current alliance.
      Parameters:
      translation - The translation to transform.
      Returns:
      The transformed translation.
    • transformToOppositeAlliance

      static List<edu.wpi.first.math.geometry.Pose2d> transformToOppositeAlliance(List<edu.wpi.first.math.geometry.Pose2d> poses)
      Transform a list of poses to the opposite of the current alliance.
      Parameters:
      poses - The poses to transform.
      Returns:
      The transformed poses.
    • isValidTag

      static boolean isValidTag(int id)
      Check if an AprilTag is valid.
      Parameters:
      id - The ID of the AprilTag.
      Returns:
      True if the tag is valid.
    • getTag

      static AprilTag getTag(int id)
      Get an AprilTag by its ID.
      Parameters:
      id - The AprilTag ID.
      Returns:
      The AprilTag with the matching ID if the ID is valid, otherwise null.
    • getAllTagIDs

      static int[] getAllTagIDs()
      Get all AprilTag IDs.
      Returns:
      Array of AprilTag IDs.
    • clearFieldObject

      static void clearFieldObject(edu.wpi.first.wpilibj.smartdashboard.FieldObject2d fieldObject)