]> git.taranathan.com Git - FRC2026.git/commitdiff
Zones fixed
authorWesley28w <wesleycwong@gmail.com>
Tue, 10 Feb 2026 00:58:15 +0000 (16:58 -0800)
committerWesley28w <wesleycwong@gmail.com>
Tue, 10 Feb 2026 00:58:15 +0000 (16:58 -0800)
src/main/java/frc/robot/constants/FieldConstants.java

index 5ec836d2a33e28c157b4d02c04a2465850dfc007..7033592bd96b227e769d47396b63140bdf5804f9 100644 (file)
@@ -24,36 +24,46 @@ public class FieldConstants {
   /**Apriltag layout for 2026 REBUILT */
   public static final AprilTagFieldLayout field = AprilTagFieldLayout.loadField(AprilTagFields.k2026RebuiltWelded);
 
+  public static final double RED_BORDER = Units.inchesToMeters(180);
+  public static final double BLUE_BORDER = FIELD_LENGTH - Units.inchesToMeters(180);
+  public static final double LEFT_SIDE_TARGET = FIELD_WIDTH * 0.25;
+  public static final double RIGHT_SIDE_TARGET = FIELD_WIDTH * 0.75;
 
   /** Location of hub target */
   public static final Translation3d HUB_BLUE =
       new Translation3d(Units.inchesToMeters(156.8 + 20), 4.035 + .67, Units.inchesToMeters(72));
+  
+  public static final Translation3d HUB_RED =
+      new Translation3d(FIELD_LENGTH - Units.inchesToMeters(156.8 + 20), 4.035 + .67, Units.inchesToMeters(72));
     
   // TODO: Update all of this
   public static final Translation3d NEUTRAL_LEFT =
-    new Translation3d(field.getFieldLength()*0.5, field.getFieldWidth()*0.25, 0);
+    new Translation3d(FIELD_LENGTH/2, LEFT_SIDE_TARGET, 0);
 
   public static final Translation3d NEUTRAL_RIGHT =
-    new Translation3d(field.getFieldLength()*0.5, field.getFieldWidth() - NEUTRAL_LEFT.getX(), 0);
+    new Translation3d(FIELD_LENGTH/2, RIGHT_SIDE_TARGET, 0);
 
   public static final Translation3d ALLIANCE_LEFT_BLUE =
-    new Translation3d(156.8+20+50, field.getFieldWidth()*0.25, 0); // previous hub + a few feet further back
+    new Translation3d(BLUE_BORDER + 5, LEFT_SIDE_TARGET, 0); // previous hub + a few feet further back
 
   public static final Translation3d ALLIANCE_RIGHT_BLUE =
-    new Translation3d(158.8+20+50, field.getFieldWidth() - ALLIANCE_LEFT_BLUE.getX(), 0);
+    new Translation3d(BLUE_BORDER + 5, RIGHT_SIDE_TARGET, 0);
 
-  public static final double BlueAllianceLine = FieldConstants.FIELD_LENGTH * 0.75;
-  public static final double RedAllianceLine = FieldConstants.FIELD_LENGTH * 0.25;
+
+  public static final Translation3d ALLIANCE_LEFT_RED =
+    new Translation3d(RED_BORDER + 5, LEFT_SIDE_TARGET, 0); // previous hub + a few feet further back
+
+  public static final Translation3d ALLIANCE_RIGHT_RED =
+    new Translation3d(RED_BORDER + 5, RIGHT_SIDE_TARGET, 0);
+
+  public static final double BlueAllianceLine = BLUE_BORDER; // That's the distance from one side to the blue bump
+  public static final double RedAllianceLine = RED_BORDER; // 
 
   public static Translation3d getHubTranslation() {
     if (Robot.getAlliance() == Alliance.Blue) {
       return HUB_BLUE;
     } else {
-      return new Translation3d(
-          field.getFieldLength() - HUB_BLUE.getX(),
-          HUB_BLUE.getY(),
-          HUB_BLUE.getZ()
-      );
+      return HUB_RED;
     }
   }
 
@@ -70,21 +80,13 @@ public class FieldConstants {
       if (Robot.getAlliance() == Alliance.Blue) {
         return ALLIANCE_LEFT_BLUE;
       } else {
-        return new Translation3d(
-          field.getFieldLength() - ALLIANCE_LEFT_BLUE.getX(),
-          ALLIANCE_LEFT_BLUE.getY(),
-          ALLIANCE_LEFT_BLUE.getZ()
-        );
+        return ALLIANCE_LEFT_RED;
       }
     } else {
       if (Robot.getAlliance() == Alliance.Blue) {
         return ALLIANCE_RIGHT_BLUE;
       } else {
-        return new Translation3d(
-          field.getFieldLength() - ALLIANCE_LEFT_BLUE.getX(),
-          ALLIANCE_RIGHT_BLUE.getY(),
-          ALLIANCE_RIGHT_BLUE.getZ()
-        );
+        return ALLIANCE_RIGHT_RED;
       }
     }
   }
@@ -112,21 +114,13 @@ public class FieldConstants {
   public static Translation3d getOppositionTranslation(boolean sideLeft) {
     if (sideLeft) {
       if (Robot.getAlliance() == Alliance.Blue) {
-        return new Translation3d(
-          field.getFieldLength() - ALLIANCE_LEFT_BLUE.getX(),
-          ALLIANCE_LEFT_BLUE.getY(),
-          ALLIANCE_LEFT_BLUE.getZ()
-        );
+        return ALLIANCE_LEFT_RED;
       } else {
         return ALLIANCE_LEFT_BLUE;
       }
     } else {
       if (Robot.getAlliance() == Alliance.Blue) {
-        return new Translation3d(
-          field.getFieldLength() - ALLIANCE_LEFT_BLUE.getX(),
-          ALLIANCE_RIGHT_BLUE.getY(),
-          ALLIANCE_RIGHT_BLUE.getZ()
-        );
+        return ALLIANCE_RIGHT_RED;
       } else {
         return ALLIANCE_RIGHT_BLUE;
       }