Skip to content

Commit

Permalink
shuffleboard entry
Browse files Browse the repository at this point in the history
  • Loading branch information
AvidCoder27 committed Sep 11, 2024
1 parent 7f93381 commit 94f3f61
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/java/frc/team5115/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public void robotPeriodic() {
// This must be called from the robot's periodic block in order for anything in
// the Command-based framework to work.
CommandScheduler.getInstance().run();
robotContainer.robotPeriodic();
}

/** This function is called once when the robot is disabled. */
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/frc/team5115/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.pathplanner.lib.auto.NamedCommands;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.networktables.GenericEntry;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Command.InterruptionBehavior;
import edu.wpi.first.wpilibj2.command.Commands;
Expand Down Expand Up @@ -62,6 +64,9 @@ public class RobotContainer {
// Dashboard inputs
private final LoggedDashboardChooser<Command> autoChooser;

// Shuffleboard
private final GenericEntry noteDetectedEntry;

/** The container for the robot. Contains subsystems, OI devices, and commands. */
public RobotContainer() {
switch (Constants.currentMode) {
Expand All @@ -82,6 +87,8 @@ public RobotContainer() {
new ModuleIOSparkMax(3));
// vision = new PhotonVision(drivetrain);
vision = null;
noteDetectedEntry =
Shuffleboard.getTab("SmartDashboard").add("Has note?", false).getEntry();
break;

case SIM:
Expand All @@ -96,6 +103,7 @@ public RobotContainer() {
new Drivetrain(
gyro, new ModuleIOSim(), new ModuleIOSim(), new ModuleIOSim(), new ModuleIOSim());
vision = null;
noteDetectedEntry = null;
break;

default:
Expand All @@ -110,6 +118,7 @@ public RobotContainer() {
new Drivetrain(
gyro, new ModuleIO() {}, new ModuleIO() {}, new ModuleIO() {}, new ModuleIO() {});
vision = null;
noteDetectedEntry = null;
break;
}

Expand Down Expand Up @@ -187,6 +196,12 @@ private void configureButtonBindings() {
.onFalse(DriveCommands.triggerAmp(arm, amper, intake, feeder));
}

public void robotPeriodic() {
if (noteDetectedEntry != null) {
noteDetectedEntry.setBoolean(feeder.noteDetected());
}
}

/**
* Registers commands for pathplanner to use in autos
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/team5115/commands/DriveCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static Command feed(Intake intake, Feeder feeder) {
return Commands.sequence(
feeder.setSpeeds(+1),
intake.setSpeed(+1),
Commands.waitSeconds(0.5),
Commands.waitSeconds(1),
feeder.stop(),
intake.stop());
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/frc/team5115/subsystems/feeder/Feeder.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ public void forceStop() {
io.setLeftPercent(0);
io.setRightPercent(0);
}

public boolean noteDetected() {
return inputs.noteDetected;
}
}

0 comments on commit 94f3f61

Please sign in to comment.