From 9d0057ac6505d3678e7afc6ad2dee5f4134fb624 Mon Sep 17 00:00:00 2001 From: amrrao Date: Fri, 28 Jan 2022 18:20:52 -0800 Subject: [PATCH 1/8] made indexer off command --- .../org/usfirst/frc4904/robot/RobotMap.java | 5 +++++ .../frc4904/robot/commands/IndexerOff.java | 0 .../frc4904/robot/commands/IndexerOn.java | 0 .../robot/subsystems/MotorTestSubsystem.java | 21 +++++++++++++++++++ .../robot/subsystems/SubsystemBase.java | 0 5 files changed, 26 insertions(+) create mode 100644 src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java create mode 100644 src/main/java/org/usfirst/frc4904/robot/commands/IndexerOn.java create mode 100644 src/main/java/org/usfirst/frc4904/robot/subsystems/MotorTestSubsystem.java create mode 100644 src/main/java/org/usfirst/frc4904/robot/subsystems/SubsystemBase.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..4997cc4 100644 --- a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java +++ b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java @@ -3,6 +3,8 @@ 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.motioncontrollers.CANTalonFX; +import org.usfirst.frc4904.standard.subsystems.motor.Motor; public class RobotMap { public static class Port { @@ -12,6 +14,7 @@ public static class HumanInput { } public static class CANMotor { + public static final int indexerMotor = -1; // TODO: set port } public static class PWM { @@ -51,6 +54,7 @@ public static class Turn { } public static class Component { + public static Motor indexerMotor; } public static class Input { @@ -70,5 +74,6 @@ public RobotMap() { HumanInput.Driver.xbox = new CustomXbox(Port.HumanInput.xboxController); HumanInput.Operator.joystick = new CustomJoystick(Port.HumanInput.joystick); + Component.indexerMotor = new Motor("indexerMotor", false, new CANTalonFX(Port.CANMotor.indexerMotor)); } } \ No newline at end of file diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java b/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java new file mode 100644 index 0000000..e69de29 diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOn.java b/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOn.java new file mode 100644 index 0000000..e69de29 diff --git a/src/main/java/org/usfirst/frc4904/robot/subsystems/MotorTestSubsystem.java b/src/main/java/org/usfirst/frc4904/robot/subsystems/MotorTestSubsystem.java new file mode 100644 index 0000000..a79a863 --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/subsystems/MotorTestSubsystem.java @@ -0,0 +1,21 @@ +import edu.wpi.first.wpilibj.motorcontrol.MotorController; + +//motor code to turn on and off +//import org.usfirst.frc4904.standard.subsystems.motor; + + +public class MotorTestSubsystem extends MotorController { + Motor motor1 = new motor(); + for (MotorController motor : motors) { + if (motor instanceof IMotorController) + ((IMotorController) motor).enableVoltageCompensation(true); + motor.set(5); // Start all motors with 5 speed + + @Override + public void stopMotor() { + for (MotorController motor : motors) { + motor.stopMotor(); + } + } + +} \ No newline at end of file diff --git a/src/main/java/org/usfirst/frc4904/robot/subsystems/SubsystemBase.java b/src/main/java/org/usfirst/frc4904/robot/subsystems/SubsystemBase.java new file mode 100644 index 0000000..e69de29 From 071ecd87fae373d3cf838ba14bb542e7e916c0e5 Mon Sep 17 00:00:00 2001 From: amrrao Date: Sun, 30 Jan 2022 09:49:20 -0800 Subject: [PATCH 2/8] made indexer commands --- build.gradle | 2 +- .../robot/subsystems/MotorTestSubsystem.java | 21 ------------------- 2 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 src/main/java/org/usfirst/frc4904/robot/subsystems/MotorTestSubsystem.java diff --git a/build.gradle b/build.gradle index 9c0052a..9310189 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ import edu.wpi.first.gradlerio.deploy.roborio.RoboRIO plugins { id "java" - id "edu.wpi.first.GradleRIO" version "2022.1.1" + id "edu.wpi.first.GradleRIO" version "2022.2.1" } sourceCompatibility = JavaVersion.VERSION_11 diff --git a/src/main/java/org/usfirst/frc4904/robot/subsystems/MotorTestSubsystem.java b/src/main/java/org/usfirst/frc4904/robot/subsystems/MotorTestSubsystem.java deleted file mode 100644 index a79a863..0000000 --- a/src/main/java/org/usfirst/frc4904/robot/subsystems/MotorTestSubsystem.java +++ /dev/null @@ -1,21 +0,0 @@ -import edu.wpi.first.wpilibj.motorcontrol.MotorController; - -//motor code to turn on and off -//import org.usfirst.frc4904.standard.subsystems.motor; - - -public class MotorTestSubsystem extends MotorController { - Motor motor1 = new motor(); - for (MotorController motor : motors) { - if (motor instanceof IMotorController) - ((IMotorController) motor).enableVoltageCompensation(true); - motor.set(5); // Start all motors with 5 speed - - @Override - public void stopMotor() { - for (MotorController motor : motors) { - motor.stopMotor(); - } - } - -} \ No newline at end of file From 5c649edc670f8cfadd06066ed91c4ec048b0496b Mon Sep 17 00:00:00 2001 From: amrrao Date: Sun, 30 Jan 2022 10:10:34 -0800 Subject: [PATCH 3/8] Added indexer off and on commands --- .../org/usfirst/frc4904/robot/RobotMap.java | 3 ++- .../frc4904/robot/commands/IndexerOff.java | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java index 4997cc4..def10cf 100644 --- a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java +++ b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java @@ -55,6 +55,7 @@ public static class Turn { public static class Component { public static Motor indexerMotor; + public static Motor motor; } public static class Input { @@ -76,4 +77,4 @@ public RobotMap() { Component.indexerMotor = new Motor("indexerMotor", false, new CANTalonFX(Port.CANMotor.indexerMotor)); } -} \ No newline at end of file +} diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java b/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java index e69de29..b8f1c75 100644 --- a/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java +++ b/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java @@ -0,0 +1,21 @@ +package org.usfirst.frc4904.robot.commands; + +import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.standard.commands.motor.MotorIdle; +import org.usfirst.frc4904.standard.subsystems.motor.Motor; + +public class IndexerOff extends MotorIdle { + + /** + * Set motor speed to zero + * + * @param motor The motor to manipulate + */ + public IndexerOff(Motor motor) { + super(motor, 0.0); + } + + public IndexerOff() { + super(RobotMap.Component.motor, 0.0); + } +} From 116141569005564e00d3298513393f888fd03d2e Mon Sep 17 00:00:00 2001 From: amrrao Date: Sun, 30 Jan 2022 10:14:17 -0800 Subject: [PATCH 4/8] added on and off indexer commands --- .../org/usfirst/frc4904/robot/commands/IndexerOn.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOn.java b/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOn.java index e69de29..2d1355b 100644 --- a/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOn.java +++ b/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOn.java @@ -0,0 +1,11 @@ +package org.usfirst.frc4904.robot.commands; + +import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.standard.commands.motor.MotorConstant; + +public class IndexerOn extends MotorConstant { + public final static double DEFAULT_INTAKE_MOTOR_SPEED = 0.5; //TODO: needs value + public IndexerOn() { + super("IndexerOn", RobotMap.Component.motor, DEFAULT_INTAKE_MOTOR_SPEED); + } +} From 7f094215d453c1cbb05947aa24e825401f31bc8b Mon Sep 17 00:00:00 2001 From: amrrao Date: Sun, 30 Jan 2022 15:07:27 -0800 Subject: [PATCH 5/8] made requested changes to indexer commands --- .../java/org/usfirst/frc4904/robot/RobotMap.java | 2 +- .../usfirst/frc4904/robot/commands/IndexerOff.java | 12 +++--------- .../frc4904/robot/subsystems/SubsystemBase.java | 0 3 files changed, 4 insertions(+), 10 deletions(-) delete mode 100644 src/main/java/org/usfirst/frc4904/robot/subsystems/SubsystemBase.java diff --git a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java index def10cf..312c112 100644 --- a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java +++ b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java @@ -75,6 +75,6 @@ public RobotMap() { HumanInput.Driver.xbox = new CustomXbox(Port.HumanInput.xboxController); HumanInput.Operator.joystick = new CustomJoystick(Port.HumanInput.joystick); - Component.indexerMotor = new Motor("indexerMotor", false, new CANTalonFX(Port.CANMotor.indexerMotor)); + Component.indexerMotor = new Motor("indexerMotor", false, new CANTalonFX(Port.CANMotor.indexerMotor)); // TODO: Need to check motor inversion } } diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java b/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java index b8f1c75..dda14af 100644 --- a/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java +++ b/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java @@ -2,20 +2,14 @@ import org.usfirst.frc4904.robot.RobotMap; import org.usfirst.frc4904.standard.commands.motor.MotorIdle; -import org.usfirst.frc4904.standard.subsystems.motor.Motor; + public class IndexerOff extends MotorIdle { /** - * Set motor speed to zero - * - * @param motor The motor to manipulate + * Set indexer motor speed to zero */ - public IndexerOff(Motor motor) { - super(motor, 0.0); - } - public IndexerOff() { - super(RobotMap.Component.motor, 0.0); + super(RobotMap.Component.indexerMotor); } } diff --git a/src/main/java/org/usfirst/frc4904/robot/subsystems/SubsystemBase.java b/src/main/java/org/usfirst/frc4904/robot/subsystems/SubsystemBase.java deleted file mode 100644 index e69de29..0000000 From d1813bb61b15a2a3e823917671535118d666d58c Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 13 Feb 2022 12:51:51 -0800 Subject: [PATCH 6/8] broken indexer --- .../org/usfirst/frc4904/robot/RobotMap.java | 15 ++++--- .../robot/commands/ExampleCommand.java | 43 ------------------- .../commands/indexer/IndexerControl.java | 10 +++++ .../robot/commands/indexer/IndexerCustom.java | 10 +++++ .../commands/{ => indexer}/IndexerOff.java | 2 +- .../commands/{ => indexer}/IndexerOn.java | 2 +- .../robot/subsystems/ExampleSubsystem.java | 22 ---------- .../frc4904/robot/subsystems/Indexer.java | 20 +++++++++ 8 files changed, 52 insertions(+), 72 deletions(-) delete mode 100644 src/main/java/org/usfirst/frc4904/robot/commands/ExampleCommand.java create mode 100644 src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerControl.java create mode 100644 src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerCustom.java rename src/main/java/org/usfirst/frc4904/robot/commands/{ => indexer}/IndexerOff.java (84%) rename src/main/java/org/usfirst/frc4904/robot/commands/{ => indexer}/IndexerOn.java (87%) delete mode 100644 src/main/java/org/usfirst/frc4904/robot/subsystems/ExampleSubsystem.java create mode 100644 src/main/java/org/usfirst/frc4904/robot/subsystems/Indexer.java diff --git a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java index 312c112..26161c0 100644 --- a/src/main/java/org/usfirst/frc4904/robot/RobotMap.java +++ b/src/main/java/org/usfirst/frc4904/robot/RobotMap.java @@ -1,10 +1,10 @@ package org.usfirst.frc4904.robot; - -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.motioncontrollers.CANTalonFX; import org.usfirst.frc4904.standard.subsystems.motor.Motor; +import org.usfirst.frc4904.robot.subsystems.Indexer; + public class RobotMap { public static class Port { @@ -14,7 +14,9 @@ public static class HumanInput { } public static class CANMotor { - public static final int indexerMotor = -1; // TODO: set port + public static final int indexerMotor1 = -1; // TODO: set port + public static final int indexerMotor2 = -1; // TODO: set port + } public static class PWM { @@ -54,7 +56,7 @@ public static class Turn { } public static class Component { - public static Motor indexerMotor; + public static Indexer indexer; public static Motor motor; } @@ -75,6 +77,9 @@ public RobotMap() { HumanInput.Driver.xbox = new CustomXbox(Port.HumanInput.xboxController); HumanInput.Operator.joystick = new CustomJoystick(Port.HumanInput.joystick); - Component.indexerMotor = new Motor("indexerMotor", false, new CANTalonFX(Port.CANMotor.indexerMotor)); // TODO: Need to check motor inversion + Component.indexer = new Indexer(new Motor("Indexer 1", false, new CANTalonFX(Port.CANMotor.indexerMotor1)), new Motor("Indexer 2", false, new CANTalonFX(Port.CANMotor.indexerMotor2))); + + + } } diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/ExampleCommand.java b/src/main/java/org/usfirst/frc4904/robot/commands/ExampleCommand.java deleted file mode 100644 index 90c8cdb..0000000 --- a/src/main/java/org/usfirst/frc4904/robot/commands/ExampleCommand.java +++ /dev/null @@ -1,43 +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.commands; - -import org.usfirst.frc4904.robot.subsystems.ExampleSubsystem; -import edu.wpi.first.wpilibj2.command.CommandBase; - -/** An example command that uses an example subsystem. */ -public class ExampleCommand extends CommandBase { - @SuppressWarnings({"PMD.UnusedPrivateField", "PMD.SingularField"}) - private final ExampleSubsystem m_subsystem; - - /** - * Creates a new ExampleCommand. - * - * @param subsystem The subsystem used by this command. - */ - public ExampleCommand(ExampleSubsystem subsystem) { - m_subsystem = subsystem; - // Use addRequirements() here to declare subsystem dependencies. - addRequirements(subsystem); - } - - // Called when the command is initially scheduled. - @Override - public void initialize() {} - - // Called every time the scheduler runs while the command is scheduled. - @Override - public void execute() {} - - // Called once the command ends or is interrupted. - @Override - public void end(boolean interrupted) {} - - // Returns true when the command should end. - @Override - public boolean isFinished() { - return false; - } -} diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerControl.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerControl.java new file mode 100644 index 0000000..2dbd25d --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerControl.java @@ -0,0 +1,10 @@ +package org.usfirst.frc4904.robot.commands.indexer; +import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.standard.commands.motor.MotorConstant; +import org.usfirst.frc4904.robot.subsystems.Indexer; + +public class IndexerControl extends MotorConstant { + public IndexerControl(double Speed) { + super(RobotMap.Component.indexer.indexerMotor1, Speed) + } +} diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerCustom.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerCustom.java new file mode 100644 index 0000000..2e9fc62 --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerCustom.java @@ -0,0 +1,10 @@ +package org.usfirst.frc4904.robot.commands.indexer; +import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.standard.commands.motor.MotorConstant; +import org.usfirst.frc4904.robot.subsystems.Indexer; + +public class IndexerCustom extends MotorConstant { + public IndexerCustom(double Speed1, double Speed2) { + super("IndexerOn", RobotMap.Component.indexer.indexerMotor1, Indexer.DEFAULT_INDEXER_SPEED); + } +} diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOff.java similarity index 84% rename from src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java rename to src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOff.java index dda14af..85452cb 100644 --- a/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOff.java +++ b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOff.java @@ -1,4 +1,4 @@ -package org.usfirst.frc4904.robot.commands; +package org.usfirst.frc4904.robot.commands.indexer; import org.usfirst.frc4904.robot.RobotMap; import org.usfirst.frc4904.standard.commands.motor.MotorIdle; diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOn.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOn.java similarity index 87% rename from src/main/java/org/usfirst/frc4904/robot/commands/IndexerOn.java rename to src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOn.java index 2d1355b..e1dc1bf 100644 --- a/src/main/java/org/usfirst/frc4904/robot/commands/IndexerOn.java +++ b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOn.java @@ -1,4 +1,4 @@ -package org.usfirst.frc4904.robot.commands; +package org.usfirst.frc4904.robot.commands.indexer; import org.usfirst.frc4904.robot.RobotMap; import org.usfirst.frc4904.standard.commands.motor.MotorConstant; diff --git a/src/main/java/org/usfirst/frc4904/robot/subsystems/ExampleSubsystem.java b/src/main/java/org/usfirst/frc4904/robot/subsystems/ExampleSubsystem.java deleted file mode 100644 index 54f569f..0000000 --- a/src/main/java/org/usfirst/frc4904/robot/subsystems/ExampleSubsystem.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 ExampleSubsystem extends SubsystemBase { - /** Creates a new ExampleSubsystem. */ - public ExampleSubsystem() {} - - @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 - } -} diff --git a/src/main/java/org/usfirst/frc4904/robot/subsystems/Indexer.java b/src/main/java/org/usfirst/frc4904/robot/subsystems/Indexer.java new file mode 100644 index 0000000..563eaa2 --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/subsystems/Indexer.java @@ -0,0 +1,20 @@ +// 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; +import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.standard.subsystems.motor.Motor; + + +public class Indexer extends SubsystemBase { + + public static final double DEFAULT_INDEXER_SPEED = .5; //TODO: Set value + public final Motor indexerMotor1; + public final Motor indexerMotor2; + public Indexer(Motor indexerMotor1, Motor indexerMotor2) { + this.indexerMotor1 = indexerMotor1; + this.indexerMotor2 = indexerMotor2; + } +} From ae1c8fcd5a6a29a00e38e88d45612176391e1011 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 13 Feb 2022 13:25:08 -0800 Subject: [PATCH 7/8] fixed indexer two motor --- .../robot/commands/indexer/IndexerControl.java | 10 ---------- .../robot/commands/indexer/IndexerCustom.java | 10 ---------- .../frc4904/robot/commands/indexer/IndexerOff.java | 9 +++++++-- .../frc4904/robot/commands/indexer/IndexerOn.java | 8 +++----- .../frc4904/robot/commands/indexer/IndexerSet.java | 14 ++++++++++++++ .../usfirst/frc4904/robot/subsystems/Indexer.java | 1 - 6 files changed, 24 insertions(+), 28 deletions(-) delete mode 100644 src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerControl.java delete mode 100644 src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerCustom.java create mode 100644 src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerSet.java diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerControl.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerControl.java deleted file mode 100644 index 2dbd25d..0000000 --- a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerControl.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.usfirst.frc4904.robot.commands.indexer; -import org.usfirst.frc4904.robot.RobotMap; -import org.usfirst.frc4904.standard.commands.motor.MotorConstant; -import org.usfirst.frc4904.robot.subsystems.Indexer; - -public class IndexerControl extends MotorConstant { - public IndexerControl(double Speed) { - super(RobotMap.Component.indexer.indexerMotor1, Speed) - } -} diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerCustom.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerCustom.java deleted file mode 100644 index 2e9fc62..0000000 --- a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerCustom.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.usfirst.frc4904.robot.commands.indexer; -import org.usfirst.frc4904.robot.RobotMap; -import org.usfirst.frc4904.standard.commands.motor.MotorConstant; -import org.usfirst.frc4904.robot.subsystems.Indexer; - -public class IndexerCustom extends MotorConstant { - public IndexerCustom(double Speed1, double Speed2) { - super("IndexerOn", RobotMap.Component.indexer.indexerMotor1, Indexer.DEFAULT_INDEXER_SPEED); - } -} diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOff.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOff.java index 85452cb..2552bca 100644 --- a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOff.java +++ b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOff.java @@ -3,13 +3,18 @@ import org.usfirst.frc4904.robot.RobotMap; import org.usfirst.frc4904.standard.commands.motor.MotorIdle; +import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; -public class IndexerOff extends MotorIdle { + +public class IndexerOff extends ParallelCommandGroup { /** * Set indexer motor speed to zero */ public IndexerOff() { - super(RobotMap.Component.indexerMotor); + this.addCommands( + new MotorIdle(RobotMap.Component.indexer.indexerMotor1), + new MotorIdle(RobotMap.Component.indexer.indexerMotor2) + ); } } diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOn.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOn.java index e1dc1bf..1b7bef4 100644 --- a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOn.java +++ b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOn.java @@ -1,11 +1,9 @@ package org.usfirst.frc4904.robot.commands.indexer; -import org.usfirst.frc4904.robot.RobotMap; -import org.usfirst.frc4904.standard.commands.motor.MotorConstant; +import org.usfirst.frc4904.robot.subsystems.Indexer; -public class IndexerOn extends MotorConstant { - public final static double DEFAULT_INTAKE_MOTOR_SPEED = 0.5; //TODO: needs value +public class IndexerOn extends IndexerSet { public IndexerOn() { - super("IndexerOn", RobotMap.Component.motor, DEFAULT_INTAKE_MOTOR_SPEED); + super(Indexer.DEFAULT_INDEXER_SPEED, Indexer.DEFAULT_INDEXER_SPEED); } } diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerSet.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerSet.java new file mode 100644 index 0000000..4d31118 --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerSet.java @@ -0,0 +1,14 @@ +package org.usfirst.frc4904.robot.commands.indexer; +import org.usfirst.frc4904.robot.RobotMap; +import org.usfirst.frc4904.standard.commands.motor.MotorConstant; +import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; + + +public class IndexerSet extends ParallelCommandGroup { + public IndexerSet(double speed1, double speed2) { + this.addCommands( + new MotorConstant(RobotMap.Component.indexer.indexerMotor1, speed1), + new MotorConstant(RobotMap.Component.indexer.indexerMotor2, speed2) + ); + } +} diff --git a/src/main/java/org/usfirst/frc4904/robot/subsystems/Indexer.java b/src/main/java/org/usfirst/frc4904/robot/subsystems/Indexer.java index 563eaa2..38eed4c 100644 --- a/src/main/java/org/usfirst/frc4904/robot/subsystems/Indexer.java +++ b/src/main/java/org/usfirst/frc4904/robot/subsystems/Indexer.java @@ -4,7 +4,6 @@ package org.usfirst.frc4904.robot.subsystems; import edu.wpi.first.wpilibj2.command.SubsystemBase; -import org.usfirst.frc4904.robot.RobotMap; import org.usfirst.frc4904.standard.subsystems.motor.Motor; From 19103faab59d2b1ef7aa711074ea8e9ae0113fe6 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 13 Feb 2022 14:32:35 -0800 Subject: [PATCH 8/8] added indexer reverse command --- .../usfirst/frc4904/robot/commands/indexer/IndexerOn.java | 2 -- .../frc4904/robot/commands/indexer/IndexerReverse.java | 7 +++++++ .../java/org/usfirst/frc4904/robot/subsystems/Indexer.java | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerReverse.java diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOn.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOn.java index 1b7bef4..687aeb4 100644 --- a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOn.java +++ b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerOn.java @@ -1,7 +1,5 @@ package org.usfirst.frc4904.robot.commands.indexer; - import org.usfirst.frc4904.robot.subsystems.Indexer; - public class IndexerOn extends IndexerSet { public IndexerOn() { super(Indexer.DEFAULT_INDEXER_SPEED, Indexer.DEFAULT_INDEXER_SPEED); diff --git a/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerReverse.java b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerReverse.java new file mode 100644 index 0000000..65a4132 --- /dev/null +++ b/src/main/java/org/usfirst/frc4904/robot/commands/indexer/IndexerReverse.java @@ -0,0 +1,7 @@ +package org.usfirst.frc4904.robot.commands.indexer; +import org.usfirst.frc4904.robot.subsystems.Indexer; +public class IndexerReverse extends IndexerSet { + public IndexerReverse() { + super(Indexer.DEFAULT_REVERSE_INDEXER_SPEED, Indexer.DEFAULT_REVERSE_INDEXER_SPEED); + } +} diff --git a/src/main/java/org/usfirst/frc4904/robot/subsystems/Indexer.java b/src/main/java/org/usfirst/frc4904/robot/subsystems/Indexer.java index 38eed4c..5eea275 100644 --- a/src/main/java/org/usfirst/frc4904/robot/subsystems/Indexer.java +++ b/src/main/java/org/usfirst/frc4904/robot/subsystems/Indexer.java @@ -10,6 +10,7 @@ public class Indexer extends SubsystemBase { public static final double DEFAULT_INDEXER_SPEED = .5; //TODO: Set value + public static final double DEFAULT_REVERSE_INDEXER_SPEED = -DEFAULT_INDEXER_SPEED; public final Motor indexerMotor1; public final Motor indexerMotor2; public Indexer(Motor indexerMotor1, Motor indexerMotor2) {