Skip to content

Commit

Permalink
Merge branch 'main' into heading-snapping
Browse files Browse the repository at this point in the history
  • Loading branch information
willitcode authored Mar 21, 2024
2 parents 81f71f5 + 834f888 commit 2a13bd7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/frc/robot/commands/RunIntake.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public void execute() {}
@Override
public void end(boolean interrupted) {
intake.stop();
if (!interrupted) {
intake.reportNoteIsInIntake();
}
}

// Returns true when the command should end.
Expand Down
1 change: 1 addition & 0 deletions src/main/java/frc/robot/commands/RunIntakeReverse.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void execute() {}
@Override
public void end(boolean interrupted) {
intake.stop();
intake.reportNoteIsNotInIntake();
}

// Returns true when the command should end.
Expand Down
1 change: 1 addition & 0 deletions src/main/java/frc/robot/commands/mailbox/DeindexNote.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public void execute() {
@Override
public void end(boolean interrupted) {
intake.stop();
intake.reportNoteIsNotInIntake();
}

// Returns true when the command should end.
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/frc/robot/subsystems/Intake.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
import com.revrobotics.CANSparkBase.IdleMode;
import com.revrobotics.CANSparkLowLevel.MotorType;
import com.revrobotics.CANSparkMax;
import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;

Expand All @@ -24,6 +26,7 @@ public class Intake extends SubsystemBase {
private CANSparkMax intakeLower;
private CANSparkMax intakeUpper;
private DigitalInput limitSwitch;
private GenericEntry noteIsInIntake;

/** Creates a new Intake. */
public Intake() {
Expand All @@ -47,6 +50,8 @@ public Intake() {

intakeLower.burnFlash();
intakeUpper.burnFlash();

Shuffleboard.getTab("Driver").add("Note in intake", false).getEntry();
}

/** Runs the intake motors. */
Expand All @@ -69,6 +74,16 @@ public boolean getLimitSwitch() {
return !limitSwitch.get();
}

/** Tells drivers the intake is full */
public void reportNoteIsInIntake() {
noteIsInIntake.setBoolean(true);
}

/** Tells drivers the intake is empty */
public void reportNoteIsNotInIntake() {
noteIsInIntake.setBoolean(false);
}

/** Stops the intake motors. */
public void stop() {
intakeUpper.set(0);
Expand Down

0 comments on commit 2a13bd7

Please sign in to comment.