Package org.parts3492.partslib.game
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
FieldsModifier and TypeFieldDescriptionstatic final AprilTag[]Array of all AprilTags on the field.static final edu.wpi.first.math.geometry.Pose2dEMPTY FIELD POSESstatic final edu.wpi.first.math.geometry.Pose3dstatic final edu.wpi.first.wpilibj.smartdashboard.Field2dstatic final doubleThe height of the field.static final doubleThe width of the field. -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic voidclearFieldObject(edu.wpi.first.wpilibj.smartdashboard.FieldObject2d fieldObject) static edu.wpi.first.math.geometry.Pose2dconditionallyTransformToOppositeAlliance(edu.wpi.first.math.geometry.Pose2d pose) Conditionally transform a pose to the opposite of the current alliance.static edu.wpi.first.math.geometry.Pose3dconditionallyTransformToOppositeAlliance(edu.wpi.first.math.geometry.Pose3d pose) Conditionally transform a pose to the opposite of the current alliance.static edu.wpi.first.math.geometry.Translation2dconditionallyTransformToOppositeAlliance(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 AprilTaggetTag(int id) Get anAprilTagby its ID.static booleanisValidTag(int id) Check if an AprilTag is valid.static edu.wpi.first.math.geometry.Pose2dtransformToOppositeAlliance(edu.wpi.first.math.geometry.Pose2d pose) Transform a pose to the opposite of the current alliance.static edu.wpi.first.math.geometry.Pose3dtransformToOppositeAlliance(edu.wpi.first.math.geometry.Pose3d pose) Transform a pose to the opposite of the current alliance.static edu.wpi.first.math.geometry.Translation2dtransformToOppositeAlliance(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 WIDTHThe width of the field. -
LENGTH
static final double LENGTHThe height of the field. -
APRILTAGS
Array of all AprilTags on the field. -
EMPTY_FIELD_POSE2D
static final edu.wpi.first.math.geometry.Pose2d EMPTY_FIELD_POSE2DEMPTY 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
Get anAprilTagby 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)
-