From 0157dcd9348051a6c2585ddda4f0c085e7798e99 Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 4 Mar 2024 20:18:33 -0800 Subject: [PATCH] turns off pid if arm overshoots --- src/main/java/org/carlmontrobotics/subsystems/Arm.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/carlmontrobotics/subsystems/Arm.java b/src/main/java/org/carlmontrobotics/subsystems/Arm.java index 66251b34..5e5569a6 100644 --- a/src/main/java/org/carlmontrobotics/subsystems/Arm.java +++ b/src/main/java/org/carlmontrobotics/subsystems/Arm.java @@ -166,7 +166,7 @@ private void driveArm() { armFeedVolts = armFeed.calculate(getCurrentArmGoal().position, 0); } armPIDMaster.setReference(setPoint.position, CANSparkBase.ControlType.kVelocity, 0, armFeedVolts); - if (armAtSetpoint()){ + if (armAtSetpoint() || getArmPos() > setPoint.position){ armPIDMaster.setIZone(Double.POSITIVE_INFINITY);//turns off pid once it reaches the setpoint } else {