diff --git a/src/main/java/org/wildstang/year2023/robot/CANConstants.java b/src/main/java/org/wildstang/year2023/robot/CANConstants.java index 6dbf8c98..ae6f20b5 100644 --- a/src/main/java/org/wildstang/year2023/robot/CANConstants.java +++ b/src/main/java/org/wildstang/year2023/robot/CANConstants.java @@ -1,5 +1,7 @@ package org.wildstang.year2023.robot; +import edu.wpi.first.wpilibj.PneumaticsModuleType; + /** * CAN Constants are stored here. * We primarily use CAN to communicate with Talon motor controllers. @@ -30,6 +32,8 @@ public final class CANConstants { public static final int ANGLE3 = 16; public static final int DRIVE4 = 17; public static final int ANGLE4 = 18; + public static final int INTAKE1 = 0; + } \ No newline at end of file diff --git a/src/main/java/org/wildstang/year2023/robot/WSInputs.java b/src/main/java/org/wildstang/year2023/robot/WSInputs.java index b5ccb94b..fecdc034 100644 --- a/src/main/java/org/wildstang/year2023/robot/WSInputs.java +++ b/src/main/java/org/wildstang/year2023/robot/WSInputs.java @@ -104,7 +104,7 @@ public enum WSInputs implements Inputs { // --------------------------------- // Manipulator DPAD Buttons // --------------------------------- - MANIPULATOR_DPAD_DOWN ("Manipulator dpad down", new WsDPadButtonInputConfig(1, JoystickConstants.DPAD_Y_DOWN)), + MANIPULATOR_DPAD_DOWN ("Toggle deploy and rev intake", new WsDPadButtonInputConfig(1, JoystickConstants.DPAD_Y_DOWN)), MANIPULATOR_DPAD_LEFT ("Manipulator dpad left", new WsDPadButtonInputConfig(1, JoystickConstants.DPAD_X_LEFT)), MANIPULATOR_DPAD_RIGHT ("Manipulator dpad right", new WsDPadButtonInputConfig(1, JoystickConstants.DPAD_X_RIGHT)), MANIPULATOR_DPAD_UP ("Manipulator dpad up", new WsDPadButtonInputConfig(1, JoystickConstants.DPAD_Y_UP)), diff --git a/src/main/java/org/wildstang/year2023/robot/WSOutputs.java b/src/main/java/org/wildstang/year2023/robot/WSOutputs.java index ae05c776..f50dad1f 100644 --- a/src/main/java/org/wildstang/year2023/robot/WSOutputs.java +++ b/src/main/java/org/wildstang/year2023/robot/WSOutputs.java @@ -41,7 +41,7 @@ public enum WSOutputs implements Outputs { ANGLE3("Module 3 Angle Motor", new WsSparkMaxConfig(CANConstants.ANGLE3, true)), DRIVE4("Module 4 Drive Motor", new WsSparkMaxConfig(CANConstants.DRIVE4, true)), ANGLE4("Module 4 Angle Motor", new WsSparkMaxConfig(CANConstants.ANGLE4, true)), - + INTAKE1("Intake 1 Motor", new WsSparkMaxConfig(CANConstants.INTAKE1, true)), // --------------------------------- // Servos @@ -57,6 +57,9 @@ public enum WSOutputs implements Outputs { // Solenoids // ******************************** TEST_SOLENOID("Test Solenoid", new WsSolenoidConfig(PneumaticsModuleType.REVPH, 0, false)), + + DEPLOYABLE1("Deployable 1 Solenoid", new WsSolenoidConfig(PneumaticsModuleType.REVPH, 0, false)), + DEPLOYABLE2("Deployable 2 Solenoid", new WsSolenoidConfig(PneumaticsModuleType.REVPH, 0, false)), // ******************************** // Relays diff --git a/src/main/java/org/wildstang/year2023/robot/WSSubsystems.java b/src/main/java/org/wildstang/year2023/robot/WSSubsystems.java index 8c9f3ec4..e93385bc 100644 --- a/src/main/java/org/wildstang/year2023/robot/WSSubsystems.java +++ b/src/main/java/org/wildstang/year2023/robot/WSSubsystems.java @@ -2,6 +2,7 @@ import org.wildstang.framework.core.Subsystems; import org.wildstang.year2023.subsystems.SampleSubsystem; +import org.wildstang.year2023.subsystems.Intake.Intake; import org.wildstang.year2023.subsystems.swerve.SwerveDrive; import org.wildstang.year2023.subsystems.targeting.AimHelper; @@ -13,6 +14,7 @@ public enum WSSubsystems implements Subsystems { // enumerate subsystems SWERVE_DRIVE("Swerve Drive", SwerveDrive.class), + INTAKE("Intake", Intake.class), //AIM_HELPER("Aim Helper", AimHelper.class), //SAMPLE("Sample", SampleSubsystem.class) ; diff --git a/src/main/java/org/wildstang/year2023/subsystems/Intake/Intake.java b/src/main/java/org/wildstang/year2023/subsystems/Intake/Intake.java new file mode 100644 index 00000000..f806cae5 --- /dev/null +++ b/src/main/java/org/wildstang/year2023/subsystems/Intake/Intake.java @@ -0,0 +1,104 @@ +package org.wildstang.year2023.subsystems.Intake; + +import org.wildstang.framework.io.inputs.Input; +import org.wildstang.framework.subsystems.Subsystem; +import org.wildstang.hardware.roborio.inputs.WsJoystickButton; +import org.wildstang.hardware.roborio.outputs.WsSolenoid; +import org.wildstang.hardware.roborio.outputs.WsSparkMax; +import org.wildstang.year2023.robot.WSInputs; +import org.wildstang.year2023.robot.WSOutputs; + +public class Intake implements Subsystem { + + private WsSparkMax intake1; + private WsJoystickButton deployRevIntake; + private WsJoystickButton backwards; + + private WsSolenoid deployable1; + private WsSolenoid deployable2; + + //All variables used + private boolean intakeCall; + private boolean backCall; + + + + + @Override + public void inputUpdate(Input source) { + // TODO Auto-generated method stub + + if (source == deployRevIntake){ + intakeCall = !(intakeCall); + + } + + if (source == backwards){ + backCall = !(backCall); + } + } + + @Override + public void init() { + // TODO Auto-generated method stub + intake1 = (WsSparkMax) WSOutputs.INTAKE1.get(); + + deployRevIntake = (WsJoystickButton) WSInputs.MANIPULATOR_DPAD_DOWN.get(); + deployRevIntake.addInputListener(this); + backwards = (WsJoystickButton) WSInputs.MANIPULATOR_DPAD_UP.get(); + + deployable1 = (WsSolenoid) WSOutputs.DEPLOYABLE1.get(); + deployable2 = (WsSolenoid) WSOutputs.DEPLOYABLE2.get(); + + intakeCall = false; + backCall = false; + + + } + + @Override + public void selfTest() { + // TODO Auto-generated method stub + + } + + @Override + public void update() { + // TODO Auto-generated method stub + if (intakeCall){ + intake1.setValue(1); + deployable1.setValue(true); + deployable2.setValue(true); + } else { + intake1.setValue(0); + deployable1.setValue(false); + deployable2.setValue(false); + } + + if (backCall){ + intake1.setValue(-1); + deployable1.setValue(true); + deployable2.setValue(true); + } else { + intake1.setValue(0); + deployable1.setValue(false); + deployable2.setValue(false); + } + } + + @Override + public void resetState() { + // TODO Auto-generated method stub + intakeCall = false; + + } + + @Override + public String getName() { + // TODO Auto-generated method stub + return "Intake"; + } + + + +}