From 1dab35197a01d7e80947f2a48d846219954076cb Mon Sep 17 00:00:00 2001 From: Vincent Dizon Date: Tue, 14 Nov 2023 16:07:35 -0600 Subject: [PATCH 1/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 25bff00..ae6b19f 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ SwerveDrive swerveDrive=new SwerveParser(new File(Filesystem.getDeployDirectory( # Library Information ### Installation - [ ] Install NavX Library -- [ ] Install Pheonix Library +- [ ] Install Phoenix Library - [ ] Install REVLib. - [ ] Install YAGSL (`https://broncbotz3481.github.io/YAGSL-Lib/yagsl/yagsl.json`) From 761c6e2ee2ecc5761369ecd56333689f6f9ee998 Mon Sep 17 00:00:00 2001 From: thenetworkgrinch Date: Wed, 15 Nov 2023 12:28:24 -0600 Subject: [PATCH 2/3] Update fix to REV Throughbore --- swervelib/parser/json/DeviceJson.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swervelib/parser/json/DeviceJson.java b/swervelib/parser/json/DeviceJson.java index de9685d..2d5f46f 100644 --- a/swervelib/parser/json/DeviceJson.java +++ b/swervelib/parser/json/DeviceJson.java @@ -71,11 +71,11 @@ public class DeviceJson case "ma3": case "ctre_mag": case "rev_hex": + case "throughbore": case "am_mag": case "dutycycle": return new PWMDutyCycleEncoderSwerve(id); case "thrifty": - case "throughbore": case "analog": return new AnalogAbsoluteEncoderSwerve(id); case "cancoder": From a6b43076f043963d7e90f34d97fe24bdbe5051b1 Mon Sep 17 00:00:00 2001 From: Technologyman00 Date: Mon, 20 Nov 2023 20:34:28 -0600 Subject: [PATCH 3/3] Display Errors with Reading the Absolute Encoders Display Errors with Reading the Absolute Encoder --- swervelib/SwerveDrive.java | 2 ++ swervelib/SwerveModule.java | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/swervelib/SwerveDrive.java b/swervelib/SwerveDrive.java index 043c71d..bd10794 100644 --- a/swervelib/SwerveDrive.java +++ b/swervelib/SwerveDrive.java @@ -901,6 +901,8 @@ public class SwerveDrive "Module[" + module.configuration.name + "] Relative Encoder", module.getRelativePosition()); SmartDashboard.putNumber( "Module[" + module.configuration.name + "] Absolute Encoder", module.getAbsolutePosition()); + SmartDashboard.putNumber( + "Module[" + module.configuration.name + "] Absolute Encoder Read Issue", module.getAbsoluteEncoderReadIssue()); } if (SwerveDriveTelemetry.verbosity.ordinal() >= TelemetryVerbosity.HIGH.ordinal()) { diff --git a/swervelib/SwerveModule.java b/swervelib/SwerveModule.java index 28744bd..285b9b6 100644 --- a/swervelib/SwerveModule.java +++ b/swervelib/SwerveModule.java @@ -65,6 +65,11 @@ public class SwerveModule */ private boolean synchronizeEncoderQueued = false; + /** + * Absolute Encoder Read Issue Dectected. + */ + public boolean absoluteEncoderReadIssue = false; + /** * Construct the swerve module and initialize the swerve module motors and absolute encoder. * @@ -298,13 +303,16 @@ public class SwerveModule double angle; if (absoluteEncoder != null) { + absoluteEncoderReadIssue = false; angle = absoluteEncoder.getAbsolutePosition() - angleOffset; if (absoluteEncoder.readingError) { + absoluteEncoderReadIssue = true; angle = getRelativePosition(); } } else { + absoluteEncoderReadIssue = true; angle = getRelativePosition(); } angle %= 360; @@ -387,4 +395,14 @@ public class SwerveModule { return configuration; } + + /* + * Get if the last Absolute Encoder had a read issue. + * + * @return If the last Absolute Encoder had a read issue. + */ + public boolean getAbsoluteEncoderReadIssue() + { + return absoluteEncoderReadIssue; + } }