Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
Implement note shuffling using sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahsnider committed Apr 7, 2024
1 parent b5dc0ae commit 8f2e3ec
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/main/java/frc/robot/queuer/QueuerSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
import org.littletonrobotics.junction.Logger;

public class QueuerSubsystem extends LifecycleSubsystem {
private static final double NOTE_SHUFFLE_DURATION = 0.5;
private final TalonFX motor;
private final DigitalInput sensor;
private QueuerState goalState = QueuerState.IDLE;
private final Debouncer debouncer = RobotConfig.get().queuer().debouncer();
private boolean debouncedSensor = false;
private final Timer shuffleTimer = new Timer();

public QueuerSubsystem(TalonFX motor, DigitalInput sensor) {
super(SubsystemPriority.QUEUER);
Expand Down Expand Up @@ -48,16 +46,8 @@ public void enabledPeriodic() {
break;
case SHUFFLE:
if (sensorHasNote()) {
if (shuffleTimer.hasElapsed(NOTE_SHUFFLE_DURATION)) {
if (shuffleTimer.hasElapsed(NOTE_SHUFFLE_DURATION * 2)) {
// Allow note to expand
motor.disable();
shuffleTimer.reset();
} else {
// Push note towards intake
motor.setVoltage(-2);
}
}
// We have the note, try pushing it towards intake to shuffle it around
motor.setVoltage(-1);
} else {
// Note is out of sensor range, try intaking it
motor.setVoltage(1);
Expand Down

0 comments on commit 8f2e3ec

Please sign in to comment.