From 25865ae3bb3c82636f58ffaecaf3f4a47e483771 Mon Sep 17 00:00:00 2001 From: MattD8957 Date: Fri, 29 Mar 2024 07:31:54 -0400 Subject: [PATCH] [#477] Bug fixes --- src/main/java/frc/robot/Constants.java | 2 +- src/main/java/frc/robot/command/AutonSmartCollect.java | 4 ++-- src/main/java/frc/robot/command/ChasePieces.java | 9 +++++++-- src/main/java/frc/robot/command/shoot/SmartShoot.java | 2 +- src/main/java/frc/robot/subsystems/Limelights.java | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index d1b1fb32..17ddfd9d 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -465,7 +465,7 @@ public class FlywheelConstants { public static final double BOTTOM_1_MOTOR_KV = 0.114; public static final double BOTTOM_1_MOTOR_KA = 0; - public static final double RPM_TOLERANCE = 250d; + public static final double RPM_TOLERANCE = 100d; public static final double BIAS_INCREMENT = 1.25; // RPS to bias by per button press public static final double COAST_VOLTAGE = 0.1; diff --git a/src/main/java/frc/robot/command/AutonSmartCollect.java b/src/main/java/frc/robot/command/AutonSmartCollect.java index 8dee0f56..e3595a11 100644 --- a/src/main/java/frc/robot/command/AutonSmartCollect.java +++ b/src/main/java/frc/robot/command/AutonSmartCollect.java @@ -44,11 +44,11 @@ public void initialize() { } @Override - public void execute() { + public void execute() { // TODO this needs to be cleaned up if(indexer.getPieceState() == PieceState.IN_COLLECT){ indexer.setPower(indexerPower.getAsDouble() / 2); // TODO test at speed } else if (indexer.getPieceState() == PieceState.IN_PIVOT) { - end(false); + end(false); // DO not call end in execute, use the isFinsished command } else { collector.setPower(collectorPower.getAsDouble()); indexer.setPower(indexerPower.getAsDouble()); diff --git a/src/main/java/frc/robot/command/ChasePieces.java b/src/main/java/frc/robot/command/ChasePieces.java index 6616df9b..493808f8 100644 --- a/src/main/java/frc/robot/command/ChasePieces.java +++ b/src/main/java/frc/robot/command/ChasePieces.java @@ -82,7 +82,7 @@ public ChasePieces(Swerve drivetrain, Collector collector, Indexer indexer, Pivo if (DriverStation.isAutonomous()) { this.drivePower = 1.5d; this.rotPower = 1.5d; // TODO: get real >:) - this.maxCollectPower = 0.8d; + this.maxCollectPower = 0.8d; // TODO Shouldnt this be slower? } else { this.maxCollectPower = 0.65d; this.drivePower = 3d; @@ -100,7 +100,12 @@ public void initialize() { headingController.setTolerance(VisionConstants.ALIGNMENT_TOLERANCE); collectPower = 0d; - smartCollect = new AutonSmartCollect(() -> collectPower, () -> collectPower, collector, indexer); + if(DriverStation.isAutonomous()) { + smartCollect = new AutonSmartCollect(() -> collectPower, () -> collectPower, collector, indexer); + } else { + smartCollect = new SmartCollect(() -> collectPower, () -> collectPower, collector, indexer, pivot, flywheel); + } + smartCollect.initialize(); hasSeenTarget = false; diff --git a/src/main/java/frc/robot/command/shoot/SmartShoot.java b/src/main/java/frc/robot/command/shoot/SmartShoot.java index b0f0e39c..aba8b879 100644 --- a/src/main/java/frc/robot/command/shoot/SmartShoot.java +++ b/src/main/java/frc/robot/command/shoot/SmartShoot.java @@ -56,7 +56,7 @@ public SmartShoot(Flywheel flywheel, Pivot pivot, Swerve drivetrain, Indexer ind this.collector = collector; this.leds = leds; - addRequirements(pivot, flywheel, indexer); + addRequirements(pivot, flywheel, indexer, collector); initLogging(); } diff --git a/src/main/java/frc/robot/subsystems/Limelights.java b/src/main/java/frc/robot/subsystems/Limelights.java index 8de46d98..25c6b386 100644 --- a/src/main/java/frc/robot/subsystems/Limelights.java +++ b/src/main/java/frc/robot/subsystems/Limelights.java @@ -19,7 +19,7 @@ public class Limelights extends SubsystemBase { }; public Limelights() { - stopMe = new Limelight("limelight-stopme", "10.8.62.11"); // LL3 Back + stopMe = new Limelight("limelight-stopme", "10.8.62.11"); // LL3g Shooter side dust = new Limelight("limelight-dust", "10.8.62.12"); // LL2+ Front champs = new Limelight("limelight-champs", "10.8.62.13"); // LL3 Front