From 5367673e3d0365ba0757c19a07cce12fc0d3e2b0 Mon Sep 17 00:00:00 2001 From: Jetblackdragon Date: Mon, 14 Sep 2026 20:13:32 -0700 Subject: [PATCH 1/7] subsystem code done, need to do controls --- src/main/java/frc/robot/Controls.java | 5 + src/main/java/frc/robot/Flywheels.java | 119 ++++++++++++++++++++++++ src/main/java/frc/robot/Hardware.java | 3 + src/main/java/frc/robot/Subsystems.java | 9 ++ 4 files changed, 136 insertions(+) create mode 100644 src/main/java/frc/robot/Flywheels.java diff --git a/src/main/java/frc/robot/Controls.java b/src/main/java/frc/robot/Controls.java index 82098a5..40d39b7 100644 --- a/src/main/java/frc/robot/Controls.java +++ b/src/main/java/frc/robot/Controls.java @@ -11,6 +11,7 @@ import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType; import com.ctre.phoenix6.swerve.SwerveRequest; import edu.wpi.first.math.MathUtil; +import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import edu.wpi.first.wpilibj2.command.button.Trigger; import frc.robot.generated.AlphaTunerConstants; @@ -24,12 +25,14 @@ public class Controls { private static final int DRIVER_CONTROLLER_PORT = 0; + private static final int FLYWHEEL_CONTROLLER_PORT = 1; private static final double JOYSTICK_DEADBAND = 0.1; private final Subsystems s; private static final double SWERVE_DEADBAND = 0.001; private final CommandXboxController driverController = new CommandXboxController(DRIVER_CONTROLLER_PORT); + private final CommandXboxController flywheelTestController = new CommandXboxController(FLYWHEEL_CONTROLLER_PORT); public static final double MaxSpeed = AlphaTunerConstants.kSpeedAt12Volts.in(MetersPerSecond); @@ -79,6 +82,8 @@ private double getDriveRotate() { double input = MathUtil.applyDeadband(-driverController.getRightX(), JOYSTICK_DEADBAND); return input * MaxSpeed; } + private void configureFlywheelBindings() { + driverController.rightTrigger().whileTrue(s.Flywheels.setVelocityCommand); /* Setting up bindings for necessary control of the swerve drive platform */ private final SwerveRequest.FieldCentric drive = diff --git a/src/main/java/frc/robot/Flywheels.java b/src/main/java/frc/robot/Flywheels.java new file mode 100644 index 0000000..f754253 --- /dev/null +++ b/src/main/java/frc/robot/Flywheels.java @@ -0,0 +1,119 @@ +package frc.robot; + +import com.ctre.phoenix6.configs.TalonFXConfiguration; +import com.ctre.phoenix6.configs.TalonFXConfigurator; +import com.ctre.phoenix6.controls.Follower; +import com.ctre.phoenix6.controls.MotionMagicVelocityVoltage; +import com.ctre.phoenix6.hardware.TalonFX; +import com.ctre.phoenix6.signals.InvertedValue; +import com.ctre.phoenix6.signals.MotorAlignmentValue; +import com.ctre.phoenix6.signals.NeutralModeValue; +import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.SubsystemBase; +import java.util.function.DoubleSupplier; + +public class Flywheels extends SubsystemBase { + private final TalonFX FlywheelOne; + private final TalonFX FlywheelTwo; + + public static double speed = 1; // placeholder + + // Configs: PIDS and limits + double kP = 0.0; + double kI = 0.0; + double kD = 0.0; + double kA = 0.0; + double kV = 0.0; + double kS = 0.0; + double kG = 0.0; + + int SupplyCurrentLimit = 20; + int StatorCurrentLimit = 40; + boolean SupplyCurrentLimitEnable = true; + boolean StatorCurrentLimitEnable = true; + int MotionMagicAcceleration = 40; + + private final MotionMagicVelocityVoltage request = new MotionMagicVelocityVoltage(0); + private final Follower follow = + new Follower(Hardware.FLYWHEEL_ONE_ID, MotorAlignmentValue.Opposed); + public final double FLYWHEEL_TOLERANCE = 5; // TODO: Tune tolerance as well + + public Flywheels() { + FlywheelOne = new TalonFX(Hardware.FLYWHEEL_ONE_ID); + FlywheelTwo = new TalonFX(Hardware.FLYWHEEL_TWO_ID); + + configureMotors(); + } + + private void configureMotors() { + TalonFXConfiguration config = new TalonFXConfiguration(); + TalonFXConfigurator flConfigurator = FlywheelOne.getConfigurator(); + + // TODO: tune configs and PIDS, currently placeholder + config.CurrentLimits.SupplyCurrentLimit = SupplyCurrentLimit; + config.CurrentLimits.StatorCurrentLimit = StatorCurrentLimit; + config.CurrentLimits.SupplyCurrentLimitEnable = SupplyCurrentLimitEnable; + config.CurrentLimits.StatorCurrentLimitEnable = StatorCurrentLimitEnable; + + config.MotorOutput.NeutralMode = NeutralModeValue.Coast; + config.MotorOutput.Inverted = InvertedValue.Clockwise_Positive; + + config.Slot0.kP = kP; + config.Slot0.kI = kI; + config.Slot0.kD = kD; + config.Slot0.kA = kA; + config.Slot0.kV = kV; + config.Slot0.kS = kS; + config.Slot0.kG = kG; + + config.MotionMagic.MotionMagicAcceleration = MotionMagicAcceleration; // RPS^2 + + flConfigurator.apply(config); + } + + public Command setFlywheelVelocity(double rps) { + return runEnd( + () -> { + request.Velocity = rps; + FlywheelOne.setControl(request); + FlywheelTwo.setControl(follow); + }, + () -> { + FlywheelOne.stopMotor(); + FlywheelTwo.stopMotor(); + }) + .withName("Set Velocity"); + } + public void setVelocityCommand() { + setFlywheelVelocity(speed); + } + + public Command suppliedSetVelocity(DoubleSupplier rps) { + return runEnd( + () -> { + request.Velocity = rps.getAsDouble(); + FlywheelOne.setControl(request); + FlywheelTwo.setControl(follow); + }, + () -> { + FlywheelOne.stopMotor(); + FlywheelTwo.stopMotor(); + }) + .withName("Supplied velocity command"); + } + + public void setVelocityRPS(double rps) { + request.Velocity = rps; + FlywheelOne.setControl(request); + FlywheelTwo.setControl(follow); + } + + public Command stopCommand() { + return runOnce( + () -> { + FlywheelOne.stopMotor(); + FlywheelTwo.stopMotor(); + }) + .withName("Stop motors command"); + } +} diff --git a/src/main/java/frc/robot/Hardware.java b/src/main/java/frc/robot/Hardware.java index bf233a5..9e42dfd 100644 --- a/src/main/java/frc/robot/Hardware.java +++ b/src/main/java/frc/robot/Hardware.java @@ -7,4 +7,7 @@ public final class Hardware { public static final int PDH_ID = 1; + // TODO: make this accurate to the actual robot + public static final int FLYWHEEL_ONE_ID = 2; + public static final int FLYWHEEL_TWO_ID = 3; } diff --git a/src/main/java/frc/robot/Subsystems.java b/src/main/java/frc/robot/Subsystems.java index 71f4545..ea19ec3 100644 --- a/src/main/java/frc/robot/Subsystems.java +++ b/src/main/java/frc/robot/Subsystems.java @@ -1,6 +1,7 @@ package frc.robot; import static frc.robot.Subsystems.SubsystemConstants.DRIVEBASE_ENABLED; +import static frc.robot.Subsystems.SubsystemConstants.FLYWHEELS_ENABLED; import edu.wpi.first.wpilibj.smartdashboard.Mechanism2d; import frc.robot.generated.AlphaTunerConstants; @@ -11,9 +12,11 @@ public class Subsystems { // _ENABLED constants go here public static class SubsystemConstants { public static final boolean DRIVEBASE_ENABLED = true; + public static final boolean FLYWHEELS_ENABLED = true; } public final CommandSwerveDrivetrain drivebaseSubsystem; + public final Flywheels Flywheels; public Subsystems(Mechanism2d mechanism2d) { // Initialize subsystems here (don't forget to check if they're enabled!) @@ -33,5 +36,11 @@ public Subsystems(Mechanism2d mechanism2d) { } else { drivebaseSubsystem = null; } + if (FLYWHEELS_ENABLED) { + Flywheels = new Flywheels(); + } + else { + Flywheels = null; + } } } From 67b3dc6735051c06b2539148335585d606780ab4 Mon Sep 17 00:00:00 2001 From: cwkpete7383 <61662875+cwkpete7383@users.noreply.github.com> Date: Mon, 21 Sep 2026 17:31:01 -0700 Subject: [PATCH 2/7] controls complete --- src/main/java/frc/robot/Controls.java | 10 +++---- src/main/java/frc/robot/Flywheels.java | 37 +++++++------------------ src/main/java/frc/robot/Subsystems.java | 3 +- 3 files changed, 16 insertions(+), 34 deletions(-) diff --git a/src/main/java/frc/robot/Controls.java b/src/main/java/frc/robot/Controls.java index 40d39b7..dd241ee 100644 --- a/src/main/java/frc/robot/Controls.java +++ b/src/main/java/frc/robot/Controls.java @@ -11,7 +11,6 @@ import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType; import com.ctre.phoenix6.swerve.SwerveRequest; import edu.wpi.first.math.MathUtil; -import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import edu.wpi.first.wpilibj2.command.button.Trigger; import frc.robot.generated.AlphaTunerConstants; @@ -25,14 +24,12 @@ public class Controls { private static final int DRIVER_CONTROLLER_PORT = 0; - private static final int FLYWHEEL_CONTROLLER_PORT = 1; private static final double JOYSTICK_DEADBAND = 0.1; private final Subsystems s; private static final double SWERVE_DEADBAND = 0.001; private final CommandXboxController driverController = new CommandXboxController(DRIVER_CONTROLLER_PORT); - private final CommandXboxController flywheelTestController = new CommandXboxController(FLYWHEEL_CONTROLLER_PORT); public static final double MaxSpeed = AlphaTunerConstants.kSpeedAt12Volts.in(MetersPerSecond); @@ -45,6 +42,7 @@ public Controls(Subsystems subsystems) { s = subsystems; // Configure the trigger bindings configureBindings(); + configureFlywheelBindings(); } /** @@ -82,8 +80,10 @@ private double getDriveRotate() { double input = MathUtil.applyDeadband(-driverController.getRightX(), JOYSTICK_DEADBAND); return input * MaxSpeed; } - private void configureFlywheelBindings() { - driverController.rightTrigger().whileTrue(s.Flywheels.setVelocityCommand); + + public void configureFlywheelBindings() { + driverController.rightTrigger().whileTrue(s.Flywheels.runFlywheels()); + } /* Setting up bindings for necessary control of the swerve drive platform */ private final SwerveRequest.FieldCentric drive = diff --git a/src/main/java/frc/robot/Flywheels.java b/src/main/java/frc/robot/Flywheels.java index f754253..3e80c61 100644 --- a/src/main/java/frc/robot/Flywheels.java +++ b/src/main/java/frc/robot/Flywheels.java @@ -10,7 +10,6 @@ import com.ctre.phoenix6.signals.NeutralModeValue; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.SubsystemBase; -import java.util.function.DoubleSupplier; public class Flywheels extends SubsystemBase { private final TalonFX FlywheelOne; @@ -71,49 +70,33 @@ private void configureMotors() { flConfigurator.apply(config); } - public Command setFlywheelVelocity(double rps) { + public Command runFlywheels() { return runEnd( () -> { - request.Velocity = rps; - FlywheelOne.setControl(request); - FlywheelTwo.setControl(follow); + startFlywheels(speed); }, () -> { - FlywheelOne.stopMotor(); - FlywheelTwo.stopMotor(); + stopFlywheels(); }) - .withName("Set Velocity"); - } - public void setVelocityCommand() { - setFlywheelVelocity(speed); + .withName("Run Flywheels"); } - public Command suppliedSetVelocity(DoubleSupplier rps) { - return runEnd( + public Command startFlywheels(double rps) { + return runOnce( () -> { - request.Velocity = rps.getAsDouble(); + request.Velocity = rps; FlywheelOne.setControl(request); FlywheelTwo.setControl(follow); - }, - () -> { - FlywheelOne.stopMotor(); - FlywheelTwo.stopMotor(); }) - .withName("Supplied velocity command"); - } - - public void setVelocityRPS(double rps) { - request.Velocity = rps; - FlywheelOne.setControl(request); - FlywheelTwo.setControl(follow); + .withName("Start Flywheels"); } - public Command stopCommand() { + public Command stopFlywheels() { return runOnce( () -> { FlywheelOne.stopMotor(); FlywheelTwo.stopMotor(); }) - .withName("Stop motors command"); + .withName("Stop Flywheels"); } } diff --git a/src/main/java/frc/robot/Subsystems.java b/src/main/java/frc/robot/Subsystems.java index ea19ec3..e958ce4 100644 --- a/src/main/java/frc/robot/Subsystems.java +++ b/src/main/java/frc/robot/Subsystems.java @@ -38,8 +38,7 @@ public Subsystems(Mechanism2d mechanism2d) { } if (FLYWHEELS_ENABLED) { Flywheels = new Flywheels(); - } - else { + } else { Flywheels = null; } } From 34da4bc20e769af2b58994b9c11f7071da103dd8 Mon Sep 17 00:00:00 2001 From: cwkpete7383 <61662875+cwkpete7383@users.noreply.github.com> Date: Mon, 21 Sep 2026 20:49:22 -0700 Subject: [PATCH 3/7] forgot to commit earlier --- src/main/java/frc/robot/Controls.java | 6 +++++- src/main/java/frc/robot/Flywheels.java | 5 ++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/frc/robot/Controls.java b/src/main/java/frc/robot/Controls.java index fe6c7ff..289f7ab 100644 --- a/src/main/java/frc/robot/Controls.java +++ b/src/main/java/frc/robot/Controls.java @@ -76,7 +76,11 @@ private double getDriveRotate() { } public void configureFlywheelBindings() { - driverController.rightTrigger().whileTrue(s.Flywheels.runFlywheels()); + if (s.Flywheels == null) { + return; + } else { + driverController.rightTrigger().whileTrue(s.Flywheels.runFlywheels()); + } } /* Setting up bindings for necessary control of the swerve drive platform */ diff --git a/src/main/java/frc/robot/Flywheels.java b/src/main/java/frc/robot/Flywheels.java index 3e80c61..412ffd5 100644 --- a/src/main/java/frc/robot/Flywheels.java +++ b/src/main/java/frc/robot/Flywheels.java @@ -1,7 +1,6 @@ package frc.robot; import com.ctre.phoenix6.configs.TalonFXConfiguration; -import com.ctre.phoenix6.configs.TalonFXConfigurator; import com.ctre.phoenix6.controls.Follower; import com.ctre.phoenix6.controls.MotionMagicVelocityVoltage; import com.ctre.phoenix6.hardware.TalonFX; @@ -46,7 +45,6 @@ public Flywheels() { private void configureMotors() { TalonFXConfiguration config = new TalonFXConfiguration(); - TalonFXConfigurator flConfigurator = FlywheelOne.getConfigurator(); // TODO: tune configs and PIDS, currently placeholder config.CurrentLimits.SupplyCurrentLimit = SupplyCurrentLimit; @@ -67,7 +65,8 @@ private void configureMotors() { config.MotionMagic.MotionMagicAcceleration = MotionMagicAcceleration; // RPS^2 - flConfigurator.apply(config); + FlywheelOne.getConfigurator().apply(config); + FlywheelTwo.getConfigurator().apply(config); } public Command runFlywheels() { From 9fd7f64d1842b197e54fbc14ba0ccf7a9868045e Mon Sep 17 00:00:00 2001 From: cwkpete7383 Date: Thu, 24 Sep 2026 19:14:56 -0700 Subject: [PATCH 4/7] fix issues 1 --- src/main/java/frc/robot/Controls.java | 9 ++- src/main/java/frc/robot/Flywheels.java | 77 +++++++++++-------------- src/main/java/frc/robot/Subsystems.java | 9 ++- 3 files changed, 45 insertions(+), 50 deletions(-) diff --git a/src/main/java/frc/robot/Controls.java b/src/main/java/frc/robot/Controls.java index 40d39b7..4439638 100644 --- a/src/main/java/frc/robot/Controls.java +++ b/src/main/java/frc/robot/Controls.java @@ -11,7 +11,6 @@ import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType; import com.ctre.phoenix6.swerve.SwerveRequest; import edu.wpi.first.math.MathUtil; -import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import edu.wpi.first.wpilibj2.command.button.Trigger; import frc.robot.generated.AlphaTunerConstants; @@ -32,7 +31,8 @@ public class Controls { private final CommandXboxController driverController = new CommandXboxController(DRIVER_CONTROLLER_PORT); - private final CommandXboxController flywheelTestController = new CommandXboxController(FLYWHEEL_CONTROLLER_PORT); + private final CommandXboxController flywheelTestController = + new CommandXboxController(FLYWHEEL_CONTROLLER_PORT); public static final double MaxSpeed = AlphaTunerConstants.kSpeedAt12Volts.in(MetersPerSecond); @@ -45,6 +45,7 @@ public Controls(Subsystems subsystems) { s = subsystems; // Configure the trigger bindings configureBindings(); + configureFlywheelBindings(); } /** @@ -82,8 +83,10 @@ private double getDriveRotate() { double input = MathUtil.applyDeadband(-driverController.getRightX(), JOYSTICK_DEADBAND); return input * MaxSpeed; } + private void configureFlywheelBindings() { - driverController.rightTrigger().whileTrue(s.Flywheels.setVelocityCommand); + driverController.rightTrigger().whileTrue(s.flywheels.runFlywheels()); + } /* Setting up bindings for necessary control of the swerve drive platform */ private final SwerveRequest.FieldCentric drive = diff --git a/src/main/java/frc/robot/Flywheels.java b/src/main/java/frc/robot/Flywheels.java index f754253..a2992ce 100644 --- a/src/main/java/frc/robot/Flywheels.java +++ b/src/main/java/frc/robot/Flywheels.java @@ -13,8 +13,8 @@ import java.util.function.DoubleSupplier; public class Flywheels extends SubsystemBase { - private final TalonFX FlywheelOne; - private final TalonFX FlywheelTwo; + private final TalonFX flywheelOne; + private final TalonFX flywheelTwo; public static double speed = 1; // placeholder @@ -27,33 +27,32 @@ public class Flywheels extends SubsystemBase { double kS = 0.0; double kG = 0.0; - int SupplyCurrentLimit = 20; - int StatorCurrentLimit = 40; - boolean SupplyCurrentLimitEnable = true; - boolean StatorCurrentLimitEnable = true; - int MotionMagicAcceleration = 40; - + private static final int supplyCurrentLimit = 20; + private static final int statorCurrentLimit = 40; + private static final boolean supplyCurrentLimitEnable = true; + private static final boolean statorCurrentLimitEnable = true; + private static final int motionMagicAcceleration = 40; private final MotionMagicVelocityVoltage request = new MotionMagicVelocityVoltage(0); private final Follower follow = new Follower(Hardware.FLYWHEEL_ONE_ID, MotorAlignmentValue.Opposed); public final double FLYWHEEL_TOLERANCE = 5; // TODO: Tune tolerance as well public Flywheels() { - FlywheelOne = new TalonFX(Hardware.FLYWHEEL_ONE_ID); - FlywheelTwo = new TalonFX(Hardware.FLYWHEEL_TWO_ID); + flywheelOne = new TalonFX(Hardware.FLYWHEEL_ONE_ID); + flywheelTwo = new TalonFX(Hardware.FLYWHEEL_TWO_ID); configureMotors(); } private void configureMotors() { TalonFXConfiguration config = new TalonFXConfiguration(); - TalonFXConfigurator flConfigurator = FlywheelOne.getConfigurator(); + TalonFXConfigurator flConfigurator = flywheelOne.getConfigurator(); // TODO: tune configs and PIDS, currently placeholder - config.CurrentLimits.SupplyCurrentLimit = SupplyCurrentLimit; - config.CurrentLimits.StatorCurrentLimit = StatorCurrentLimit; - config.CurrentLimits.SupplyCurrentLimitEnable = SupplyCurrentLimitEnable; - config.CurrentLimits.StatorCurrentLimitEnable = StatorCurrentLimitEnable; + config.CurrentLimits.SupplyCurrentLimit = supplyCurrentLimit; + config.CurrentLimits.StatorCurrentLimit = statorCurrentLimit; + config.CurrentLimits.SupplyCurrentLimitEnable = supplyCurrentLimitEnable; + config.CurrentLimits.StatorCurrentLimitEnable = statorCurrentLimitEnable; config.MotorOutput.NeutralMode = NeutralModeValue.Coast; config.MotorOutput.Inverted = InvertedValue.Clockwise_Positive; @@ -66,54 +65,48 @@ private void configureMotors() { config.Slot0.kS = kS; config.Slot0.kG = kG; - config.MotionMagic.MotionMagicAcceleration = MotionMagicAcceleration; // RPS^2 + config.MotionMagic.MotionMagicAcceleration = motionMagicAcceleration; // RPS^2 flConfigurator.apply(config); } - public Command setFlywheelVelocity(double rps) { - return runEnd( + public Command runFlywheels() { + return startEnd( () -> { - request.Velocity = rps; - FlywheelOne.setControl(request); - FlywheelTwo.setControl(follow); + setFlywheelVelocity(speed); }, () -> { - FlywheelOne.stopMotor(); - FlywheelTwo.stopMotor(); + stopCommand(); }) - .withName("Set Velocity"); + .withName("Run flywheels"); } - public void setVelocityCommand() { - setFlywheelVelocity(speed); + + private void setFlywheelVelocity(double rps) { + request.Velocity = rps; + flywheelOne.setControl(request); + flywheelTwo.setControl(follow); } public Command suppliedSetVelocity(DoubleSupplier rps) { - return runEnd( + return startEnd( () -> { request.Velocity = rps.getAsDouble(); - FlywheelOne.setControl(request); - FlywheelTwo.setControl(follow); + flywheelOne.setControl(request); + flywheelTwo.setControl(follow); }, () -> { - FlywheelOne.stopMotor(); - FlywheelTwo.stopMotor(); + flywheelOne.stopMotor(); + flywheelTwo.stopMotor(); }) .withName("Supplied velocity command"); } - public void setVelocityRPS(double rps) { - request.Velocity = rps; - FlywheelOne.setControl(request); - FlywheelTwo.setControl(follow); + public boolean isAtSpeed() { + return Math.abs(flywheelOne.getVelocity().getValueAsDouble() - request.Velocity) + <= FLYWHEEL_TOLERANCE; } - public Command stopCommand() { - return runOnce( - () -> { - FlywheelOne.stopMotor(); - FlywheelTwo.stopMotor(); - }) - .withName("Stop motors command"); + private void stopCommand() { + flywheelOne.stopMotor(); } } diff --git a/src/main/java/frc/robot/Subsystems.java b/src/main/java/frc/robot/Subsystems.java index ea19ec3..16a1c7b 100644 --- a/src/main/java/frc/robot/Subsystems.java +++ b/src/main/java/frc/robot/Subsystems.java @@ -16,7 +16,7 @@ public static class SubsystemConstants { } public final CommandSwerveDrivetrain drivebaseSubsystem; - public final Flywheels Flywheels; + public final Flywheels flywheels; public Subsystems(Mechanism2d mechanism2d) { // Initialize subsystems here (don't forget to check if they're enabled!) @@ -37,10 +37,9 @@ public Subsystems(Mechanism2d mechanism2d) { drivebaseSubsystem = null; } if (FLYWHEELS_ENABLED) { - Flywheels = new Flywheels(); - } - else { - Flywheels = null; + flywheels = new Flywheels(); + } else { + flywheels = null; } } } From 8ce4ee1dfe9a12ab3227fe44e34d9310b8e212d5 Mon Sep 17 00:00:00 2001 From: cwkpete7383 Date: Thu, 24 Sep 2026 19:22:35 -0700 Subject: [PATCH 5/7] a --- src/main/java/frc/robot/Controls.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/frc/robot/Controls.java b/src/main/java/frc/robot/Controls.java index ca405c4..2183707 100644 --- a/src/main/java/frc/robot/Controls.java +++ b/src/main/java/frc/robot/Controls.java @@ -26,7 +26,6 @@ public class Controls { private static final int DRIVER_CONTROLLER_PORT = 0; private static final int TEST_CONTROLLER_PORT = 1; - private static final int FLYWHEEL_CONTROLLER_PORT = 2; private static final double JOYSTICK_DEADBAND = 0.1; private final Subsystems s; private static final double SWERVE_DEADBAND = 0.001; @@ -34,8 +33,6 @@ public class Controls { private final CommandXboxController driverController = new CommandXboxController(DRIVER_CONTROLLER_PORT); - private final CommandXboxController flywheelTestController = - new CommandXboxController(FLYWHEEL_CONTROLLER_PORT); private final CommandXboxController testController = new CommandXboxController(TEST_CONTROLLER_PORT); From ac002ce19fb6c9a6f9d05b440eb131f278561e52 Mon Sep 17 00:00:00 2001 From: cwkpete7383 Date: Thu, 24 Sep 2026 20:04:47 -0700 Subject: [PATCH 6/7] fix issues 2 --- src/main/java/frc/robot/Controls.java | 6 +++++- src/main/java/frc/robot/Flywheels.java | 9 +++------ src/main/java/frc/robot/Hardware.java | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/frc/robot/Controls.java b/src/main/java/frc/robot/Controls.java index 2183707..0835b9c 100644 --- a/src/main/java/frc/robot/Controls.java +++ b/src/main/java/frc/robot/Controls.java @@ -76,7 +76,11 @@ private double getDriveRotate() { } private void configureFlywheelBindings() { - driverController.rightTrigger().whileTrue(s.flywheels.runFlywheels()); + if (s.flywheels == null) { + return; + } else { + driverController.rightTrigger().whileTrue(s.flywheels.runFlywheels()); + } } /* Setting up bindings for necessary control of the swerve drive platform */ diff --git a/src/main/java/frc/robot/Flywheels.java b/src/main/java/frc/robot/Flywheels.java index 52b37ba..09ade98 100644 --- a/src/main/java/frc/robot/Flywheels.java +++ b/src/main/java/frc/robot/Flywheels.java @@ -1,9 +1,6 @@ package frc.robot; -import java.util.function.DoubleSupplier; - import com.ctre.phoenix6.configs.TalonFXConfiguration; -import com.ctre.phoenix6.configs.TalonFXConfigurator; import com.ctre.phoenix6.controls.Follower; import com.ctre.phoenix6.controls.MotionMagicVelocityVoltage; import com.ctre.phoenix6.hardware.TalonFX; @@ -12,6 +9,7 @@ import com.ctre.phoenix6.signals.NeutralModeValue; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.SubsystemBase; +import java.util.function.DoubleSupplier; public class Flywheels extends SubsystemBase { private final TalonFX flywheelOne; @@ -47,7 +45,7 @@ public Flywheels() { private void configureMotors() { TalonFXConfiguration config = new TalonFXConfiguration(); - + // TODO: tune configs and PIDS, currently placeholder config.CurrentLimits.SupplyCurrentLimit = supplyCurrentLimit; config.CurrentLimits.StatorCurrentLimit = statorCurrentLimit; @@ -96,8 +94,7 @@ public Command suppliedSetVelocity(DoubleSupplier rps) { flywheelTwo.setControl(follow); }, () -> { - flywheelOne.stopMotor(); - flywheelTwo.stopMotor(); + stopCommand(); }) .withName("Supplied velocity command"); } diff --git a/src/main/java/frc/robot/Hardware.java b/src/main/java/frc/robot/Hardware.java index 9e42dfd..472937d 100644 --- a/src/main/java/frc/robot/Hardware.java +++ b/src/main/java/frc/robot/Hardware.java @@ -8,6 +8,6 @@ public final class Hardware { public static final int PDH_ID = 1; // TODO: make this accurate to the actual robot - public static final int FLYWHEEL_ONE_ID = 2; - public static final int FLYWHEEL_TWO_ID = 3; + public static final int FLYWHEEL_ONE_ID = 13; + public static final int FLYWHEEL_TWO_ID = 14; } From 9e7a02ec117bc299671d4e7d7e18f4c7e1a5262d Mon Sep 17 00:00:00 2001 From: cwkpete7383 Date: Thu, 24 Sep 2026 20:09:24 -0700 Subject: [PATCH 7/7] spotless applied --- src/main/java/frc/robot/Subsystems.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/Subsystems.java b/src/main/java/frc/robot/Subsystems.java index 7fbd373..728a4aa 100644 --- a/src/main/java/frc/robot/Subsystems.java +++ b/src/main/java/frc/robot/Subsystems.java @@ -1,8 +1,8 @@ package frc.robot; import static frc.robot.Subsystems.SubsystemConstants.DRIVEBASE_ENABLED; -import static frc.robot.Subsystems.SubsystemConstants.INTAKE_ENABLED; import static frc.robot.Subsystems.SubsystemConstants.FLYWHEELS_ENABLED; +import static frc.robot.Subsystems.SubsystemConstants.INTAKE_ENABLED; import edu.wpi.first.wpilibj.smartdashboard.Mechanism2d; import frc.robot.generated.AlphaTunerConstants;