From f2be8ac304272528a1536d6a7704e1810676e7fc Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 26 Jan 2022 17:03:30 -0800 Subject: [PATCH 1/3] one piston indexer --- .../java/org/usfirst/frc4904/robot/RobotMap.java | 7 +++++++ .../robot/commands/indexer/ExtendIndexer.java | 13 +++++++++++++ .../robot/commands/indexer/RetractIndexer.java | 14 ++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 src/main/java/org/usfirst/frc4904/robot/commands/indexer/ExtendIndexer.java create mode 100644 src/main/java/org/usfirst/frc4904/robot/commands/indexer/RetractIndexer.java diff --git a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java index dd4b24d..6b2274b 100644 --- a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java +++ b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java @@ -3,6 +3,10 @@ import edu.wpi.first.wpilibj2.command.Subsystem; import org.usfirst.frc4904.standard.custom.controllers.CustomJoystick; import org.usfirst.frc4904.standard.custom.controllers.CustomXbox; +import org.usfirst.frc4904.standard.custom.PCMPort; +import edu.wpi.first.wpilibj.PneumaticsModuleType; +import org.usfirst.frc4904.standard.subsystems.SolenoidSubsystem.SolenoidState; +import org.usfirst.frc4904.standard.subsystems.SolenoidSubsystem; public class RobotMap { public static class Port { @@ -21,6 +25,7 @@ public static class CAN { } public static class Pneumatics { + public static final PCMPort INDEXER_SOLENOID = new PCMPort(-1, PneumaticsModuleType.CTREPCM, -1, -1); //TODO: set port for indexer solenoid } public static class Digital { @@ -51,6 +56,7 @@ public static class Turn { } public static class Component { + public static SolenoidSubsystem indexerSolenoid; } public static class Input { @@ -69,6 +75,7 @@ public static class Operator { public RobotMap() { HumanInput.Driver.xbox = new CustomXbox(Port.HumanInput.xboxController); HumanInput.Operator.joystick = new CustomJoystick(Port.HumanInput.joystick); + Component.indexerSolenoid = new SolenoidSubsystem("Indexer Solenoid", false, SolenoidState.RETRACT, Port.Pneumatics.INDEXER_SOLENOID.buildDoubleSolenoid()); } } \ No newline at end of file diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/ExtendIndexer.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/ExtendIndexer.java new file mode 100644 index 0000000..2644029 --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/ExtendIndexer.java @@ -0,0 +1,13 @@ +package org.usfirst.frc4904.robot.commands.indexer; + +import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.standard.commands.solenoid.SolenoidExtend; + +/** + * Extends the drawbridge which has the intake mechanism attached to it. + */ +public class ExtendIndexer extends SolenoidExtend { + public ExtendIndexer() { + super("extendIndexer", RobotMap.Component.indexerSolenoid); + } +} \ No newline at end of file diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/RetractIndexer.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/RetractIndexer.java new file mode 100644 index 0000000..dd3b1df --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/RetractIndexer.java @@ -0,0 +1,14 @@ + +package org.usfirst.frc4904.robot.commands.indexer; + +import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.standard.commands.solenoid.SolenoidRetract; + +/** + * Retracts the drawbridge which has the intake mechanism attached to it. + */ +public class RetractIndexer extends SolenoidRetract { + public RetractIndexer() { + super("retractIndexer", RobotMap.Component.indexerSolenoid); + } +} \ No newline at end of file From 2075df5be72b90af3ae3b3ded0403125c82a3a8b Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 28 Jan 2022 16:43:55 -0800 Subject: [PATCH 2/3] created 2 piston indexer subsystem --- .../org/usfirst/frc4904/robot/RobotMap.java | 7 +++--- .../robot/commands/indexer/ExtendIndexer.java | 2 +- .../commands/indexer/RetractIndexer.java | 2 +- .../robot/subsystems/IndexerSubsystem.java | 22 +++++++++++++++++++ 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 src/main/java/org/usfirst/frc4904/robot/subsystems/IndexerSubsystem.java diff --git a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java index 6b2274b..882d17e 100644 --- a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java +++ b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java @@ -25,7 +25,8 @@ public static class CAN { } public static class Pneumatics { - public static final PCMPort INDEXER_SOLENOID = new PCMPort(-1, PneumaticsModuleType.CTREPCM, -1, -1); //TODO: set port for indexer solenoid + public static final PCMPort INDEXER_SOLENOID1 = new PCMPort(-1, PneumaticsModuleType.CTREPCM, -1, -1); //TODO: set port for indexer solenoid + public static final PCMPort INDEXER_SOLENOID2 = new PCMPort(-1, PneumaticsModuleType.CTREPCM, -1, -1); //TODO: set port for indexer solenoid } public static class Digital { @@ -56,7 +57,7 @@ public static class Turn { } public static class Component { - public static SolenoidSubsystem indexerSolenoid; + public static SolenoidSubsystem indexerSolenoids; } public static class Input { @@ -75,7 +76,7 @@ public static class Operator { public RobotMap() { HumanInput.Driver.xbox = new CustomXbox(Port.HumanInput.xboxController); HumanInput.Operator.joystick = new CustomJoystick(Port.HumanInput.joystick); - Component.indexerSolenoid = new SolenoidSubsystem("Indexer Solenoid", false, SolenoidState.RETRACT, Port.Pneumatics.INDEXER_SOLENOID.buildDoubleSolenoid()); + Component.indexerSolenoids = new SolenoidSubsystem("Indexer Solenoid", false, SolenoidState.RETRACT, Port.Pneumatics.INDEXER_SOLENOID1.buildDoubleSolenoid(), Port.Pneumatics.INDEXER_SOLENOID2.buildDoubleSolenoid()); } } \ No newline at end of file diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/ExtendIndexer.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/ExtendIndexer.java index 2644029..6c67f15 100644 --- a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/ExtendIndexer.java +++ b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/ExtendIndexer.java @@ -8,6 +8,6 @@ */ public class ExtendIndexer extends SolenoidExtend { public ExtendIndexer() { - super("extendIndexer", RobotMap.Component.indexerSolenoid); + super("extendIndexer", RobotMap.Component.indexerSolenoids); } } \ No newline at end of file diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/RetractIndexer.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/RetractIndexer.java index dd3b1df..40db941 100644 --- a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/RetractIndexer.java +++ b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/RetractIndexer.java @@ -9,6 +9,6 @@ */ public class RetractIndexer extends SolenoidRetract { public RetractIndexer() { - super("retractIndexer", RobotMap.Component.indexerSolenoid); + super("retractIndexer", RobotMap.Component.indexerSolenoids); } } \ No newline at end of file diff --git a/src/main/java/org/usfirst/frc4904/robot/subsystems/IndexerSubsystem.java b/src/main/java/org/usfirst/frc4904/robot/subsystems/IndexerSubsystem.java new file mode 100644 index 0000000..f065740 --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/subsystems/IndexerSubsystem.java @@ -0,0 +1,22 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +package org.usfirst.frc4904.robot.subsystems; + +import edu.wpi.first.wpilibj2.command.SubsystemBase; + +public class IndexerSubsystem extends SubsystemBase { + /** Creates a new ExampleSubsystem. */ + public IndexerSubsystem() {} + + @Override + public void periodic() { + // This method will be called once per scheduler run + } + + @Override + public void simulationPeriodic() { + // This method will be called once per scheduler run during simulation + } +} \ No newline at end of file From c095cd82222e391d5dc9cf99e5e94d326911d264 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 28 Jan 2022 16:51:04 -0800 Subject: [PATCH 3/3] deleted unnecessary file --- .../robot/subsystems/IndexerSubsystem.java | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 src/main/java/org/usfirst/frc4904/robot/subsystems/IndexerSubsystem.java diff --git a/src/main/java/org/usfirst/frc4904/robot/subsystems/IndexerSubsystem.java b/src/main/java/org/usfirst/frc4904/robot/subsystems/IndexerSubsystem.java deleted file mode 100644 index f065740..0000000 --- a/src/main/java/org/usfirst/frc4904/robot/subsystems/IndexerSubsystem.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -package org.usfirst.frc4904.robot.subsystems; - -import edu.wpi.first.wpilibj2.command.SubsystemBase; - -public class IndexerSubsystem extends SubsystemBase { - /** Creates a new ExampleSubsystem. */ - public IndexerSubsystem() {} - - @Override - public void periodic() { - // This method will be called once per scheduler run - } - - @Override - public void simulationPeriodic() { - // This method will be called once per scheduler run during simulation - } -} \ No newline at end of file