From 49c7a17a01519dd167a0622853f3a0d69661d1e0 Mon Sep 17 00:00:00 2001 From: ryanknj5 <140574269+ryanknj5@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:57:36 -0700 Subject: [PATCH] spotless --- src/main/java/frc/robot/arm/ArmSubsystem.java | 65 +++++++++++++------ 1 file changed, 46 insertions(+), 19 deletions(-) diff --git a/src/main/java/frc/robot/arm/ArmSubsystem.java b/src/main/java/frc/robot/arm/ArmSubsystem.java index b825669..f754cd1 100644 --- a/src/main/java/frc/robot/arm/ArmSubsystem.java +++ b/src/main/java/frc/robot/arm/ArmSubsystem.java @@ -4,7 +4,6 @@ import com.ctre.phoenix6.hardware.TalonFX; import dev.doglog.DogLog; import edu.wpi.first.math.MathUtil; -import edu.wpi.first.math.geometry.Rotation2d; import edu.wpi.first.math.interpolation.InterpolatingDoubleTreeMap; import edu.wpi.first.math.util.Units; import edu.wpi.first.wpilibj.DriverStation; @@ -119,49 +118,75 @@ protected void afterTransition(ArmState newState) { case CLIMBING_1_LINEUP -> { leftMotor.setControl( - positionRequest.withPosition(Units.degreesToRotations(clamp(ArmAngle.CLIMBING_1_LINEUP.getDegrees())))); + positionRequest.withPosition( + Units.degreesToRotations(clamp(ArmAngle.CLIMBING_1_LINEUP.getDegrees())))); rightMotor.setControl( - positionRequest.withPosition(Units.degreesToRotations(clamp(ArmAngle.CLIMBING_1_LINEUP.getDegrees())))); + positionRequest.withPosition( + Units.degreesToRotations(clamp(ArmAngle.CLIMBING_1_LINEUP.getDegrees())))); } case CLIMBING_2_HANGING -> { leftMotor.setControl( - positionRequest.withPosition(Units.degreesToRotations(clamp(ArmAngle.CLIMBING_2_HANGING.getDegrees())))); + positionRequest.withPosition( + Units.degreesToRotations(clamp(ArmAngle.CLIMBING_2_HANGING.getDegrees())))); rightMotor.setControl( - positionRequest.withPosition(Units.degreesToRotations(clamp(ArmAngle.CLIMBING_2_HANGING.getDegrees())))); + positionRequest.withPosition( + Units.degreesToRotations(clamp(ArmAngle.CLIMBING_2_HANGING.getDegrees())))); } case DROP -> { - leftMotor.setControl(positionRequest.withPosition(Units.degreesToRotations(clamp(ArmAngle.DROP.getDegrees())))); - rightMotor.setControl(positionRequest.withPosition(Units.degreesToRotations(clamp(ArmAngle.DROP.getDegrees())))); + leftMotor.setControl( + positionRequest.withPosition( + Units.degreesToRotations(clamp(ArmAngle.DROP.getDegrees())))); + rightMotor.setControl( + positionRequest.withPosition( + Units.degreesToRotations(clamp(ArmAngle.DROP.getDegrees())))); } case PODIUM_SHOT -> { - leftMotor.setControl(positionRequest.withPosition(Units.degreesToRotations(clamp(ArmAngle.PODIUM.getDegrees())))); - rightMotor.setControl(positionRequest.withPosition(Units.degreesToRotations(clamp(ArmAngle.PODIUM.getDegrees())))); + leftMotor.setControl( + positionRequest.withPosition( + Units.degreesToRotations(clamp(ArmAngle.PODIUM.getDegrees())))); + rightMotor.setControl( + positionRequest.withPosition( + Units.degreesToRotations(clamp(ArmAngle.PODIUM.getDegrees())))); } case SUBWOOFER_SHOT -> { - leftMotor.setControl(positionRequest.withPosition(Units.degreesToRotations(clamp(ArmAngle.SUBWOOFER.getDegrees())))); - rightMotor.setControl(positionRequest.withPosition(Units.degreesToRotations(clamp(ArmAngle.SUBWOOFER.getDegrees())))); + leftMotor.setControl( + positionRequest.withPosition( + Units.degreesToRotations(clamp(ArmAngle.SUBWOOFER.getDegrees())))); + rightMotor.setControl( + positionRequest.withPosition( + Units.degreesToRotations(clamp(ArmAngle.SUBWOOFER.getDegrees())))); } case FEEDING -> { - double newAngle = Units.degreesToRotations(clamp(feedSpotDistanceToAngle.get(distanceToFeedSpot))); + double newAngle = + Units.degreesToRotations(clamp(feedSpotDistanceToAngle.get(distanceToFeedSpot))); leftMotor.setControl(positionRequest.withPosition(newAngle)); rightMotor.setControl(positionRequest.withPosition(newAngle)); } case SPEAKER_SHOT -> { - var newAngle = Units.degreesToRotations(clamp(speakerDistanceToAngle.get(distanceToSpeaker))); + var newAngle = + Units.degreesToRotations(clamp(speakerDistanceToAngle.get(distanceToSpeaker))); leftMotor.setControl(positionRequest.withPosition(newAngle)); rightMotor.setControl(positionRequest.withPosition(newAngle)); } case AMP -> { - leftMotor.setControl(positionRequest.withPosition(Units.degreesToRotations(clamp(ArmAngle.AMP.getDegrees())))); - rightMotor.setControl(positionRequest.withPosition(Units.degreesToRotations(clamp(ArmAngle.AMP.getDegrees())))); + leftMotor.setControl( + positionRequest.withPosition( + Units.degreesToRotations(clamp(ArmAngle.AMP.getDegrees())))); + rightMotor.setControl( + positionRequest.withPosition( + Units.degreesToRotations(clamp(ArmAngle.AMP.getDegrees())))); } case PASS -> { - leftMotor.setControl(positionRequest.withPosition(Units.degreesToRotations(clamp(ArmAngle.PASS.getDegrees())))); - rightMotor.setControl(positionRequest.withPosition(Units.degreesToRotations(clamp(ArmAngle.PASS.getDegrees())))); + leftMotor.setControl( + positionRequest.withPosition( + Units.degreesToRotations(clamp(ArmAngle.PASS.getDegrees())))); + rightMotor.setControl( + positionRequest.withPosition( + Units.degreesToRotations(clamp(ArmAngle.PASS.getDegrees())))); } } } @@ -194,7 +219,9 @@ public void robotPeriodic() { setStateFromRequest(ArmState.IDLE); } } - private static double clamp(double armAngle){ - return MathUtil.clamp(armAngle,RobotConfig.get().arm().minAngle(),RobotConfig.get().arm().maxAngle()); + + private static double clamp(double armAngle) { + return MathUtil.clamp( + armAngle, RobotConfig.get().arm().minAngle(), RobotConfig.get().arm().maxAngle()); } }