From 8defb590f40120ea22befb0e0880bcbb2636b502 Mon Sep 17 00:00:00 2001 From: Tyler Wilcox Date: Fri, 30 Jan 2026 20:04:33 -0500 Subject: [PATCH] Possible Fix for swerve drive --- .../frc/robolib/drivesystems/swerve/SwerveModule.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/main/java/org/fairportrobotics/frc/robolib/drivesystems/swerve/SwerveModule.java b/lib/src/main/java/org/fairportrobotics/frc/robolib/drivesystems/swerve/SwerveModule.java index 9f1b818..34d6d80 100644 --- a/lib/src/main/java/org/fairportrobotics/frc/robolib/drivesystems/swerve/SwerveModule.java +++ b/lib/src/main/java/org/fairportrobotics/frc/robolib/drivesystems/swerve/SwerveModule.java @@ -41,7 +41,6 @@ public class SwerveModule { private VelocityVoltage driveRequest = new VelocityVoltage(0); private TalonFX steerMotor; private MotionMagicVoltage steerRequest = new MotionMagicVoltage(0); - private PositionVoltage steerPosRequ = new PositionVoltage(0); private CANcoder steerEncoder; private String moduleName; @@ -152,7 +151,6 @@ public class SwerveModule { } public void periodic(){ - SmartDashboard.putNumber(moduleName + " steerReq", steerPosRequ.Position); SmartDashboard.putNumber(moduleName + " steerPow", steerMotor.getClosedLoopOutput().getValueAsDouble()); SmartDashboard.putNumber(moduleName + " steer error", steerMotor.getClosedLoopError().getValueAsDouble()); SmartDashboard.putNumber(moduleName + " steer setpoint", steerMotor.getClosedLoopReference().getValueAsDouble()); @@ -207,6 +205,9 @@ public class SwerveModule { ).withClosedLoopGeneral( new ClosedLoopGeneralConfigs() .withContinuousWrap(true) + ).withMotorOutput( + new MotorOutputConfigs() + .withInverted(InvertedValue.CounterClockwise_Positive) ); } @@ -214,7 +215,7 @@ public class SwerveModule { return new CANcoderConfiguration().withMagnetSensor( new MagnetSensorConfigs() .withMagnetOffset(-steerOffset) - .withSensorDirection(SensorDirectionValue.Clockwise_Positive) + .withSensorDirection(SensorDirectionValue.CounterClockwise_Positive) .withAbsoluteSensorDiscontinuityPoint(0.5) ); }