Skip to content

Commit

Permalink
Cleaning after upgrade of spotless
Browse files Browse the repository at this point in the history
	modified:   build.gradle
	modified:   src/main/java/frc/robot/Constants.java
	modified:   src/main/java/frc/robot/RobotContainer.java
	modified:   src/main/java/frc/robot/subsystems/swervedrive/SwerveSubsystem.java
	modified:   src/main/java/frc/robot/subsystems/vision/Vision.java
  • Loading branch information
tbowers7 committed Oct 15, 2024
1 parent 936686f commit 2d96307
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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[] {};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 8 additions & 0 deletions src/main/java/frc/robot/subsystems/vision/Vision.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Pose2d> 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;

Expand Down Expand Up @@ -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<N3, N1> singleTagStdDevs;
public final Matrix<N3, N1> 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;

Expand Down

0 comments on commit 2d96307

Please sign in to comment.