diff --git a/src/main/java/frc/robot/swerve/SwerveModuleIO.java b/src/main/java/frc/lib/controller/SwerveModuleIO.java similarity index 62% rename from src/main/java/frc/robot/swerve/SwerveModuleIO.java rename to src/main/java/frc/lib/controller/SwerveModuleIO.java index 9c6fa2e..0d14bdb 100644 --- a/src/main/java/frc/robot/swerve/SwerveModuleIO.java +++ b/src/main/java/frc/lib/controller/SwerveModuleIO.java @@ -1,22 +1,22 @@ -package frc.robot.swerve; +package frc.lib.controller; import edu.wpi.first.math.kinematics.SwerveModulePosition; import edu.wpi.first.math.kinematics.SwerveModuleState; -/** Swerve module hardware interface. */ +/** Swerve module interface. */ public interface SwerveModuleIO { /** - * Gets the state of the swerve module. + * Returns the swerve module state. * - * @return the state of the swerve module. + * @return the swerve module state. */ public SwerveModuleState getState(); /** - * Gets the setpoint of the swerve module. + * Returns the swerve module setpoint. * - * @return the setpoint of the swerve module. + * @return the swerve module setpoint. */ public SwerveModuleState getSetpoint(); @@ -29,9 +29,9 @@ public interface SwerveModuleIO { public void setSetpoint(SwerveModuleState setpoint, boolean lazy); /** - * Gets the position of the swerve module. + * Returns the swerve module position. * - * @return the position of the swerve module. + * @return the swerve module position. */ public SwerveModulePosition getPosition(); } diff --git a/src/main/java/frc/robot/swerve/SwerveModuleIOCustom.java b/src/main/java/frc/lib/controller/SwerveModuleIOCustom.java similarity index 95% rename from src/main/java/frc/robot/swerve/SwerveModuleIOCustom.java rename to src/main/java/frc/lib/controller/SwerveModuleIOCustom.java index 05e2651..100e3c6 100644 --- a/src/main/java/frc/robot/swerve/SwerveModuleIOCustom.java +++ b/src/main/java/frc/lib/controller/SwerveModuleIOCustom.java @@ -1,15 +1,14 @@ -package frc.robot.swerve; +package frc.lib.controller; import edu.wpi.first.math.geometry.Rotation2d; import edu.wpi.first.math.kinematics.SwerveModulePosition; import edu.wpi.first.math.kinematics.SwerveModuleState; import edu.wpi.first.math.util.Units; import frc.lib.CAN; -import frc.lib.controller.PositionControllerIO; import frc.lib.controller.PositionControllerIO.PositionControllerIOValues; -import frc.lib.controller.VelocityControllerIO; import frc.lib.controller.VelocityControllerIO.VelocityControllerIOValues; import frc.robot.swerve.SwerveConstants.MK4iConstants; +import frc.robot.swerve.SwerveFactory; /** Custom swerve module. */ public class SwerveModuleIOCustom implements SwerveModuleIO { @@ -65,7 +64,7 @@ public void setSetpoint(SwerveModuleState setpoint, boolean lazy) { } /** - * Optimizes a swerve module's setpoint. + * Optimizes a swerve module setpoint. * * @param setpoint the setpoint to optimize. * @param state the state of the module. diff --git a/src/main/java/frc/robot/swerve/Swerve.java b/src/main/java/frc/robot/swerve/Swerve.java index 1f27cef..143aacf 100644 --- a/src/main/java/frc/robot/swerve/Swerve.java +++ b/src/main/java/frc/robot/swerve/Swerve.java @@ -11,6 +11,7 @@ import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import frc.lib.Subsystem; import frc.lib.Telemetry; +import frc.lib.controller.SwerveModuleIO; import frc.robot.RobotConstants; /** Swerve subsystem. */ diff --git a/src/main/java/frc/robot/swerve/SwerveFactory.java b/src/main/java/frc/robot/swerve/SwerveFactory.java index 56a642c..4becad3 100644 --- a/src/main/java/frc/robot/swerve/SwerveFactory.java +++ b/src/main/java/frc/robot/swerve/SwerveFactory.java @@ -8,6 +8,8 @@ import frc.lib.controller.PositionControllerIO; import frc.lib.controller.PositionControllerIOSim; import frc.lib.controller.PositionControllerIOTalonFXSteer; +import frc.lib.controller.SwerveModuleIO; +import frc.lib.controller.SwerveModuleIOCustom; import frc.lib.controller.VelocityControllerIO; import frc.lib.controller.VelocityControllerIOSim; import frc.lib.controller.VelocityControllerIOTalonFXPIDF; @@ -102,7 +104,7 @@ public static SwerveModuleIO createSouthWestModule() { return createModule( new CAN(10, "swerve"), new CAN(20, "swerve"), - new CAN(28, "drive"), + new CAN(28, "swerve"), Rotation2d.fromRotations(0.223145).unaryMinus()); }