Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -26,10 +28,13 @@ 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;
final DoubleProperty intakePulseHighDuration;

@Inject
public HopperRollerSubsystem(ElectricalContract electricalContract,
Expand Down Expand Up @@ -67,8 +72,11 @@ 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));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Probably too late to change this but we shoulddd probably rename this to intakePulseHighVelocity just to sync its name with the duration properties

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(
Expand All @@ -78,6 +86,13 @@ public HopperRollerSubsystem(ElectricalContract electricalContract,
}
}

public void setVelocityTarget(AngularVelocity velocity) {
if (hopperRollerMotor == null) {
return;
}
hopperRollerMotor.setVelocityTarget(velocity);
}
Comment on lines +89 to +94
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setVelocityTarget(...) is introduced as a public method, but it appears to only be used internally by HopperRollerSubsystem (no other references found). Making it private (or at least package-private) would reduce the subsystem's public surface area and help avoid bypassing the intended control-mode API (setIntakePower, etc.).

Copilot uses AI. Check for mistakes.

public void setEjectPower() {
if (hopperRollerMotor == null) {
return;
Expand Down Expand Up @@ -149,4 +164,18 @@ 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(intakePulseHighDuration.get()));
return commandGroup.repeatedly();
}
}
Loading