From 32ede81ffaf43d4e730ff646db98627385e80ba1 Mon Sep 17 00:00:00 2001 From: Michael Mikovsky Date: Fri, 20 Feb 2026 15:24:05 -0800 Subject: [PATCH] Move AimLeadTime to being defined by ShooterConstants. --- src/main/java/frc4388/robot/RobotContainer.java | 5 ++++- .../frc4388/robot/subsystems/shooter/ShooterConstants.java | 1 + .../java/frc4388/robot/subsystems/swerve/SwerveDrive.java | 4 ++-- .../robot/subsystems/swerve/SwerveDriveConstants.java | 3 --- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index 29d3ec1..e342c3d 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -34,6 +34,7 @@ import frc4388.robot.subsystems.LED; import frc4388.robot.subsystems.intake.Intake; import frc4388.robot.subsystems.intake.Intake.IntakeMode; import frc4388.robot.subsystems.shooter.Shooter; +import frc4388.robot.subsystems.shooter.ShooterConstants; import frc4388.robot.subsystems.swerve.SwerveDrive; import frc4388.robot.subsystems.vision.Vision; import frc4388.utility.DeferredBlock; @@ -222,7 +223,9 @@ public class RobotContainer { () -> { m_robotSwerveDrive.driveFacingPosition( getDeadbandedDriverController().getLeft(), - FieldPositions.HUB_POSITION); + FieldPositions.HUB_POSITION, + ShooterConstants.AIM_LEAD_TIME.get() + ); }, m_robotSwerveDrive) ); // .onTrue(new InstantCommand(() -> { diff --git a/src/main/java/frc4388/robot/subsystems/shooter/ShooterConstants.java b/src/main/java/frc4388/robot/subsystems/shooter/ShooterConstants.java index 60380e8..360be28 100644 --- a/src/main/java/frc4388/robot/subsystems/shooter/ShooterConstants.java +++ b/src/main/java/frc4388/robot/subsystems/shooter/ShooterConstants.java @@ -24,6 +24,7 @@ public class ShooterConstants { public static final ConfigurableDouble INDEXER_FORWARD_OUTPUT = new ConfigurableDouble("Indexer FWD % Output", -0.1); public static final ConfigurableDouble INDEXER_REVERSE_OUTPUT = new ConfigurableDouble("Indexer reverse % Output", 0.0); + public static final ConfigurableDouble AIM_LEAD_TIME = new ConfigurableDouble("Aim lead time", 0); // Shoot mode tolerances public static final ConfigurableDouble ROBOT_MIN_HUB = new ConfigurableDouble("Shoot min dist M", 0); diff --git a/src/main/java/frc4388/robot/subsystems/swerve/SwerveDrive.java b/src/main/java/frc4388/robot/subsystems/swerve/SwerveDrive.java index 85ffb98..fb1d78e 100644 --- a/src/main/java/frc4388/robot/subsystems/swerve/SwerveDrive.java +++ b/src/main/java/frc4388/robot/subsystems/swerve/SwerveDrive.java @@ -339,7 +339,7 @@ public class SwerveDrive extends SubsystemBase implements Queryable { // Drive with the robot facing towards a specific position - public void driveFacingPosition(Translation2d leftStick, Translation2d fieldPos) { + public void driveFacingPosition(Translation2d leftStick, Translation2d fieldPos, double aimLeadTime) { // Get the current speed of the robot Translation2d robotSpeed = new Translation2d( @@ -348,7 +348,7 @@ public class SwerveDrive extends SubsystemBase implements Queryable { ); // Calculate a point to aim ahead of the actual position. - Translation2d fieldPosLead = robotSpeed.times(SwerveDriveConstants.AIM_LEAD_TIME.get()).plus(fieldPos); + Translation2d fieldPosLead = robotSpeed.times(aimLeadTime).plus(fieldPos); // Calculate the angle between the current position and the lead position Rotation2d ang = fieldPosLead.minus(getPose2d().getTranslation()).getAngle(); diff --git a/src/main/java/frc4388/robot/subsystems/swerve/SwerveDriveConstants.java b/src/main/java/frc4388/robot/subsystems/swerve/SwerveDriveConstants.java index 4e1139f..16f617d 100644 --- a/src/main/java/frc4388/robot/subsystems/swerve/SwerveDriveConstants.java +++ b/src/main/java/frc4388/robot/subsystems/swerve/SwerveDriveConstants.java @@ -39,9 +39,6 @@ public final class SwerveDriveConstants { public static double PLAYBACK_ROTATION_SPEED = AUTO_MAX_ROT_SPEED; public static double ROT_CORRECTION_SPEED = 10; // MIN_ROT_SPEED; - // TODO: Replace with a constant - public static final ConfigurableDouble AIM_LEAD_TIME = new ConfigurableDouble("Aim lead time", 0); - public static final double CORRECTION_MIN = 10; public static final double CORRECTION_MAX = 50;