From f0a1596ae9b066d5443c1fefac05d0a322385b83 Mon Sep 17 00:00:00 2001 From: suryatho Date: Fri, 16 Feb 2024 19:23:59 -0500 Subject: [PATCH] add backpack --- .../subsystems/rollers/backpack/BackpackIO.java | 5 +++++ .../rollers/backpack/BackpackIOSparkFlex.java | 15 +++++++++++++++ .../frc2024/subsystems/rollers/feeder/Feeder.java | 3 +-- .../subsystems/rollers/feeder/FeederIO.java | 2 +- .../rollers/feeder/FeederIOKrakenFOC.java | 2 +- .../subsystems/rollers/feeder/FeederIOSim.java | 2 +- .../subsystems/rollers/indexer/Indexer.java | 3 +-- .../subsystems/rollers/indexer/IndexerIO.java | 2 +- .../subsystems/rollers/indexer/IndexerIOSim.java | 2 +- .../rollers/indexer/IndexerIOSparkFlex.java | 2 +- .../frc2024/subsystems/rollers/intake/Intake.java | 3 +-- .../subsystems/rollers/intake/IntakeIO.java | 2 +- .../rollers/intake/IntakeIOKrakenFOC.java | 2 +- .../subsystems/rollers/intake/IntakeIOSim.java | 2 +- .../drivers}/rollers/GenericRollerSystem.java | 3 ++- .../drivers}/rollers/GenericRollerSystemIO.java | 2 +- .../rollers/GenericRollerSystemIOKrakenFOC.java | 2 +- .../rollers/GenericRollerSystemIOSim.java | 2 +- .../rollers/GenericRollerSystemIOSparkFlex.java | 2 +- 19 files changed, 38 insertions(+), 20 deletions(-) create mode 100644 src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/backpack/BackpackIO.java create mode 100644 src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/backpack/BackpackIOSparkFlex.java rename src/main/java/org/littletonrobotics/frc2024/{subsystems => util/drivers}/rollers/GenericRollerSystem.java (86%) rename src/main/java/org/littletonrobotics/frc2024/{subsystems => util/drivers}/rollers/GenericRollerSystemIO.java (92%) rename src/main/java/org/littletonrobotics/frc2024/{subsystems => util/drivers}/rollers/GenericRollerSystemIOKrakenFOC.java (98%) rename src/main/java/org/littletonrobotics/frc2024/{subsystems => util/drivers}/rollers/GenericRollerSystemIOSim.java (95%) rename src/main/java/org/littletonrobotics/frc2024/{subsystems => util/drivers}/rollers/GenericRollerSystemIOSparkFlex.java (96%) diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/backpack/BackpackIO.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/backpack/BackpackIO.java new file mode 100644 index 00000000..523b66b1 --- /dev/null +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/backpack/BackpackIO.java @@ -0,0 +1,5 @@ +package org.littletonrobotics.frc2024.subsystems.rollers.backpack; + +import org.littletonrobotics.frc2024.util.drivers.rollers.GenericRollerSystemIO; + +public interface BackpackIO extends GenericRollerSystemIO {} diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/backpack/BackpackIOSparkFlex.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/backpack/BackpackIOSparkFlex.java new file mode 100644 index 00000000..16451773 --- /dev/null +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/backpack/BackpackIOSparkFlex.java @@ -0,0 +1,15 @@ +package org.littletonrobotics.frc2024.subsystems.rollers.backpack; + +import org.littletonrobotics.frc2024.util.drivers.rollers.GenericRollerSystemIOSparkFlex; + +public class BackpackIOSparkFlex extends GenericRollerSystemIOSparkFlex implements BackpackIO { + private static final int id = 0; + private static final int currentLimitAmps = 40; + private static final boolean invert = false; + private static final boolean brake = true; + private static final double reduction = (1.0 / 1.0); + + public BackpackIOSparkFlex() { + super(id, currentLimitAmps, invert, brake, reduction); + } +} diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/Feeder.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/Feeder.java index 22337e24..6f399376 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/Feeder.java +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/Feeder.java @@ -11,8 +11,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystem; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystem.VoltageGoal; +import org.littletonrobotics.frc2024.util.drivers.rollers.GenericRollerSystem; import org.littletonrobotics.frc2024.util.LoggedTunableNumber; @Setter diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/FeederIO.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/FeederIO.java index 6760fff6..b949de35 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/FeederIO.java +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/FeederIO.java @@ -7,6 +7,6 @@ package org.littletonrobotics.frc2024.subsystems.rollers.feeder; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystemIO; +import org.littletonrobotics.frc2024.util.drivers.rollers.GenericRollerSystemIO; public interface FeederIO extends GenericRollerSystemIO {} diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/FeederIOKrakenFOC.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/FeederIOKrakenFOC.java index d19a103b..867bc93f 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/FeederIOKrakenFOC.java +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/FeederIOKrakenFOC.java @@ -7,7 +7,7 @@ package org.littletonrobotics.frc2024.subsystems.rollers.feeder; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystemIOKrakenFOC; +import org.littletonrobotics.frc2024.util.drivers.rollers.GenericRollerSystemIOKrakenFOC; public class FeederIOKrakenFOC extends GenericRollerSystemIOKrakenFOC implements FeederIO { private static final int id = 3; diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/FeederIOSim.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/FeederIOSim.java index 26e4e82e..27c9233f 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/FeederIOSim.java +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/feeder/FeederIOSim.java @@ -8,7 +8,7 @@ package org.littletonrobotics.frc2024.subsystems.rollers.feeder; import edu.wpi.first.math.system.plant.DCMotor; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystemIOSim; +import org.littletonrobotics.frc2024.util.drivers.rollers.GenericRollerSystemIOSim; public class FeederIOSim extends GenericRollerSystemIOSim implements FeederIO { private static final DCMotor motorModel = DCMotor.getKrakenX60Foc(1); diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/Indexer.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/Indexer.java index a005759c..bfc03713 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/Indexer.java +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/Indexer.java @@ -11,8 +11,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystem; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystem.VoltageGoal; +import org.littletonrobotics.frc2024.util.drivers.rollers.GenericRollerSystem; import org.littletonrobotics.frc2024.util.LoggedTunableNumber; @Setter diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/IndexerIO.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/IndexerIO.java index 23354f95..cc5b2608 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/IndexerIO.java +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/IndexerIO.java @@ -7,6 +7,6 @@ package org.littletonrobotics.frc2024.subsystems.rollers.indexer; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystemIO; +import org.littletonrobotics.frc2024.util.drivers.rollers.GenericRollerSystemIO; public interface IndexerIO extends GenericRollerSystemIO {} diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/IndexerIOSim.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/IndexerIOSim.java index 441f1dbe..ac5af710 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/IndexerIOSim.java +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/IndexerIOSim.java @@ -8,7 +8,7 @@ package org.littletonrobotics.frc2024.subsystems.rollers.indexer; import edu.wpi.first.math.system.plant.DCMotor; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystemIOSim; +import org.littletonrobotics.frc2024.util.drivers.rollers.GenericRollerSystemIOSim; public class IndexerIOSim extends GenericRollerSystemIOSim implements IndexerIO { private static final DCMotor motorModel = DCMotor.getKrakenX60Foc(1); diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/IndexerIOSparkFlex.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/IndexerIOSparkFlex.java index 9e1a7bfd..13df1c6e 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/IndexerIOSparkFlex.java +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/indexer/IndexerIOSparkFlex.java @@ -7,7 +7,7 @@ package org.littletonrobotics.frc2024.subsystems.rollers.indexer; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystemIOSparkFlex; +import org.littletonrobotics.frc2024.util.drivers.rollers.GenericRollerSystemIOSparkFlex; public class IndexerIOSparkFlex extends GenericRollerSystemIOSparkFlex implements IndexerIO { private static final double reduction = (18.0 / 12.0); diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/Intake.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/Intake.java index 6d96e83a..ea28b1fa 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/Intake.java +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/Intake.java @@ -11,8 +11,7 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystem; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystem.VoltageGoal; +import org.littletonrobotics.frc2024.util.drivers.rollers.GenericRollerSystem; import org.littletonrobotics.frc2024.util.LoggedTunableNumber; @Setter diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/IntakeIO.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/IntakeIO.java index 1555c5dd..852026d8 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/IntakeIO.java +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/IntakeIO.java @@ -7,6 +7,6 @@ package org.littletonrobotics.frc2024.subsystems.rollers.intake; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystemIO; +import org.littletonrobotics.frc2024.util.drivers.rollers.GenericRollerSystemIO; public interface IntakeIO extends GenericRollerSystemIO {} diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/IntakeIOKrakenFOC.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/IntakeIOKrakenFOC.java index a37cd383..8e240437 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/IntakeIOKrakenFOC.java +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/IntakeIOKrakenFOC.java @@ -7,7 +7,7 @@ package org.littletonrobotics.frc2024.subsystems.rollers.intake; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystemIOKrakenFOC; +import org.littletonrobotics.frc2024.util.drivers.rollers.GenericRollerSystemIOKrakenFOC; public class IntakeIOKrakenFOC extends GenericRollerSystemIOKrakenFOC implements IntakeIO { private static final int id = 2; diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/IntakeIOSim.java b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/IntakeIOSim.java index ade16761..a11931cb 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/IntakeIOSim.java +++ b/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/intake/IntakeIOSim.java @@ -8,7 +8,7 @@ package org.littletonrobotics.frc2024.subsystems.rollers.intake; import edu.wpi.first.math.system.plant.DCMotor; -import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystemIOSim; +import org.littletonrobotics.frc2024.util.drivers.rollers.GenericRollerSystemIOSim; public class IntakeIOSim extends GenericRollerSystemIOSim implements IntakeIO { private static final DCMotor motorModel = DCMotor.getKrakenX60Foc(1); diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystem.java b/src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystem.java similarity index 86% rename from src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystem.java rename to src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystem.java index 9beb2bb5..92641dbe 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystem.java +++ b/src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystem.java @@ -5,10 +5,11 @@ // license that can be found in the LICENSE file at // the root directory of this project. -package org.littletonrobotics.frc2024.subsystems.rollers; +package org.littletonrobotics.frc2024.util.drivers.rollers; import java.util.function.DoubleSupplier; import lombok.RequiredArgsConstructor; +import org.littletonrobotics.frc2024.subsystems.rollers.GenericRollerSystemIOInputsAutoLogged; import org.littletonrobotics.junction.Logger; @RequiredArgsConstructor diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystemIO.java b/src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystemIO.java similarity index 92% rename from src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystemIO.java rename to src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystemIO.java index d1d18b0b..4f3d5b1f 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystemIO.java +++ b/src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystemIO.java @@ -5,7 +5,7 @@ // license that can be found in the LICENSE file at // the root directory of this project. -package org.littletonrobotics.frc2024.subsystems.rollers; +package org.littletonrobotics.frc2024.util.drivers.rollers; import org.littletonrobotics.junction.AutoLog; diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystemIOKrakenFOC.java b/src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystemIOKrakenFOC.java similarity index 98% rename from src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystemIOKrakenFOC.java rename to src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystemIOKrakenFOC.java index 74519e93..b8591bd1 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystemIOKrakenFOC.java +++ b/src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystemIOKrakenFOC.java @@ -5,7 +5,7 @@ // license that can be found in the LICENSE file at // the root directory of this project. -package org.littletonrobotics.frc2024.subsystems.rollers; +package org.littletonrobotics.frc2024.util.drivers.rollers; import com.ctre.phoenix6.BaseStatusSignal; import com.ctre.phoenix6.StatusSignal; diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystemIOSim.java b/src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystemIOSim.java similarity index 95% rename from src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystemIOSim.java rename to src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystemIOSim.java index 0709b1c6..abe7319d 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystemIOSim.java +++ b/src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystemIOSim.java @@ -5,7 +5,7 @@ // license that can be found in the LICENSE file at // the root directory of this project. -package org.littletonrobotics.frc2024.subsystems.rollers; +package org.littletonrobotics.frc2024.util.drivers.rollers; import edu.wpi.first.math.MathUtil; import edu.wpi.first.math.system.plant.DCMotor; diff --git a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystemIOSparkFlex.java b/src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystemIOSparkFlex.java similarity index 96% rename from src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystemIOSparkFlex.java rename to src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystemIOSparkFlex.java index 582913f9..f5bd227f 100644 --- a/src/main/java/org/littletonrobotics/frc2024/subsystems/rollers/GenericRollerSystemIOSparkFlex.java +++ b/src/main/java/org/littletonrobotics/frc2024/util/drivers/rollers/GenericRollerSystemIOSparkFlex.java @@ -5,7 +5,7 @@ // license that can be found in the LICENSE file at // the root directory of this project. -package org.littletonrobotics.frc2024.subsystems.rollers; +package org.littletonrobotics.frc2024.util.drivers.rollers; import com.revrobotics.CANSparkBase; import com.revrobotics.CANSparkFlex;