Skip to content

Commit

Permalink
finished intake interface and shuffleboard
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterBiscuit committed Jan 20, 2024
1 parent cc7ff4a commit 2c3fe50
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 4 deletions.
1 change: 1 addition & 0 deletions networktables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
98 changes: 98 additions & 0 deletions simgui-ds.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
23 changes: 23 additions & 0 deletions simgui.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"NTProvider": {
"types": {
"/FMSInfo": "FMSInfo"
}
},
"NetworkTables": {
"transitory": {
"AdvantageKit": {
"Intake": {
"open": true
},
"open": true
}
}
},
"NetworkTables Info": {
"Connections": {
"open": true
},
"visible": true
}
}
27 changes: 23 additions & 4 deletions src/main/java/frc/robot/commands/IntakeBaseCommand.java
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -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
Expand All @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/frc/robot/subsystems/intake/IntakeBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 2c3fe50

Please sign in to comment.