]> git.taranathan.com Git - FRC2026.git/commitdiff
Update VisionConstants.java
authormaxwtan <100314265+MaxwellTTan20@users.noreply.github.com>
Tue, 24 Feb 2026 23:01:42 +0000 (15:01 -0800)
committermaxwtan <100314265+MaxwellTTan20@users.noreply.github.com>
Tue, 24 Feb 2026 23:01:42 +0000 (15:01 -0800)
src/main/java/frc/robot/constants/VisionConstants.java

index 83a56d6630f5788f66a05c3b25114966c23bf153..39cf88aa311dbc90d85e3a820bfee19808b5fc66 100644 (file)
@@ -19,118 +19,118 @@ import edu.wpi.first.math.util.Units;
  * Container class for vision constants.
  */
 public class VisionConstants {
-    /**
-     * If April tag vision is enabled on the robot
-     */
-    public static final boolean ENABLED = true;
-
-    /**
-     * If object detection should be enabled
-     */
-    public static final boolean OBJECT_DETECTION_ENABLED = false;
-
-    /** If odometry should be updated using vision during auto */
-    public static final boolean ENABLED_AUTO = true;
-
-    /**
-     * If odometry should be updated using vision while running the GoToPose,
-     * GoToPosePID, and DriveToPose commands in teleop
-     */
-    public static final boolean ENABLED_GO_TO_POSE = true;
-
-    /** If vision should be simulated */
-    public static final boolean ENABLED_SIM = false;
-
-    /** If vision should only return values if it can see 2 good targets */
-    public static final boolean ONLY_USE_2_TAGS = false;
-
-    /** PoseStrategy to use in pose estimation */
-    public static final PoseStrategy POSE_STRATEGY = PoseStrategy.MULTI_TAG_PNP_ON_COPROCESSOR;
-
-    /** Fallback PoseStrategy if MultiTag doesn't work */
-    public static final PoseStrategy MULTITAG_FALLBACK_STRATEGY = PoseStrategy.LOWEST_AMBIGUITY;
-
-    /**
-     * Any April tags we always want to ignore. To ignore a tag, put its id in this
-     * array.
-     */
-    public static final int[] TAGS_TO_IGNORE = {};
-
-    /**
-     * If multiple cameras return different poses, they will be ignored if the
-     * difference between them is greater than this
-     */
-    public static final double MAX_POSE_DIFFERENCE = 0.2;
-
-    /**
-     * The maximum distance to the tag to use
-     */
-    public static final double MAX_DISTANCE = 2;
-
-    /** If vision should use manual calculations */
-    public static final boolean USE_MANUAL_CALCULATIONS = true;
-
-    // <ol start="0"> did not work
-    /**
-     * Which version of driver assist to use. This would be an enum, except there is
-     * no short and descriptive name for all of these.
-     * <p>
-     * The options are:
-     * <p>
-     * 0: Disable driver assist
-     * <p>
-     * 1: Completely remove the component of the driver's input that is not toward
-     * the object
-     * <p>
-     * 2: Interpolate between the next achievable driver speed and a speed
-     * calculated using trapezoid profiles
-     * <p>
-     * 3-5: Add a speed perpendicular to the driver input; there are 3 similar but
-     * different calculations for this
-     */
-    public static final int DRIVER_ASSIST_MODE = 5;
-
-    /**
-     * The number to multiply the distance to the April tag by.
-     * <p>
-     * Only affects manual calculations.
-     * <p>
-     * To find this, set it to 1 and measure the actual distance and the calculated
-     * distance.
-     * <p>
-     * This should not be needed, and it is only here because it improved the
-     * accuracy of vision in the 2023 fall semester
-     */
-    public static final double DISTANCE_SCALE = 1;
-
-    /**
-     * The standard deviations to use for vision
-     */
-    public static final Matrix<N3, N1> VISION_STD_DEVS = VecBuilder.fill(
-            0.3, // x in meters (default=0.9)
-            0.3, // y in meters (default=0.9)
-            0.9 // heading in radians. The gyroscope is very accurate, so as long as it is reset
-                // correctly it is unnecessary to correct it with vision
-    );
-
-    /**
-     * The standard deviations to use for vision when the wheels slip
-     */
-    public static final Matrix<N3, N1> VISION_STD_DEVS_2 = VecBuilder.fill(
-            0.01, // x in meters (default=0.9)
-            0.01, // y in meters (default=0.9)
-            0.9 // heading in radians. The gyroscope is very accurate, so as long as it is reset
-                // correctly it is unnecessary to correct it with vision
-    );
-
-    /**
-     * The highest ambiguity to use. Ambiguities higher than this will be ignored.
-     * <p>
-     * Only affects calculations using PhotonVision, not manual calculations.
-     */
-    public static final double HIGHEST_AMBIGUITY = 0.01;
-
-    public static final int MAX_EMPTY_TICKS = 10;
+        /**
+         * If April tag vision is enabled on the robot
+         */
+        public static final boolean ENABLED = true;
+
+        /**
+         * If object detection should be enabled
+         */
+        public static final boolean OBJECT_DETECTION_ENABLED = false;
+
+        /** If odometry should be updated using vision during auto */
+        public static final boolean ENABLED_AUTO = true;
+
+        /**
+         * If odometry should be updated using vision while running the GoToPose,
+         * GoToPosePID, and DriveToPose commands in teleop
+         */
+        public static final boolean ENABLED_GO_TO_POSE = true;
+
+        /** If vision should be simulated */
+        public static final boolean ENABLED_SIM = false;
+
+        /** If vision should only return values if it can see 2 good targets */
+        public static final boolean ONLY_USE_2_TAGS = false;
+
+        /** PoseStrategy to use in pose estimation */
+        public static final PoseStrategy POSE_STRATEGY = PoseStrategy.MULTI_TAG_PNP_ON_COPROCESSOR;
+
+        /** Fallback PoseStrategy if MultiTag doesn't work */
+        public static final PoseStrategy MULTITAG_FALLBACK_STRATEGY = PoseStrategy.LOWEST_AMBIGUITY;
+
+        /**
+         * Any April tags we always want to ignore. To ignore a tag, put its id in this
+         * array.
+         */
+        public static final int[] TAGS_TO_IGNORE = {};
+
+        /**
+         * If multiple cameras return different poses, they will be ignored if the
+         * difference between them is greater than this
+         */
+        public static final double MAX_POSE_DIFFERENCE = 0.2;
+
+        /**
+         * The maximum distance to the tag to use
+         */
+        public static final double MAX_DISTANCE = 6;
+
+        /** If vision should use manual calculations */
+        public static final boolean USE_MANUAL_CALCULATIONS = true;
+
+        // <ol start="0"> did not work
+        /**
+         * Which version of driver assist to use. This would be an enum, except there is
+         * no short and descriptive name for all of these.
+         * <p>
+         * The options are:
+         * <p>
+         * 0: Disable driver assist
+         * <p>
+         * 1: Completely remove the component of the driver's input that is not toward
+         * the object
+         * <p>
+         * 2: Interpolate between the next achievable driver speed and a speed
+         * calculated using trapezoid profiles
+         * <p>
+         * 3-5: Add a speed perpendicular to the driver input; there are 3 similar but
+         * different calculations for this
+         */
+        public static final int DRIVER_ASSIST_MODE = 5;
+
+        /**
+         * The number to multiply the distance to the April tag by.
+         * <p>
+         * Only affects manual calculations.
+         * <p>
+         * To find this, set it to 1 and measure the actual distance and the calculated
+         * distance.
+         * <p>
+         * This should not be needed, and it is only here because it improved the
+         * accuracy of vision in the 2023 fall semester
+         */
+        public static final double DISTANCE_SCALE = 1;
+
+        /**
+         * The standard deviations to use for vision
+         */
+        public static final Matrix<N3, N1> VISION_STD_DEVS = VecBuilder.fill(
+                        0.3, // x in meters (default=0.9)
+                        0.3, // y in meters (default=0.9)
+                        0.9 // heading in radians. The gyroscope is very accurate, so as long as it is reset
+                            // correctly it is unnecessary to correct it with vision
+        );
+
+        /**
+         * The standard deviations to use for vision when the wheels slip
+         */
+        public static final Matrix<N3, N1> VISION_STD_DEVS_2 = VecBuilder.fill(
+                        0.01, // x in meters (default=0.9)
+                        0.01, // y in meters (default=0.9)
+                        0.9 // heading in radians. The gyroscope is very accurate, so as long as it is reset
+                            // correctly it is unnecessary to correct it with vision
+        );
+
+        /**
+         * The highest ambiguity to use. Ambiguities higher than this will be ignored.
+         * <p>
+         * Only affects calculations using PhotonVision, not manual calculations.
+         */
+        public static final double HIGHEST_AMBIGUITY = 0.05;
+
+        public static final int MAX_EMPTY_TICKS = 10;
 
     /**
      * The camera poses
@@ -153,30 +153,45 @@ public class VisionConstants {
     public static final ArrayList<Pair<String, Transform3d>> APRIL_TAG_CAMERAS = new ArrayList<Pair<String, Transform3d>>(
             List.of(
                 new Pair<String, Transform3d>(
-                        "CameraFront",
+                        "CameraFrontLeft",
                         new Transform3d(
                                 new Translation3d(Units.inchesToMeters(10.485), Units.inchesToMeters(10.217),
                                         Units.inchesToMeters(11.012)),
                                 new Rotation3d(0, Units.degreesToRadians(-11),
                                         Math.PI/2 + Units.degreesToRadians(20)))),
                 new Pair<String, Transform3d>(
-                        "CameraBack",
+                        "CameraFrontRight",
+                        new Transform3d(
+                                new Translation3d(Units.inchesToMeters(-9.538), Units.inchesToMeters(7.474),
+                                        Units.inchesToMeters(8.719)),
+                                new Rotation3d(0, Units.degreesToRadians(-19.5),
+                                        Math.PI/2-Units.degreesToRadians(25)))),
+                new Pair<String, Transform3d>(
+                        "CameraBackLeft",
                         new Transform3d(
                                 new Translation3d(Units.inchesToMeters(-9.538), Units.inchesToMeters(7.474),
                                         Units.inchesToMeters(8.719)),
                                 new Rotation3d(0, Units.degreesToRadians(-19.5),
-                                        Math.PI/2-Units.degreesToRadians(25))))));
+                                        Math.PI/2-Units.degreesToRadians(25)))),
+                new Pair<String, Transform3d>(
+                        "CameraBackRight",
+                        new Transform3d(
+                                new Translation3d(Units.inchesToMeters(-9.538), Units.inchesToMeters(7.474),
+                                        Units.inchesToMeters(8.719)),
+                                new Rotation3d(0, Units.degreesToRadians(-19.5),
+                                        Math.PI/2-Units.degreesToRadians(25))))
+                ));
 
-    /**
-     * The transformations from the robot to object detection cameras
-     */
-    public static final ArrayList<Transform3d> OBJECT_DETECTION_CAMERAS = new ArrayList<>(List.of(
-            new Transform3d(
-                    new Translation3d(Units.inchesToMeters(10), 0, Units.inchesToMeters(24)),
-                    new Rotation3d(0, Units.degreesToRadians(20), 0))));
-
-    // used to cleanly shutdown the OrangePi
-    public static final String[] ORANGEPI_HOSTNAMES = {"photonfront.local", "photonback.local"};
-    public static final String ORANGEPI_USERNAME = "pi";
-    public static final String ORANGEPI_PASSWORD = "raspberry";
+        /**
+         * The transformations from the robot to object detection cameras
+         */
+        public static final ArrayList<Transform3d> OBJECT_DETECTION_CAMERAS = new ArrayList<>(List.of(
+                        new Transform3d(
+                                        new Translation3d(Units.inchesToMeters(10), 0, Units.inchesToMeters(24)),
+                                        new Rotation3d(0, Units.degreesToRadians(20), 0))));
+
+        // used to cleanly shutdown the OrangePi
+        public static final String[] ORANGEPI_HOSTNAMES = { "photonfront.local", "photonback.local" };
+        public static final String ORANGEPI_USERNAME = "pi";
+        public static final String ORANGEPI_PASSWORD = "raspberry";
 }