diff --git a/networktables.json b/networktables.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/networktables.json @@ -0,0 +1 @@ +[] diff --git a/simgui-ds.json b/simgui-ds.json new file mode 100644 index 00000000..c4b7efd3 --- /dev/null +++ b/simgui-ds.json @@ -0,0 +1,98 @@ +{ + "keyboardJoysticks": [ + { + "axisConfig": [ + { + "decKey": 65, + "incKey": 68 + }, + { + "decKey": 87, + "incKey": 83 + }, + { + "decKey": 69, + "decayRate": 0.0, + "incKey": 82, + "keyRate": 0.009999999776482582 + } + ], + "axisCount": 3, + "buttonCount": 4, + "buttonKeys": [ + 90, + 88, + 67, + 86 + ], + "povConfig": [ + { + "key0": 328, + "key135": 323, + "key180": 322, + "key225": 321, + "key270": 324, + "key315": 327, + "key45": 329, + "key90": 326 + } + ], + "povCount": 1 + }, + { + "axisConfig": [ + { + "decKey": 74, + "incKey": 76 + }, + { + "decKey": 73, + "incKey": 75 + } + ], + "axisCount": 2, + "buttonCount": 4, + "buttonKeys": [ + 77, + 44, + 46, + 47 + ], + "povCount": 0 + }, + { + "axisConfig": [ + { + "decKey": 263, + "incKey": 262 + }, + { + "decKey": 265, + "incKey": 264 + } + ], + "axisCount": 2, + "buttonCount": 6, + "buttonKeys": [ + 260, + 268, + 266, + 261, + 269, + 267 + ], + "povCount": 0 + }, + { + "axisCount": 0, + "buttonCount": 0, + "povCount": 0 + } + ], + "robotJoysticks": [ + { + "guid": "78696e70757401000000000000000000", + "useGamepad": true + } + ] +} diff --git a/simgui.json b/simgui.json new file mode 100644 index 00000000..b9565548 --- /dev/null +++ b/simgui.json @@ -0,0 +1,23 @@ +{ + "NTProvider": { + "types": { + "/FMSInfo": "FMSInfo" + } + }, + "NetworkTables": { + "transitory": { + "AdvantageKit": { + "Intake": { + "open": true + }, + "open": true + } + } + }, + "NetworkTables Info": { + "Connections": { + "open": true + }, + "visible": true + } +} diff --git a/src/main/java/frc/robot/commands/IntakeBaseCommand.java b/src/main/java/frc/robot/commands/IntakeBaseCommand.java index 7eee32ba..c3330e82 100644 --- a/src/main/java/frc/robot/commands/IntakeBaseCommand.java +++ b/src/main/java/frc/robot/commands/IntakeBaseCommand.java @@ -1,20 +1,38 @@ package frc.robot.commands; +import java.util.Map; import java.util.function.BooleanSupplier; +import edu.wpi.first.networktables.GenericEntry; +import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets; +import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; +import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.subsystems.intake.IntakeBase; public class IntakeBaseCommand extends Command { IntakeBase intake; BooleanSupplier inEnable; - BooleanSupplier outEnable; + GenericEntry voltsEntry; + ShuffleboardTab tab; + BooleanSupplier outEnable; + public IntakeBaseCommand(IntakeBase intake, BooleanSupplier inEnable, BooleanSupplier outEnable) { this.intake = intake; this.inEnable = inEnable; - this.outEnable = inEnable; + this.outEnable = outEnable; addRequirements(intake); + tab = Shuffleboard.getTab("Intake"); + // Create volt entry under Shooter tab as a number sider with min = -1 and max = 1 + voltsEntry = + tab.add("Volts", 0) + .withWidget(BuiltInWidgets.kNumberSlider) + .withProperties(Map.of("min", 0, "max", 12)) + .getEntry(); + voltsEntry.setValue(0.0); + + } @Override public void initialize() { @@ -24,6 +42,7 @@ public void initialize() { @Override public void execute() { + // Turns off motors if No/All bumpers if (inEnable.getAsBoolean() == true && outEnable.getAsBoolean() == true) { // Disable the intake motors @@ -33,13 +52,13 @@ public void execute() { intake.disable(); //System.out.println(outEnable.getAsBoolean()); } else if (inEnable.getAsBoolean() == true) { // Motors on (IN) if right bumper pressed - intake.setVoltage(1); + intake.setVoltage(voltsEntry.getDouble(0.0)); System.out.println(outEnable.getAsBoolean()); // Enable motors, It has to be called regularly for voltage compensation to work properly intake.enable(); } else if (outEnable.getAsBoolean()== true) { // Motors on (Out) if right bumper pressed - intake.setVoltage(-1); + intake.setVoltage(voltsEntry.getDouble(0.0) * -1); System.out.println(outEnable.getAsBoolean()); // Enable motors, It has to be called regularly for voltage compensation to work properly intake.enable(); diff --git a/src/main/java/frc/robot/subsystems/intake/IntakeBase.java b/src/main/java/frc/robot/subsystems/intake/IntakeBase.java index d21a8acb..0b6e0ca6 100644 --- a/src/main/java/frc/robot/subsystems/intake/IntakeBase.java +++ b/src/main/java/frc/robot/subsystems/intake/IntakeBase.java @@ -18,13 +18,16 @@ public IntakeBase(IntakeIO IO) { } @Override + //disable the intake public void disable() { voltage = 0; IO.setVoltage(voltage); } @Override + //Enabling the intake public void enable() { + //voltage = 1; IO.setVoltage(voltage); }