From 73827e40a59069fd1845b6b47e90ef8e026e8179 Mon Sep 17 00:00:00 2001 From: ARMS300 <90659881+ARMS300@users.noreply.github.com> Date: Thu, 26 Jan 2023 17:39:50 -0600 Subject: [PATCH 1/5] Create tankDrive.java --- .../year2023/subsystems/tankDrive.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/main/java/org/wildstang/year2023/subsystems/tankDrive.java diff --git a/src/main/java/org/wildstang/year2023/subsystems/tankDrive.java b/src/main/java/org/wildstang/year2023/subsystems/tankDrive.java new file mode 100644 index 00000000..ae391333 --- /dev/null +++ b/src/main/java/org/wildstang/year2023/subsystems/tankDrive.java @@ -0,0 +1,59 @@ +package org.wildstang.year2023.subsystems; + +import org.wildstang.framework.io.inputs.Input; +import org.wildstang.framework.subsystems.Subsystem; +import org.wildstang.hardware.roborio.inputs.WsJoystickAxis; +//import org.wildstang.hardware.roborio.outputs.WsPhoenix; +import org.wildstang.year2023.robot.WSInputs; +import org.wildstang.year2023.robot.WSOutputs; + +/** + * Sample Subsystem that controls a motor with a joystick. + * @author Liam + */ +public class tankDrive implements Subsystem { + // inputs + WsJoystickAxis joystick; + + // outputs + //WsPhoenix motor; + + // states + double speed; + + + @Override + public void init() { + joystick = (WsJoystickAxis) WSInputs.DRIVER_LEFT_JOYSTICK_Y.get(); + + //motor = (WsPhoenix) WSOutputs.TEST_MOTOR.get(); + + speed = 0; + } + + @Override + public void resetState() { + speed = 0; + } + + @Override + public void update() { + //motor.setValue(speed); + } + + @Override + public void inputUpdate(Input source) { + if (source == joystick) { + speed = joystick.getValue(); + } + } + + @Override + public String getName() { + return "Sample"; + } + + @Override + public void selfTest() { + } +} \ No newline at end of file From 15729f461b2225a753129f85afd3760c1ee6e8be Mon Sep 17 00:00:00 2001 From: ARMS300 <90659881+ARMS300@users.noreply.github.com> Date: Wed, 1 Feb 2023 18:11:09 -0600 Subject: [PATCH 2/5] Code to toggle the Deployable Intake --- .../year2023/robot/CANConstants.java | 4 + .../wildstang/year2023/robot/WSInputs.java | 2 +- .../wildstang/year2023/robot/WSOutputs.java | 5 +- .../subsystems/Intake/Deployable.java | 83 +++++++++++++++++++ 4 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/wildstang/year2023/subsystems/Intake/Deployable.java 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/subsystems/Intake/Deployable.java b/src/main/java/org/wildstang/year2023/subsystems/Intake/Deployable.java new file mode 100644 index 00000000..dd765af6 --- /dev/null +++ b/src/main/java/org/wildstang/year2023/subsystems/Intake/Deployable.java @@ -0,0 +1,83 @@ +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 Deployable implements Subsystem { + + private WsSparkMax intake1; + private WsJoystickButton deployRevIntake; + private WsSolenoid deployable1; + private WsSolenoid deployable2; + + //All variables used + private boolean intakeCall; + + + + @Override + public void inputUpdate(Input source) { + // TODO Auto-generated method stub + + if (source == deployRevIntake){ + intakeCall = !(intakeCall); + + } + } + + @Override + public void init() { + // TODO Auto-generated method stub + intake1 = (WsSparkMax) WSOutputs.INTAKE1.get(); + + deployRevIntake = (WsJoystickButton) WSInputs.MANIPULATOR_DPAD_DOWN.get(); + deployRevIntake.addInputListener(this); + + deployable1 = (WsSolenoid) WSOutputs.DEPLOYABLE1.get(); + deployable2 = (WsSolenoid) WSOutputs.DEPLOYABLE2.get(); + + intakeCall = 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); + } + } + + @Override + public void resetState() { + // TODO Auto-generated method stub + intakeCall = false; + + } + + @Override + public String getName() { + // TODO Auto-generated method stub + return "Deployable"; + } + + + +} From 3de70b4fe3f692de3a89530044c1a3bbf46eb31c Mon Sep 17 00:00:00 2001 From: Liam Fruzyna Date: Wed, 1 Feb 2023 18:41:03 -0600 Subject: [PATCH 3/5] Revert "Create tankDrive.java" This reverts commit 73827e40a59069fd1845b6b47e90ef8e026e8179. --- .../year2023/subsystems/tankDrive.java | 59 ------------------- 1 file changed, 59 deletions(-) delete mode 100644 src/main/java/org/wildstang/year2023/subsystems/tankDrive.java diff --git a/src/main/java/org/wildstang/year2023/subsystems/tankDrive.java b/src/main/java/org/wildstang/year2023/subsystems/tankDrive.java deleted file mode 100644 index ae391333..00000000 --- a/src/main/java/org/wildstang/year2023/subsystems/tankDrive.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.wildstang.year2023.subsystems; - -import org.wildstang.framework.io.inputs.Input; -import org.wildstang.framework.subsystems.Subsystem; -import org.wildstang.hardware.roborio.inputs.WsJoystickAxis; -//import org.wildstang.hardware.roborio.outputs.WsPhoenix; -import org.wildstang.year2023.robot.WSInputs; -import org.wildstang.year2023.robot.WSOutputs; - -/** - * Sample Subsystem that controls a motor with a joystick. - * @author Liam - */ -public class tankDrive implements Subsystem { - // inputs - WsJoystickAxis joystick; - - // outputs - //WsPhoenix motor; - - // states - double speed; - - - @Override - public void init() { - joystick = (WsJoystickAxis) WSInputs.DRIVER_LEFT_JOYSTICK_Y.get(); - - //motor = (WsPhoenix) WSOutputs.TEST_MOTOR.get(); - - speed = 0; - } - - @Override - public void resetState() { - speed = 0; - } - - @Override - public void update() { - //motor.setValue(speed); - } - - @Override - public void inputUpdate(Input source) { - if (source == joystick) { - speed = joystick.getValue(); - } - } - - @Override - public String getName() { - return "Sample"; - } - - @Override - public void selfTest() { - } -} \ No newline at end of file From 2d15e2ee6e3d62e02c3d2830a26ed22390806f65 Mon Sep 17 00:00:00 2001 From: ARMS300 <90659881+ARMS300@users.noreply.github.com> Date: Sat, 11 Feb 2023 10:02:27 -0600 Subject: [PATCH 4/5] Updated Deployable code with backward intake --- .../subsystems/Intake/Deployable.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/wildstang/year2023/subsystems/Intake/Deployable.java b/src/main/java/org/wildstang/year2023/subsystems/Intake/Deployable.java index dd765af6..f1086ef4 100644 --- a/src/main/java/org/wildstang/year2023/subsystems/Intake/Deployable.java +++ b/src/main/java/org/wildstang/year2023/subsystems/Intake/Deployable.java @@ -12,11 +12,15 @@ public class Deployable 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; + @@ -28,6 +32,10 @@ public void inputUpdate(Input source) { intakeCall = !(intakeCall); } + + if (source == backwards){ + backCall = !(backCall); + } } @Override @@ -37,11 +45,14 @@ public void init() { 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; + intakeCall = false; + backCall = false; + } @@ -63,6 +74,16 @@ public void update() { 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 From 80c070e3594d771d377cb36f3509cc61c983102c Mon Sep 17 00:00:00 2001 From: ARMS300 <90659881+ARMS300@users.noreply.github.com> Date: Sat, 11 Feb 2023 10:55:38 -0600 Subject: [PATCH 5/5] Edited and reworked Intake --- src/main/java/org/wildstang/year2023/robot/WSSubsystems.java | 2 ++ .../subsystems/Intake/{Deployable.java => Intake.java} | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) rename src/main/java/org/wildstang/year2023/subsystems/Intake/{Deployable.java => Intake.java} (97%) 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/Deployable.java b/src/main/java/org/wildstang/year2023/subsystems/Intake/Intake.java similarity index 97% rename from src/main/java/org/wildstang/year2023/subsystems/Intake/Deployable.java rename to src/main/java/org/wildstang/year2023/subsystems/Intake/Intake.java index f1086ef4..f806cae5 100644 --- a/src/main/java/org/wildstang/year2023/subsystems/Intake/Deployable.java +++ b/src/main/java/org/wildstang/year2023/subsystems/Intake/Intake.java @@ -8,7 +8,7 @@ import org.wildstang.year2023.robot.WSInputs; import org.wildstang.year2023.robot.WSOutputs; -public class Deployable implements Subsystem { +public class Intake implements Subsystem { private WsSparkMax intake1; private WsJoystickButton deployRevIntake; @@ -96,7 +96,7 @@ public void resetState() { @Override public String getName() { // TODO Auto-generated method stub - return "Deployable"; + return "Intake"; }