From 458ca15eca211a280b220941390f065a3698e0e1 Mon Sep 17 00:00:00 2001 From: Keobkeig Date: Thu, 4 Apr 2024 17:23:28 -0400 Subject: [PATCH] correct angle controller --- .../robot/subsystems/swerve/SwerveModule.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/stuypulse/robot/subsystems/swerve/SwerveModule.java b/src/main/java/com/stuypulse/robot/subsystems/swerve/SwerveModule.java index 4a2031a..84c8b9d 100644 --- a/src/main/java/com/stuypulse/robot/subsystems/swerve/SwerveModule.java +++ b/src/main/java/com/stuypulse/robot/subsystems/swerve/SwerveModule.java @@ -125,17 +125,17 @@ public void periodic() { } else { driveMotor.setVoltage(driveController.calculate(targetState.speedMetersPerSecond)); - turnMotor.setVoltage(turnController.calculate(getAngle().getRadians(), targetState.angle.getRadians())); + turnMotor.setVoltage(turnController.calculate(getAngle().getDegrees(), targetState.angle.getDegrees())); } - SmartDashboard.putNumber(id + "/Drive Current", driveMotor.getOutputCurrent()); - SmartDashboard.putNumber(id + "/Drive Position", driveEncoder.getPosition()); - SmartDashboard.putNumber(id + "/Drive Voltage", driveMotor.getBusVoltage()); - SmartDashboard.putNumber(id + "/Turn Voltage", turnMotor.getBusVoltage()); - SmartDashboard.putNumber(id + "/Turn Current", turnMotor.getOutputCurrent()); - SmartDashboard.putNumber(id + "/Raw Encoder Angle", Units.rotationsToDegrees(turnEnoder.getAbsolutePosition().getValueAsDouble())); - SmartDashboard.putNumber(id + "/Target Angle", Units.rotationsToDegrees(targetState.angle.getRadians())); - SmartDashboard.putNumber(id + "/Target Speed", targetState.speedMetersPerSecond); + SmartDashboard.putNumber(getID() + "/Drive Current", driveMotor.getOutputCurrent()); + SmartDashboard.putNumber(getID() + "/Drive Position", driveEncoder.getPosition()); + SmartDashboard.putNumber(getID() + "/Drive Voltage", driveMotor.getBusVoltage()); + SmartDashboard.putNumber(getID() + "/Turn Voltage", turnMotor.getBusVoltage()); + SmartDashboard.putNumber(getID() + "/Turn Current", turnMotor.getOutputCurrent()); + SmartDashboard.putNumber(getID() + "/Raw Encoder Angle", Units.rotationsToDegrees(turnEnoder.getAbsolutePosition().getValueAsDouble())); + SmartDashboard.putNumber(getID() + "/Target Angle", Units.rotationsToDegrees(targetState.angle.getRadians())); + SmartDashboard.putNumber(getID() + "/Target Speed", targetState.speedMetersPerSecond); } }