From 93d91aab0c4e9c3d2508c30f635cc3f74893c09f Mon Sep 17 00:00:00 2001 From: Technologyman00 Date: Wed, 17 Jan 2024 20:55:05 -0600 Subject: [PATCH] Fixed getDriveBaseRadiusMeters() as it incorrectly assumed there will always be 4 modules. Previously assumed there would be 4 modules now allows for any amount greater than 2. --- .../parser/SwerveDriveConfiguration.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/swervelib/parser/SwerveDriveConfiguration.java b/src/main/java/swervelib/parser/SwerveDriveConfiguration.java index 3e416783..6309e680 100644 --- a/src/main/java/swervelib/parser/SwerveDriveConfiguration.java +++ b/src/main/java/swervelib/parser/SwerveDriveConfiguration.java @@ -89,19 +89,14 @@ public SwerveModule[] createModules(SwerveModuleConfiguration[] swerves, SimpleM */ public double getDriveBaseRadiusMeters() { - //Find Center of Robot by adding all module offsets together. Should be zero, but incase it isn't - Translation2d centerOfModules = moduleLocationsMeters[0].plus(moduleLocationsMeters[1]) - .plus(moduleLocationsMeters[2]).plus(moduleLocationsMeters[3]); + Translation2d centerOfModules = moduleLocationsMeters[0]; - //Find Largest Radius by checking the distance to the center point - double largestRadius = centerOfModules.getDistance(moduleLocationsMeters[0]); + //Calculate the Center by adding all module offsets together. for(int i=1; i