77
88package frc .robot ;
99
10+ import edu .wpi .first .apriltag .AprilTagFieldLayout ;
11+ import edu .wpi .first .apriltag .AprilTagFields ;
12+ import edu .wpi .first .math .geometry .Rotation3d ;
13+ import edu .wpi .first .math .geometry .Transform3d ;
1014import edu .wpi .first .wpilibj .RobotBase ;
1115
1216/**
@@ -18,6 +22,47 @@ public final class Constants {
1822 public static final Mode simMode = Mode .SIM ;
1923 public static final Mode currentMode = RobotBase .isReal () ? Mode .REAL : simMode ;
2024
25+ public static final class DriveConstants {}
26+
27+ public final class VisionConstants {
28+ // AprilTag layout
29+ public static AprilTagFieldLayout aprilTagLayout =
30+ AprilTagFieldLayout .loadField (AprilTagFields .kDefaultField );
31+
32+ // Camera names, must match names configured on coprocessor
33+ public static String camera0Name = "camera_0" ;
34+ public static String camera1Name = "camera_1" ;
35+
36+ // Robot to camera transforms
37+ // (Not used by Limelight, configure in web UI instead)
38+ public static Transform3d robotToCamera0 =
39+ new Transform3d (0.2 , 0.0 , 0.2 , new Rotation3d (0.0 , -0.4 , 0.0 ));
40+ public static Transform3d robotToCamera1 =
41+ new Transform3d (-0.2 , 0.0 , 0.2 , new Rotation3d (0.0 , -0.4 , 0.0 ));
42+
43+ // Basic filtering thresholds
44+ public static double maxAmbiguity = 0.3 ;
45+ public static double maxZError = 0.75 ;
46+
47+ // Standard deviation baselines, for 1 meter distance and 1 tag
48+ // (Adjusted automatically based on distance and # of tags)
49+ public static double linearStdDevBaseline = 0.02 ; // Meters
50+ public static double angularStdDevBaseline = 0.06 ; // Radians
51+
52+ // Standard deviation multipliers for each camera
53+ // (Adjust to trust some cameras more than others)
54+ public static double [] cameraStdDevFactors =
55+ new double [] {
56+ 1.0 , // Camera 0
57+ 1.0 // Camera 1
58+ };
59+
60+ // Multipliers to apply for MegaTag 2 observations
61+ public static double linearStdDevMegatag2Factor = 0.5 ; // More stable than full 3D solve
62+ public static double angularStdDevMegatag2Factor =
63+ Double .POSITIVE_INFINITY ; // No rotation data available
64+ }
65+
2166 public static enum Mode {
2267 /** Running on a real robot. */
2368 REAL ,
0 commit comments