diff --git a/build.gradle b/build.gradle index 60929d5..bf581d4 100644 --- a/build.gradle +++ b/build.gradle @@ -118,7 +118,11 @@ wpi.sim.addDriverstation() // in order to make them all available at runtime. Also adding the manifest so WPILib // knows where to look for our Robot Class. jar { - from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } + from { + configurations.runtimeClasspath.collect { + it.isDirectory() ? it : zipTree(it) + } + } from sourceSets.main.allSource manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) duplicatesStrategy = DuplicatesStrategy.INCLUDE diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index 0371513..4b517aa 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -50,12 +50,14 @@ public final class Constants { * etc.) and the operating modes of the code (REAL, SIM, or REPLAY) */ public static boolean disableHAL = false; + /** Enumerate the robot types (add additional bots here) */ public static enum RobotType { DEVBOT, // Development / Alpha / Practice Bot COMPBOT, // Competition robot SIMBOT // Simulated robot } + /** Enumerate the robot operation modes */ public static enum Mode { REAL, // REAL == Running on a real robot diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 77054c4..2f89da4 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -191,13 +191,14 @@ public static class VisionConstants { public static final Pose3d[] cameraPoses = switch (Constants.getRobot()) { - case COMPBOT -> new Pose3d[] { - new Pose3d( - Units.inchesToMeters(-1.0), - Units.inchesToMeters(0), - Units.inchesToMeters(23.5), - new Rotation3d(0.0, Units.degreesToRadians(-20), 0.0)), - }; + case COMPBOT -> + new Pose3d[] { + new Pose3d( + Units.inchesToMeters(-1.0), + Units.inchesToMeters(0), + Units.inchesToMeters(23.5), + new Rotation3d(0.0, Units.degreesToRadians(-20), 0.0)), + }; case DEVBOT -> new Pose3d[] {}; default -> new Pose3d[] {}; }; diff --git a/src/main/java/frc/robot/subsystems/swervedrive/SwerveSubsystem.java b/src/main/java/frc/robot/subsystems/swervedrive/SwerveSubsystem.java index 5ec6264..6596044 100644 --- a/src/main/java/frc/robot/subsystems/swervedrive/SwerveSubsystem.java +++ b/src/main/java/frc/robot/subsystems/swervedrive/SwerveSubsystem.java @@ -62,8 +62,10 @@ public class SwerveSubsystem extends SubsystemBase { /** Swerve drive object */ private final SwerveDrive swerveDrive; + /** PhotonVision class to keep an accurate odometry */ private Vision vision; + /** Enable vision odometry updates while driving */ private final boolean visionDriveTest = false; diff --git a/src/main/java/frc/robot/subsystems/vision/Vision.java b/src/main/java/frc/robot/subsystems/vision/Vision.java index 8e96598..7aa450e 100644 --- a/src/main/java/frc/robot/subsystems/vision/Vision.java +++ b/src/main/java/frc/robot/subsystems/vision/Vision.java @@ -62,12 +62,16 @@ public class Vision { /** Photon Vision Simulation */ public VisionSystemSim visionSim; + /** Count of times that the odom thinks we're more than 10meters away from the april tag. */ private double longDistangePoseEstimationCount = 0; + /** Current pose from the pose estimator using wheel odometry. */ private Supplier currentPose; + /** Ambiguity defined as a value between (0,1). Used in {@link Vision#filterPose}. */ private final double maximumAmbiguity = 0.25; + /** Field from {@link swervelib.SwerveDrive#field} */ private Field2d field2d; @@ -364,15 +368,19 @@ enum Cameras { /** Latency alert to use when high latency is detected. */ public final Alert latencyAlert; + /** Camera instance for comms. */ public final PhotonCamera camera; + /** Pose estimator for camera. */ public final PhotonPoseEstimator poseEstimator; public final Matrix singleTagStdDevs; public final Matrix multiTagStdDevs; + /** Transform of the camera rotation and translation relative to the center of the robot */ private final Transform3d robotToCamTransform; + /** Simulated camera instance which only exists during simulations. */ public PhotonCameraSim cameraSim;