22
33import static edu .wpi .first .units .Units .Inches ;
44
5- import edu .wpi .first .apriltag .AprilTagFieldLayout ;
6- import edu .wpi .first .apriltag .AprilTagFields ;
75import edu .wpi .first .math .geometry .Pose2d ;
86import edu .wpi .first .math .geometry .Pose3d ;
97import edu .wpi .first .math .geometry .Rotation3d ;
108import edu .wpi .first .math .geometry .Translation2d ;
119import edu .wpi .first .math .geometry .Translation3d ;
1210import edu .wpi .first .wpilibj .DriverStation .Alliance ;
13- import java .io .IOException ;
1411
1512public class FieldPose2026 extends PivotedFieldPose {
16- private static Translation2d Midpoint ; // Must be initialized before any individual FieldPoses
13+ private static Translation2d Midpoint =
14+ new Translation2d (
15+ 16.540988 / 2 , 8.069326 / 2 ); // Must be initialized before any individual FieldPoses
1716
1817 public static final Translation3d BlueHubCenter =
1918 new Translation3d (Inches .of (181.56 ), Inches .of (158.32 ), Inches .of (72 ));
@@ -34,16 +33,24 @@ public class FieldPose2026 extends PivotedFieldPose {
3433 public static final Translation3d BlueClimbFarRight =
3534 new Translation3d (Inches .of (41.8 ), Inches .of (170.96 ), Inches .of (0 ));
3635
37- private static final AprilTagFields AprilTagField = AprilTagFields .k2026RebuiltAndymark ;
38- public static AprilTagFieldLayout AprilTagLayout ;
39- public static FieldPose2026 Outpost ;
40- public static FieldPose2026 HubCenter ;
41- public static FieldPose2026 AllianceBallBox ;
42- public static FieldPose2026 ClimbFarLeftBar ;
43- public static FieldPose2026 ClimbLeftBar ;
44- public static FieldPose2026 ClimbMiddle ;
45- public static FieldPose2026 ClimbRightBar ;
46- public static FieldPose2026 ClimbFarRightBar ;
36+ public static FieldPose2026 HubCenter =
37+ new FieldPose2026 (Alliance .Blue , "HubCenter" , new Pose3d (BlueHubCenter , new Rotation3d ()));
38+ public static FieldPose2026 AllianceBallBox =
39+ new FieldPose2026 (
40+ Alliance .Blue , "AllianceBallBox" , new Pose3d (BlueAllianceBallBox , new Rotation3d ()));
41+ public static FieldPose2026 ClimbFarLeftBar =
42+ new FieldPose2026 (
43+ Alliance .Blue , "FarLeftClimb" , new Pose3d (BlueClimbFarLeft , new Rotation3d ()));
44+ public static FieldPose2026 ClimbLeftBar =
45+ new FieldPose2026 (Alliance .Blue , "LeftClimb" , new Pose3d (BlueClimbLeft , new Rotation3d ()));
46+ public static FieldPose2026 ClimbMiddle =
47+ new FieldPose2026 (
48+ Alliance .Blue , "MiddleClimb" , new Pose3d (BlueClimbMiddle , new Rotation3d ()));
49+ public static FieldPose2026 ClimbRightBar =
50+ new FieldPose2026 (Alliance .Blue , "RightClimb" , new Pose3d (BlueClimbRight , new Rotation3d ()));
51+ public static FieldPose2026 ClimbFarRightBar =
52+ new FieldPose2026 (
53+ Alliance .Blue , "FarRightClimb" , new Pose3d (BlueClimbFarRight , new Rotation3d ()));
4754
4855 public FieldPose2026 (Alliance defaultAlliance , String name , Pose3d defaultPose ) {
4956 super (Midpoint , defaultAlliance , name , defaultPose );
@@ -53,41 +60,5 @@ public FieldPose2026(Alliance defaultAlliance, String name, Pose2d defaultPose)
5360 super (Midpoint , defaultAlliance , name , new Pose3d (defaultPose ));
5461 }
5562
56- /**
57- * Required function before using any field points. Necessary because Java's static function
58- * initializers will fail to load any of it. Values will be null. Run this at runtime to load the
59- * data files early in the process.
60- *
61- * <p>Unfortunately, this means we can't make these fields final. You can thank Java for that.
62- *
63- * @throws IOException
64- */
65- public static void initializeFieldPoses () throws IOException {
66- AprilTagLayout = new AprilTagFieldLayout (AprilTagField .m_resourceFile );
67- Midpoint =
68- new Translation2d (
69- AprilTagLayout .getFieldLength () / 2.0 , AprilTagLayout .getFieldWidth () / 2.0 );
70- // Individual Field Poses
71- HubCenter =
72- new FieldPose2026 (Alliance .Blue , "HubCenter" , new Pose3d (BlueHubCenter , new Rotation3d ()));
73- Outpost = new FieldPose2026 (Alliance .Blue , "Outpost" , AprilTagLayout .getTagPose (29 ).get ());
74- AllianceBallBox =
75- new FieldPose2026 (
76- Alliance .Blue , "AllianceBallBox" , new Pose3d (BlueAllianceBallBox , new Rotation3d ()));
77- // Climber positions
78- ClimbFarLeftBar =
79- new FieldPose2026 (
80- Alliance .Blue , "FarLeftClimb" , new Pose3d (BlueClimbFarLeft , new Rotation3d ()));
81- ClimbLeftBar =
82- new FieldPose2026 (Alliance .Blue , "LeftClimb" , new Pose3d (BlueClimbLeft , new Rotation3d ()));
83- ClimbMiddle =
84- new FieldPose2026 (
85- Alliance .Blue , "MiddleClimb" , new Pose3d (BlueClimbMiddle , new Rotation3d ()));
86- ClimbRightBar =
87- new FieldPose2026 (
88- Alliance .Blue , "RightClimb" , new Pose3d (BlueClimbRight , new Rotation3d ()));
89- ClimbFarLeftBar =
90- new FieldPose2026 (
91- Alliance .Blue , "FarRightClimb" , new Pose3d (BlueClimbFarRight , new Rotation3d ()));
92- }
63+ // Outpost = new FieldPose2026(Alliance.Blue, "Outpost", AprilTagLayout.getTagPose(29).get());
9364}
0 commit comments