diff --git a/datalogtool/src/main/native/cpp/Downloader.cpp b/datalogtool/src/main/native/cpp/Downloader.cpp index 9629e3b0ffe..88e2aa6f92e 100644 --- a/datalogtool/src/main/native/cpp/Downloader.cpp +++ b/datalogtool/src/main/native/cpp/Downloader.cpp @@ -427,7 +427,7 @@ void Downloader::ThreadMain() { continue; } lock.lock(); - err: {} + err : {} } if (m_state == kDownload) { m_state = kDownloadDone; diff --git a/ntcore/src/test/java/edu/wpi/first/networktables/RawTest.java b/ntcore/src/test/java/edu/wpi/first/networktables/RawTest.java index 0e39470d404..4136749b770 100644 --- a/ntcore/src/test/java/edu/wpi/first/networktables/RawTest.java +++ b/ntcore/src/test/java/edu/wpi/first/networktables/RawTest.java @@ -4,14 +4,13 @@ package edu.wpi.first.networktables; +import static org.junit.jupiter.api.Assertions.*; + import java.nio.ByteBuffer; -import java.util.Arrays; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.*; - @SuppressWarnings("PMD.SimplifiableTestAssertion") class RawTest { private NetworkTableInstance m_inst; @@ -30,9 +29,9 @@ void tearDown() { void testGenericByteArray() { GenericEntry entry = m_inst.getTopic("test").getGenericEntry("raw"); entry.setRaw(new byte[] {5}, 10); - assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{5}); + assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {5}); entry.setRaw(new byte[] {5, 6, 7}, 1, 2, 15); - assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{6, 7}); + assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {6, 7}); assertThrows(IndexOutOfBoundsException.class, () -> entry.setRaw(new byte[] {5}, -1, 2, 20)); assertThrows(IndexOutOfBoundsException.class, () -> entry.setRaw(new byte[] {5}, 1, -2, 20)); assertThrows(IndexOutOfBoundsException.class, () -> entry.setRaw(new byte[] {5}, 1, 1, 20)); @@ -42,9 +41,9 @@ void testGenericByteArray() { void testRawByteArray() { RawEntry entry = m_inst.getRawTopic("test").getEntry("raw", new byte[] {}); entry.set(new byte[] {5}, 10); - assertArrayEquals(entry.get(new byte[]{}), new byte[]{5}); + assertArrayEquals(entry.get(new byte[] {}), new byte[] {5}); entry.set(new byte[] {5, 6, 7}, 1, 2, 15); - assertArrayEquals(entry.get(new byte[]{}), new byte[]{6, 7}); + assertArrayEquals(entry.get(new byte[] {}), new byte[] {6, 7}); assertThrows(IndexOutOfBoundsException.class, () -> entry.set(new byte[] {5}, -1, 1, 20)); assertThrows(IndexOutOfBoundsException.class, () -> entry.set(new byte[] {5}, 1, -1, 20)); assertThrows(IndexOutOfBoundsException.class, () -> entry.set(new byte[] {5}, 1, 1, 20)); @@ -54,15 +53,15 @@ void testRawByteArray() { void testGenericByteBuffer() { GenericEntry entry = m_inst.getTopic("test").getGenericEntry("raw"); entry.setRaw(ByteBuffer.wrap(new byte[] {5}), 10); - assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{5}); + assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {5}); entry.setRaw(ByteBuffer.wrap(new byte[] {5, 6, 7}).position(1), 15); - assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{6, 7}); + assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {6, 7}); entry.setRaw(ByteBuffer.wrap(new byte[] {5, 6, 7}).position(1).limit(2), 16); - assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{6}); + assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {6}); entry.setRaw(ByteBuffer.wrap(new byte[] {8, 9, 0}), 1, 2, 20); - assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{9, 0}); + assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {9, 0}); entry.setRaw(ByteBuffer.wrap(new byte[] {1, 2, 3}).position(2), 0, 2, 25); - assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{1, 2}); + assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {1, 2}); assertThrows( IndexOutOfBoundsException.class, () -> entry.setRaw(ByteBuffer.wrap(new byte[] {5}), -1, 1, 30)); @@ -78,15 +77,15 @@ void testGenericByteBuffer() { void testRawByteBuffer() { RawEntry entry = m_inst.getRawTopic("test").getEntry("raw", new byte[] {}); entry.set(ByteBuffer.wrap(new byte[] {5}), 10); - assertArrayEquals(entry.get(new byte[]{}), new byte[]{5}); + assertArrayEquals(entry.get(new byte[] {}), new byte[] {5}); entry.set(ByteBuffer.wrap(new byte[] {5, 6, 7}).position(1), 15); - assertArrayEquals(entry.get(new byte[]{}), new byte[]{6, 7}); + assertArrayEquals(entry.get(new byte[] {}), new byte[] {6, 7}); entry.set(ByteBuffer.wrap(new byte[] {5, 6, 7}).position(1).limit(2), 16); - assertArrayEquals(entry.get(new byte[]{}), new byte[]{6}); + assertArrayEquals(entry.get(new byte[] {}), new byte[] {6}); entry.set(ByteBuffer.wrap(new byte[] {8, 9, 0}), 1, 2, 20); - assertArrayEquals(entry.get(new byte[]{}), new byte[]{9, 0}); + assertArrayEquals(entry.get(new byte[] {}), new byte[] {9, 0}); entry.set(ByteBuffer.wrap(new byte[] {1, 2, 3}).position(2), 0, 2, 25); - assertArrayEquals(entry.get(new byte[]{}), new byte[]{1, 2}); + assertArrayEquals(entry.get(new byte[] {}), new byte[] {1, 2}); assertThrows( IndexOutOfBoundsException.class, () -> entry.set(ByteBuffer.wrap(new byte[] {5}), -1, 1, 30)); @@ -104,13 +103,13 @@ void testGenericNativeByteBuffer() { ByteBuffer bb = ByteBuffer.allocateDirect(3); bb.put(new byte[] {5, 6, 7}); entry.setRaw(bb.position(1), 15); - assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{6, 7}); + assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {6, 7}); entry.setRaw(bb.limit(2), 16); - assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{6}); + assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {6}); bb.clear(); bb.put(new byte[] {8, 9, 0}); entry.setRaw(bb, 1, 2, 20); - assertArrayEquals(entry.getRaw(new byte[]{}), new byte[]{9, 0}); + assertArrayEquals(entry.getRaw(new byte[] {}), new byte[] {9, 0}); assertThrows(IndexOutOfBoundsException.class, () -> entry.setRaw(bb, -1, 1, 25)); assertThrows(IndexOutOfBoundsException.class, () -> entry.setRaw(bb, 1, -1, 25)); assertThrows(IndexOutOfBoundsException.class, () -> entry.setRaw(bb, 2, 2, 25)); @@ -122,13 +121,13 @@ void testRawNativeByteBuffer() { ByteBuffer bb = ByteBuffer.allocateDirect(3); bb.put(new byte[] {5, 6, 7}); entry.set(bb.position(1), 15); - assertArrayEquals(entry.get(new byte[]{}), new byte[]{6, 7}); + assertArrayEquals(entry.get(new byte[] {}), new byte[] {6, 7}); entry.set(bb.limit(2), 16); - assertArrayEquals(entry.get(new byte[]{}), new byte[]{6}); + assertArrayEquals(entry.get(new byte[] {}), new byte[] {6}); bb.clear(); bb.put(new byte[] {8, 9, 0}); entry.set(bb, 1, 2, 20); - assertArrayEquals(entry.get(new byte[]{}), new byte[]{9, 0}); + assertArrayEquals(entry.get(new byte[] {}), new byte[] {9, 0}); assertThrows(IndexOutOfBoundsException.class, () -> entry.set(bb, -1, 1, 25)); assertThrows(IndexOutOfBoundsException.class, () -> entry.set(bb, 1, -1, 25)); assertThrows(IndexOutOfBoundsException.class, () -> entry.set(bb, 2, 2, 25)); diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStation.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStation.java index 7272d6e4779..09507c160f3 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStation.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DriverStation.java @@ -237,10 +237,10 @@ public void send(long timestamp) { needToLog = true; } else { for (int i = 0; i < count; i++) { - if (axes.m_axes[i] != m_prevAxes.m_axes[i]) { - needToLog = true; - break; - } + if (axes.m_axes[i] != m_prevAxes.m_axes[i]) { + needToLog = true; + break; + } } } if (needToLog) { @@ -254,10 +254,10 @@ public void send(long timestamp) { needToLog = true; } else { for (int i = 0; i < count; i++) { - if (povs.m_povs[i] != m_prevPOVs.m_povs[i]) { - needToLog = true; - break; - } + if (povs.m_povs[i] != m_prevPOVs.m_povs[i]) { + needToLog = true; + break; + } } } if (needToLog) { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticHub.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticHub.java index 7bb613e02e8..698ef8e5041 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticHub.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticHub.java @@ -59,8 +59,7 @@ private static class DataStore implements AutoCloseable { output.write(("currentVersion=" + fwVersion).getBytes(StandardCharsets.UTF_8)); } } catch (IOException ex) { - DriverStation.reportError( - "Could not write " + fileName + ": " + ex, ex.getStackTrace()); + DriverStation.reportError("Could not write " + fileName + ": " + ex, ex.getStackTrace()); } } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java index bf7227e7557..73e4e092cd1 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java @@ -321,8 +321,7 @@ private static void runRobot(Supplier robotSupplier) { robotName = elements[0].getClassName(); } DriverStation.reportError( - "Unhandled exception instantiating robot " + robotName + " " + throwable, - elements); + "Unhandled exception instantiating robot " + robotName + " " + throwable, elements); DriverStation.reportError( "The robot program quit unexpectedly." + " This is usually due to a code error.\n" @@ -353,8 +352,7 @@ private static void runRobot(Supplier robotSupplier) { output.write(WPILibVersion.Version.getBytes(StandardCharsets.UTF_8)); } } catch (IOException ex) { - DriverStation.reportError( - "Could not write FRC_Lib_Version.ini: " + ex, ex.getStackTrace()); + DriverStation.reportError("Could not write FRC_Lib_Version.ini: " + ex, ex.getStackTrace()); } } @@ -366,8 +364,7 @@ private static void runRobot(Supplier robotSupplier) { if (cause != null) { throwable = cause; } - DriverStation.reportError( - "Unhandled exception: " + throwable, throwable.getStackTrace()); + DriverStation.reportError("Unhandled exception: " + throwable, throwable.getStackTrace()); errorOnExit = true; } finally { m_runMutex.lock(); diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/FieldObject2d.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/FieldObject2d.java index 14e2b47f46e..34d40cd72d9 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/FieldObject2d.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/FieldObject2d.java @@ -84,7 +84,7 @@ public synchronized void setPoses(List poses) { */ public synchronized void setPoses(Pose2d... poses) { m_poses.clear(); - Collections.addAll(m_poses, poses); + Collections.addAll(m_poses, poses); updateEntry(); } diff --git a/wpimath/src/main/java/edu/wpi/first/math/Matrix.java b/wpimath/src/main/java/edu/wpi/first/math/Matrix.java index de99faea9f5..e7f41f6ecc9 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/Matrix.java +++ b/wpimath/src/main/java/edu/wpi/first/math/Matrix.java @@ -607,8 +607,7 @@ public Matrix lltDecompose(boolean lowerTriangular) { return new Matrix<>(new SimpleMatrix(temp.getNumRows(), temp.getNumCols())); } - throw new RuntimeException( - "Cholesky decomposition failed! Input matrix:\n" + m_storage); + throw new RuntimeException("Cholesky decomposition failed! Input matrix:\n" + m_storage); } return new Matrix<>(SimpleMatrix.wrap(chol.getT(null))); diff --git a/wpimath/src/main/java/edu/wpi/first/math/spline/CubicHermiteSpline.java b/wpimath/src/main/java/edu/wpi/first/math/spline/CubicHermiteSpline.java index db5089db31c..402f6139f07 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/spline/CubicHermiteSpline.java +++ b/wpimath/src/main/java/edu/wpi/first/math/spline/CubicHermiteSpline.java @@ -101,11 +101,8 @@ private SimpleMatrix makeHermiteBasis() { // [a₀] = [ 1 0 0 0][P'(i+1)] hermiteBasis = new SimpleMatrix( - 4, - 4, - true, - +2.0, +1.0, -2.0, +1.0, -3.0, -2.0, +3.0, -1.0, +0.0, +1.0, +0.0, +0.0, +1.0, +0.0, - +0.0, +0.0); + 4, 4, true, +2.0, +1.0, -2.0, +1.0, -3.0, -2.0, +3.0, -1.0, +0.0, +1.0, +0.0, +0.0, + +1.0, +0.0, +0.0, +0.0); } return hermiteBasis; } @@ -123,10 +120,6 @@ private SimpleMatrix getControlVectorFromArrays(double[] initialVector, double[] throw new IllegalArgumentException("Size of vectors must be 2"); } return new SimpleMatrix( - 4, - 1, - true, - initialVector[0], initialVector[1], - finalVector[0], finalVector[1]); + 4, 1, true, initialVector[0], initialVector[1], finalVector[0], finalVector[1]); } } diff --git a/wpimath/src/main/java/edu/wpi/first/math/spline/QuinticHermiteSpline.java b/wpimath/src/main/java/edu/wpi/first/math/spline/QuinticHermiteSpline.java index 3d459db675e..e9789370ba5 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/spline/QuinticHermiteSpline.java +++ b/wpimath/src/main/java/edu/wpi/first/math/spline/QuinticHermiteSpline.java @@ -108,12 +108,10 @@ private SimpleMatrix makeHermiteBasis() { // [a₀] = [ 1.0 0.0 0.0 0.0 0.0 0.0][P"(i+1)] hermiteBasis = new SimpleMatrix( - 6, - 6, - true, - -06.0, -03.0, -00.5, +06.0, -03.0, +00.5, +15.0, +08.0, +01.5, -15.0, +07.0, -01.0, - -10.0, -06.0, -01.5, +10.0, -04.0, +00.5, +00.0, +00.0, +00.5, +00.0, +00.0, +00.0, - +00.0, +01.0, +00.0, +00.0, +00.0, +00.0, +01.0, +00.0, +00.0, +00.0, +00.0, +00.0); + 6, 6, true, -06.0, -03.0, -00.5, +06.0, -03.0, +00.5, +15.0, +08.0, +01.5, -15.0, + +07.0, -01.0, -10.0, -06.0, -01.5, +10.0, -04.0, +00.5, +00.0, +00.0, +00.5, +00.0, + +00.0, +00.0, +00.0, +01.0, +00.0, +00.0, +00.0, +00.0, +01.0, +00.0, +00.0, +00.0, + +00.0, +00.0); } return hermiteBasis; } @@ -134,7 +132,11 @@ private SimpleMatrix getControlVectorFromArrays(double[] initialVector, double[] 6, 1, true, - initialVector[0], initialVector[1], initialVector[2], - finalVector[0], finalVector[1], finalVector[2]); + initialVector[0], + initialVector[1], + initialVector[2], + finalVector[0], + finalVector[1], + finalVector[2]); } } diff --git a/wpimath/src/test/java/edu/wpi/first/math/estimator/DifferentialDrivePoseEstimatorTest.java b/wpimath/src/test/java/edu/wpi/first/math/estimator/DifferentialDrivePoseEstimatorTest.java index 991d87a3b49..08c5a156cf1 100644 --- a/wpimath/src/test/java/edu/wpi/first/math/estimator/DifferentialDrivePoseEstimatorTest.java +++ b/wpimath/src/test/java/edu/wpi/first/math/estimator/DifferentialDrivePoseEstimatorTest.java @@ -264,7 +264,7 @@ void testSimultaneousVisionMeasurements() { measurement.getRotation().getDegrees() - estimator.getEstimatedPosition().getRotation().getDegrees()); - assertTrue(dx > 0.08 || dy > 0.08 || dtheta > 0.08, errorLog); + assertTrue(dx > 0.08 || dy > 0.08 || dtheta > 0.08, errorLog); } } diff --git a/wpimath/src/test/java/edu/wpi/first/math/estimator/MecanumDrivePoseEstimatorTest.java b/wpimath/src/test/java/edu/wpi/first/math/estimator/MecanumDrivePoseEstimatorTest.java index f1a2cc8855b..ea08a5f1d90 100644 --- a/wpimath/src/test/java/edu/wpi/first/math/estimator/MecanumDrivePoseEstimatorTest.java +++ b/wpimath/src/test/java/edu/wpi/first/math/estimator/MecanumDrivePoseEstimatorTest.java @@ -277,7 +277,7 @@ void testSimultaneousVisionMeasurements() { measurement.getRotation().getDegrees() - estimator.getEstimatedPosition().getRotation().getDegrees()); - assertTrue(dx > 0.08 || dy > 0.08 || dtheta > 0.08, errorLog); + assertTrue(dx > 0.08 || dy > 0.08 || dtheta > 0.08, errorLog); } } diff --git a/wpimath/src/test/java/edu/wpi/first/math/estimator/SwerveDrivePoseEstimatorTest.java b/wpimath/src/test/java/edu/wpi/first/math/estimator/SwerveDrivePoseEstimatorTest.java index 439b2eb9524..f827a102527 100644 --- a/wpimath/src/test/java/edu/wpi/first/math/estimator/SwerveDrivePoseEstimatorTest.java +++ b/wpimath/src/test/java/edu/wpi/first/math/estimator/SwerveDrivePoseEstimatorTest.java @@ -298,7 +298,7 @@ void testSimultaneousVisionMeasurements() { measurement.getRotation().getDegrees() - estimator.getEstimatedPosition().getRotation().getDegrees()); - assertTrue(dx > 0.08 || dy > 0.08 || dtheta > 0.08, errorLog); + assertTrue(dx > 0.08 || dy > 0.08 || dtheta > 0.08, errorLog); } } diff --git a/wpimath/src/test/java/edu/wpi/first/math/spline/CubicHermiteSplineTest.java b/wpimath/src/test/java/edu/wpi/first/math/spline/CubicHermiteSplineTest.java index 3470647bc23..ecff3339199 100644 --- a/wpimath/src/test/java/edu/wpi/first/math/spline/CubicHermiteSplineTest.java +++ b/wpimath/src/test/java/edu/wpi/first/math/spline/CubicHermiteSplineTest.java @@ -14,7 +14,6 @@ import edu.wpi.first.math.geometry.Translation2d; import edu.wpi.first.math.spline.SplineParameterizer.MalformedSplineException; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import org.junit.jupiter.api.Test; @@ -151,7 +150,7 @@ void testMalformed() { () -> run( new Pose2d(10, 10, Rotation2d.fromDegrees(90)), - List.of(new Translation2d(10, 10.5)), + List.of(new Translation2d(10, 10.5)), new Pose2d(10, 11, Rotation2d.fromDegrees(-90)))); } }