From d52ae437a127397a1af7453b2068f8cc750a0145 Mon Sep 17 00:00:00 2001 From: Stephen Just Date: Sat, 28 Mar 2026 12:17:34 -0700 Subject: [PATCH 1/3] Pulse hopper roller during shooting --- .../RunCollectorHopperFeederCommandGroup.java | 2 +- .../OperatorCommandMap.java | 2 +- .../hopper_roller/HopperRollerSubsystem.java | 21 +++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/main/java/competition/command_groups/RunCollectorHopperFeederCommandGroup.java b/src/main/java/competition/command_groups/RunCollectorHopperFeederCommandGroup.java index 5740c8de..1fea42fc 100644 --- a/src/main/java/competition/command_groups/RunCollectorHopperFeederCommandGroup.java +++ b/src/main/java/competition/command_groups/RunCollectorHopperFeederCommandGroup.java @@ -14,7 +14,7 @@ public RunCollectorHopperFeederCommandGroup(HopperRollerSubsystem hopper, CollectorIntakeCommand collectorIntakeCommand, ShooterFeederFire shooterFeederFireCommand ) { - var hopperIntakeCommand = hopper.getIntakeCommand(); + var hopperIntakeCommand = hopper.getIntakePulseCommand(); this.addCommands( hopperIntakeCommand.alongWith(collectorIntakeCommand).alongWith(shooterFeederFireCommand) ); diff --git a/src/main/java/competition/operator_interface/OperatorCommandMap.java b/src/main/java/competition/operator_interface/OperatorCommandMap.java index b205a91b..eaa2a6c7 100644 --- a/src/main/java/competition/operator_interface/OperatorCommandMap.java +++ b/src/main/java/competition/operator_interface/OperatorCommandMap.java @@ -169,7 +169,7 @@ public void setupDebugGamepad(OperatorInterface operatorInterface, operatorInterface.setupDebugGamepad.getifAvailable(XXboxController.XboxButton.LeftStick) .whileTrue(hopperRollerSubsystem.getEjectCommand()); operatorInterface.setupDebugGamepad.getifAvailable(XXboxController.XboxButton.RightStick) - .whileTrue(hopperRollerSubsystem.getIntakeCommand()); + .whileTrue(hopperRollerSubsystem.getIntakePulseCommand()); operatorInterface.setupDebugGamepad.getPovIfAvailable(90).whileTrue(collectorEjectCommand); operatorInterface.setupDebugGamepad.getPovIfAvailable(270).whileTrue(shooterFeederFire); } diff --git a/src/main/java/competition/subsystems/hopper_roller/HopperRollerSubsystem.java b/src/main/java/competition/subsystems/hopper_roller/HopperRollerSubsystem.java index a991234a..495efe42 100644 --- a/src/main/java/competition/subsystems/hopper_roller/HopperRollerSubsystem.java +++ b/src/main/java/competition/subsystems/hopper_roller/HopperRollerSubsystem.java @@ -1,7 +1,9 @@ package competition.subsystems.hopper_roller; import competition.electrical_contract.ElectricalContract; +import edu.wpi.first.units.measure.AngularVelocity; import edu.wpi.first.wpilibj2.command.Command; +import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; import xbot.common.command.BaseSubsystem; import xbot.common.command.NamedRunCommand; import xbot.common.controls.actuators.XCANMotorController; @@ -26,10 +28,12 @@ public class HopperRollerSubsystem extends BaseSubsystem { final DoubleProperty collectPower; final DoubleProperty intakePower; final AngularVelocityProperty intakeVelocity; + final AngularVelocityProperty intakePulseVelocity; final AngularVelocityProperty collectVelocity; final AngularVelocityProperty ejectVelocity; final BooleanProperty useVelocityControl; final DoubleProperty voltageRampTime; + final DoubleProperty intakePulseDuration; @Inject public HopperRollerSubsystem(ElectricalContract electricalContract, @@ -67,8 +71,10 @@ public HopperRollerSubsystem(ElectricalContract electricalContract, useVelocityControl = pf.createPersistentProperty("Use Velocity Control", true); intakeVelocity = pf.createPersistentProperty("Intake Velocity", RPM.of(3000)); + intakePulseVelocity = pf.createPersistentProperty("Intake Pulse Velocity", RPM.of(3200)); collectVelocity = pf.createPersistentProperty("Collect Velocity", RPM.of(3000)); ejectVelocity = pf.createPersistentProperty("Eject Velocity", RPM.of(-3000)); + intakePulseDuration = pf.createPersistentProperty("Intake Pulse Duration Seconds", 0.5); if (hopperRollerMotor != null) { hopperRollerMotor.setClosedLoopRampRates( @@ -78,6 +84,13 @@ public HopperRollerSubsystem(ElectricalContract electricalContract, } } + public void setVelocityTarget(AngularVelocity velocity) { + if (hopperRollerMotor == null) { + return; + } + hopperRollerMotor.setVelocityTarget(velocity); + } + public void setEjectPower() { if (hopperRollerMotor == null) { return; @@ -149,4 +162,12 @@ public Command getStopCommand() { } public Command getCollectCommand() {return new NamedRunCommand(getName() + "-collect", this::setCollectPower, this);} + + public Command getIntakePulseCommand() { + var commandGroup = new SequentialCommandGroup(); + commandGroup.setName(getName() + "-intake-pulse"); + commandGroup.addCommands(new NamedRunCommand(getName() + "-intake-pulse-low", () -> setVelocityTarget(intakeVelocity.get()), this).withTimeout(intakePulseDuration.get())); + commandGroup.addCommands(new NamedRunCommand(getName() + "-intake-pulse-high", () -> setVelocityTarget(intakePulseVelocity.get()), this).withTimeout(intakePulseDuration.get())); + return commandGroup.repeatedly(); + } } From eff4e8aa13c00e5ded2fcedc8ef55ad53763c907 Mon Sep 17 00:00:00 2001 From: Stephen Just Date: Sat, 28 Mar 2026 15:51:31 -0700 Subject: [PATCH 2/3] Formatting --- .../hopper_roller/HopperRollerSubsystem.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/competition/subsystems/hopper_roller/HopperRollerSubsystem.java b/src/main/java/competition/subsystems/hopper_roller/HopperRollerSubsystem.java index 495efe42..af36939b 100644 --- a/src/main/java/competition/subsystems/hopper_roller/HopperRollerSubsystem.java +++ b/src/main/java/competition/subsystems/hopper_roller/HopperRollerSubsystem.java @@ -166,8 +166,14 @@ public Command getStopCommand() { public Command getIntakePulseCommand() { var commandGroup = new SequentialCommandGroup(); commandGroup.setName(getName() + "-intake-pulse"); - commandGroup.addCommands(new NamedRunCommand(getName() + "-intake-pulse-low", () -> setVelocityTarget(intakeVelocity.get()), this).withTimeout(intakePulseDuration.get())); - commandGroup.addCommands(new NamedRunCommand(getName() + "-intake-pulse-high", () -> setVelocityTarget(intakePulseVelocity.get()), this).withTimeout(intakePulseDuration.get())); + commandGroup.addCommands( + new NamedRunCommand( + getName() + "-intake-pulse-low", + () -> setVelocityTarget(intakeVelocity.get()), this).withTimeout(intakePulseDuration.get())); + commandGroup.addCommands( + new NamedRunCommand( + getName() + "-intake-pulse-high", + () -> setVelocityTarget(intakePulseVelocity.get()), this).withTimeout(intakePulseDuration.get())); return commandGroup.repeatedly(); } } From 0cac40dffb5a96bc9f681567ddd4bc1dd9cfa3b2 Mon Sep 17 00:00:00 2001 From: Stephen Just Date: Sat, 28 Mar 2026 16:29:38 -0700 Subject: [PATCH 3/3] Add separate property for pulse time --- .../subsystems/hopper_roller/HopperRollerSubsystem.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/competition/subsystems/hopper_roller/HopperRollerSubsystem.java b/src/main/java/competition/subsystems/hopper_roller/HopperRollerSubsystem.java index af36939b..020da603 100644 --- a/src/main/java/competition/subsystems/hopper_roller/HopperRollerSubsystem.java +++ b/src/main/java/competition/subsystems/hopper_roller/HopperRollerSubsystem.java @@ -34,6 +34,7 @@ public class HopperRollerSubsystem extends BaseSubsystem { final BooleanProperty useVelocityControl; final DoubleProperty voltageRampTime; final DoubleProperty intakePulseDuration; + final DoubleProperty intakePulseHighDuration; @Inject public HopperRollerSubsystem(ElectricalContract electricalContract, @@ -75,6 +76,7 @@ public HopperRollerSubsystem(ElectricalContract electricalContract, collectVelocity = pf.createPersistentProperty("Collect Velocity", RPM.of(3000)); ejectVelocity = pf.createPersistentProperty("Eject Velocity", RPM.of(-3000)); intakePulseDuration = pf.createPersistentProperty("Intake Pulse Duration Seconds", 0.5); + intakePulseHighDuration = pf.createPersistentProperty("Intake Pulse High Duration Seconds", 0.5); if (hopperRollerMotor != null) { hopperRollerMotor.setClosedLoopRampRates( @@ -173,7 +175,7 @@ public Command getIntakePulseCommand() { commandGroup.addCommands( new NamedRunCommand( getName() + "-intake-pulse-high", - () -> setVelocityTarget(intakePulseVelocity.get()), this).withTimeout(intakePulseDuration.get())); + () -> setVelocityTarget(intakePulseVelocity.get()), this).withTimeout(intakePulseHighDuration.get())); return commandGroup.repeatedly(); } }