From 18868af24f940d2188b7e6f3c6d6d7ae41517fc0 Mon Sep 17 00:00:00 2001 From: Robert Atkinson Date: Sat, 28 Nov 2015 21:23:00 -0800 Subject: [PATCH] fix servo positioning bug Former-commit-id: 64a639bb37825090a8e2592781ef186bd35336a1 Former-commit-id: 7ddb20ecffd69dbf12e3a30bb71bd135a1d918ac --- .../library/internal/EasyLegacyServoController.java | 3 +-- .../library/internal/EasyModernServoController.java | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/SwerveRoboticsLibrary/src/main/java/org/swerverobotics/library/internal/EasyLegacyServoController.java b/SwerveRoboticsLibrary/src/main/java/org/swerverobotics/library/internal/EasyLegacyServoController.java index 3e9ecbc13d0..c03d7ce5838 100644 --- a/SwerveRoboticsLibrary/src/main/java/org/swerverobotics/library/internal/EasyLegacyServoController.java +++ b/SwerveRoboticsLibrary/src/main/java/org/swerverobotics/library/internal/EasyLegacyServoController.java @@ -4,7 +4,6 @@ import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.hardware.*; import com.qualcomm.robotcore.util.Range; -import com.qualcomm.robotcore.util.TypeConversion; import org.swerverobotics.library.BuildConfig; import org.swerverobotics.library.SynchronousOpMode; import org.swerverobotics.library.interfaces.*; @@ -270,7 +269,7 @@ public synchronized void setServoPosition(int servo, double position) { validateServo(servo); position = Range.clip(position, positionMin, positionMax); // note: runtime formerly threw on range error - double bPosition = Range.scale(position, positionMin, positionMax, bPositionMin, bPositionMax); + double bPosition = Range.scale(position, positionMin, positionMax, regPositionMin, regPositionMax); this.write(ADDRESS_CHANNEL_MAP[servo], bPosition); this.pwmEnable(); diff --git a/SwerveRoboticsLibrary/src/main/java/org/swerverobotics/library/internal/EasyModernServoController.java b/SwerveRoboticsLibrary/src/main/java/org/swerverobotics/library/internal/EasyModernServoController.java index 1b05f95a22b..aea262e7bfc 100644 --- a/SwerveRoboticsLibrary/src/main/java/org/swerverobotics/library/internal/EasyModernServoController.java +++ b/SwerveRoboticsLibrary/src/main/java/org/swerverobotics/library/internal/EasyModernServoController.java @@ -36,8 +36,8 @@ public class EasyModernServoController extends EasyModernController implements S public static final double positionMin = 0.0; public static final double positionMax = 1.0; - public static final byte bPositionMin = 0; - public static final byte bPositionMax = (byte)255; + public static final double regPositionMin = 0; + public static final double regPositionMax = 255; private List servos; private final double[] servoPositions; @@ -233,7 +233,7 @@ public void setServoPosition(int servo, double position) { validateServo(servo); position = Range.clip(position, positionMin, positionMax); // note: runtime formerly threw on range error - double bPosition = Range.scale(position, positionMin, positionMax, bPositionMin, bPositionMax); + double bPosition = Range.scale(position, positionMin, positionMax, regPositionMin, regPositionMax); this.write(ADDRESS_CHANNEL_MAP[servo], bPosition); this.pwmEnable();