diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index e91766a0..47a3efbf 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -10,20 +10,14 @@ concurrency: cancel-in-progress: true jobs: - wrapper-validation: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v7 - - uses: gradle/actions/wrapper-validation@v6 - build: runs-on: ubuntu-latest - needs: wrapper-validation steps: - uses: actions/checkout@v7 - uses: actions/setup-java@v6 with: distribution: temurin java-version: '25' + - uses: gradle/actions/setup-gradle@v6 - run: ./gradlew build working-directory: examples diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index fa2606be..574cfb9d 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -10,12 +10,6 @@ concurrency: cancel-in-progress: true jobs: - wrapper-validation: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v7 - - uses: gradle/actions/wrapper-validation@v6 - website: runs-on: ubuntu-latest steps: @@ -29,12 +23,12 @@ jobs: - run: pnpm format:check examples: runs-on: ubuntu-latest - needs: wrapper-validation steps: - uses: actions/checkout@v7 - uses: actions/setup-java@v6 with: distribution: temurin java-version: '25' + - uses: gradle/actions/setup-gradle@v6 - run: ./gradlew spotlessCheck working-directory: examples diff --git a/examples/gradle.properties b/examples/gradle.properties new file mode 100644 index 00000000..216f58e5 --- /dev/null +++ b/examples/gradle.properties @@ -0,0 +1,2 @@ +org.gradle.caching=true +org.gradle.configuration-cache=true \ No newline at end of file diff --git a/examples/stage0/snippets/build.gradle b/examples/stage0/snippets/build.gradle index 0dfa66f1..77a42427 100644 --- a/examples/stage0/snippets/build.gradle +++ b/examples/stage0/snippets/build.gradle @@ -3,6 +3,10 @@ plugins { id "com.diffplug.spotless" version "8.0.0" } +repositories { + mavenCentral() +} + java { sourceCompatibility = JavaVersion.VERSION_25 targetCompatibility = JavaVersion.VERSION_25 @@ -31,10 +35,46 @@ tasks.register('runSnippets') { dependsOn snippetRunTasks } +def allJavaFiles = fileTree(".") { + include "**/*.java" + exclude "**/build/**", "**/build-*/**" +} + +// Compact source files (JEP 512) declare members at the top level with no enclosing +// type, which google-java-format cannot parse. They only get whitespace cleanup. +def compactSourceFiles = allJavaFiles.filter { it.text =~ /(?m)^void main\(/ } + spotless { java { - target fileTree('.') { include '**/*.java' } - licenseHeaderFile(rootProject.file('../../gradle/LICENSE_HEADER'), "^(?!/\\*|\\s*\\*)") + target allJavaFiles - compactSourceFiles + toggleOffOn() + googleJavaFormat() + trimTrailingWhitespace() + endWithNewline() + } + format "compactSources", { + target compactSourceFiles + trimTrailingWhitespace() + endWithNewline() + } + groovyGradle { + target fileTree(".") { + include "**/*.gradle" + exclude "**/build/**", "**/build-*/**" + } + greclipse() + leadingTabsToSpaces(4) + trimTrailingWhitespace() + endWithNewline() + } + format "misc", { + target fileTree(".") { + include "**/*.md", "**/.gitignore" + exclude "**/build/**", "**/build-*/**" + } + trimTrailingWhitespace() + leadingTabsToSpaces(2) + endWithNewline() } } diff --git a/examples/stage0/snippets/src/Conditionals.java b/examples/stage0/snippets/src/Conditionals.java index b5e3b50b..8a04226c 100644 --- a/examples/stage0/snippets/src/Conditionals.java +++ b/examples/stage0/snippets/src/Conditionals.java @@ -17,7 +17,7 @@ public double setThrottle(double speed) { void main() { - + // [ifSyntax] if (condition) { // code to run when condition is true @@ -84,4 +84,4 @@ void main() { } // [/conditionalExample] -} \ No newline at end of file +} diff --git a/examples/stage0/snippets/src/Debugging.java b/examples/stage0/snippets/src/Debugging.java index c23c7008..cca9bfa5 100644 --- a/examples/stage0/snippets/src/Debugging.java +++ b/examples/stage0/snippets/src/Debugging.java @@ -5,14 +5,14 @@ */ void main() { - + //[logicError1] int width = 2; int height = 5; - int area = width + height; + int area = width + height; System.out.println("Area of the rectangle is " + area); //[/logicError1] - -} \ No newline at end of file + +} diff --git a/examples/stage0/snippets/src/JavaFundamentals.java b/examples/stage0/snippets/src/JavaFundamentals.java index ac936f06..51f036e5 100644 --- a/examples/stage0/snippets/src/JavaFundamentals.java +++ b/examples/stage0/snippets/src/JavaFundamentals.java @@ -26,12 +26,12 @@ void main() { double speed = 1; System.out.println("Left Motor Speed " + speed); //[/stringConcatenation1] - + // [stringConcatenation2] int first = 6; double second = 2.0; - System.out.println(first + " " + second); + System.out.println(first + " " + second); //[/stringConcatenation2] diff --git a/examples/stage0/snippets/src/classes-methods/Point.java b/examples/stage0/snippets/src/classes-methods/Point.java index 2a34dfc3..492fa1a0 100644 --- a/examples/stage0/snippets/src/classes-methods/Point.java +++ b/examples/stage0/snippets/src/classes-methods/Point.java @@ -6,50 +6,60 @@ // [pointFull] class Point { - // [finalFields] - // Each Point has its own x and y coordinates, and they never change. - private final double x; - private final double y; - // [/finalFields] - // [staticConstant] - // Shared by every Point, instead of belonging to just one instance. - public static final Point ORIGIN = new Point(0, 0); - // [/staticConstant] - - // [constructor] - // Sets this Point's coordinates to the given x and y values. - public Point(double x, double y) { - this.x = x; - this.y = y; - } - // [/constructor] - - // [getters] - // Let other classes read the private x and y fields. - public double getX() { return this.x; } - public double getY() { return this.y; } - // [/getters] - - // [plus] - // Adds this Point's coordinates to another Point's coordinates. - public Point plus(Point other) { - return new Point(this.x + other.x, this.y + other.y); - } - // [/plus] - - // [minus] - // Subtracts another Point's coordinates from this Point's coordinates. - public Point minus(Point other) { - return new Point(this.x - other.x, this.y - other.y); - } - // [/minus] - - // [norm] - // Computes this Point's distance from the origin. - public double norm() { - double sumOfSquares = this.x * this.x + this.y * this.y; - return Math.sqrt(sumOfSquares); - } - // [/norm] + // [finalFields] + // Each Point has its own x and y coordinates, and they never change. + private final double x; + private final double y; + // [/finalFields] + // [staticConstant] + // Shared by every Point, instead of belonging to just one instance. + public static final Point ORIGIN = new Point(0, 0); + + // [/staticConstant] + + // [constructor] + // Sets this Point's coordinates to the given x and y values. + public Point(double x, double y) { + this.x = x; + this.y = y; + } + + // [/constructor] + + // [getters] + // Let other classes read the private x and y fields. + public double getX() { + return this.x; + } + + public double getY() { + return this.y; + } + + // [/getters] + + // [plus] + // Adds this Point's coordinates to another Point's coordinates. + public Point plus(Point other) { + return new Point(this.x + other.x, this.y + other.y); + } + + // [/plus] + + // [minus] + // Subtracts another Point's coordinates from this Point's coordinates. + public Point minus(Point other) { + return new Point(this.x - other.x, this.y - other.y); + } + + // [/minus] + + // [norm] + // Computes this Point's distance from the origin. + public double norm() { + double sumOfSquares = this.x * this.x + this.y * this.y; + return Math.sqrt(sumOfSquares); + } + // [/norm] } // [/pointFull] diff --git a/examples/stage0/snippets/src/classes-methods/RobotTracker.java b/examples/stage0/snippets/src/classes-methods/RobotTracker.java index 96e4cace..b2d2beba 100644 --- a/examples/stage0/snippets/src/classes-methods/RobotTracker.java +++ b/examples/stage0/snippets/src/classes-methods/RobotTracker.java @@ -6,52 +6,58 @@ // [robotTrackerFull] class RobotTracker { - // [mutableField] - // Not final, since the robot's position changes as it moves. - private Point position; - // [/mutableField] - - // [robotTrackerConstructor] - // Starts tracking from a given position. - public RobotTracker(Point startPosition) { - this.position = startPosition; - } - // [/robotTrackerConstructor] - - // [constructorChaining] - // Starts tracking from the origin by default. - public RobotTracker() { - this(Point.ORIGIN); - } - // [/constructorChaining] - - // [stateMutation] - // Moves the tracked position by delta. - public void move(Point delta) { - this.position = this.position.plus(delta); - } - // [/stateMutation] - - // [localVariableChain] - // Finds the straight-line distance from the current position to target. - public double distanceTo(Point target) { - Point diff = target.minus(this.position); - return diff.norm(); - } - // [/localVariableChain] - - // [getPosition] - // Lets other classes read the current position. - public Point getPosition() { - return this.position; - } - // [/getPosition] - - // [useStaticConstant] - // Moves the tracked position back to the origin. - public void reset() { - this.position = Point.ORIGIN; - } - // [/useStaticConstant] + // [mutableField] + // Not final, since the robot's position changes as it moves. + private Point position; + + // [/mutableField] + + // [robotTrackerConstructor] + // Starts tracking from a given position. + public RobotTracker(Point startPosition) { + this.position = startPosition; + } + + // [/robotTrackerConstructor] + + // [constructorChaining] + // Starts tracking from the origin by default. + public RobotTracker() { + this(Point.ORIGIN); + } + + // [/constructorChaining] + + // [stateMutation] + // Moves the tracked position by delta. + public void move(Point delta) { + this.position = this.position.plus(delta); + } + + // [/stateMutation] + + // [localVariableChain] + // Finds the straight-line distance from the current position to target. + public double distanceTo(Point target) { + Point diff = target.minus(this.position); + return diff.norm(); + } + + // [/localVariableChain] + + // [getPosition] + // Lets other classes read the current position. + public Point getPosition() { + return this.position; + } + + // [/getPosition] + + // [useStaticConstant] + // Moves the tracked position back to the origin. + public void reset() { + this.position = Point.ORIGIN; + } + // [/useStaticConstant] } // [/robotTrackerFull] diff --git a/examples/stage0/snippets/src/interfaces-lists/DistanceSensor.java b/examples/stage0/snippets/src/interfaces-lists/DistanceSensor.java index 888695bf..81e7893a 100644 --- a/examples/stage0/snippets/src/interfaces-lists/DistanceSensor.java +++ b/examples/stage0/snippets/src/interfaces-lists/DistanceSensor.java @@ -6,6 +6,6 @@ // [distanceSensorInterface] interface DistanceSensor { - double getDistanceMeters(); + double getDistanceMeters(); } // [/distanceSensorInterface] diff --git a/examples/stage0/snippets/src/interfaces-lists/LidarSensor.java b/examples/stage0/snippets/src/interfaces-lists/LidarSensor.java index eba15f4f..bbaf6f05 100644 --- a/examples/stage0/snippets/src/interfaces-lists/LidarSensor.java +++ b/examples/stage0/snippets/src/interfaces-lists/LidarSensor.java @@ -6,10 +6,10 @@ // [lidarSensorClass] class LidarSensor implements DistanceSensor { - @Override - public double getDistanceMeters() { - // In real life, this would actually interact with hardware - return 1.2; - } + @Override + public double getDistanceMeters() { + // In real life, this would actually interact with hardware + return 1.2; + } } // [/lidarSensorClass] diff --git a/examples/stage0/snippets/src/interfaces-lists/Pair.java b/examples/stage0/snippets/src/interfaces-lists/Pair.java index a251b208..063fb56e 100644 --- a/examples/stage0/snippets/src/interfaces-lists/Pair.java +++ b/examples/stage0/snippets/src/interfaces-lists/Pair.java @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - // [pairClass] public class Pair { private final A first; @@ -23,4 +22,4 @@ public B getSecond() { return second; } } -// [/pairClass] \ No newline at end of file +// [/pairClass] diff --git a/examples/stage0/snippets/src/interfaces-lists/RobotHistoryTracker.java b/examples/stage0/snippets/src/interfaces-lists/RobotHistoryTracker.java index 3e1d9921..5915d4ab 100644 --- a/examples/stage0/snippets/src/interfaces-lists/RobotHistoryTracker.java +++ b/examples/stage0/snippets/src/interfaces-lists/RobotHistoryTracker.java @@ -9,25 +9,25 @@ // [robotHistoryTrackerClass] class RobotHistoryTracker { - private Point position; - private final List history = new ArrayList<>(); + private Point position; + private final List history = new ArrayList<>(); - public RobotHistoryTracker(Point startPosition) { - this.position = startPosition; - this.history.add(startPosition); - } + public RobotHistoryTracker(Point startPosition) { + this.position = startPosition; + this.history.add(startPosition); + } - public void move(Point delta) { - this.position = this.position.plus(delta); - this.history.add(this.position); - } + public void move(Point delta) { + this.position = this.position.plus(delta); + this.history.add(this.position); + } - public Point getPosition() { - return this.position; - } + public Point getPosition() { + return this.position; + } - public List getHistory() { - return this.history; - } + public List getHistory() { + return this.history; + } } // [/robotHistoryTrackerClass] diff --git a/examples/stage0/snippets/src/interfaces-lists/UltrasonicSensor.java b/examples/stage0/snippets/src/interfaces-lists/UltrasonicSensor.java index 5c305e46..24203a43 100644 --- a/examples/stage0/snippets/src/interfaces-lists/UltrasonicSensor.java +++ b/examples/stage0/snippets/src/interfaces-lists/UltrasonicSensor.java @@ -6,10 +6,10 @@ // [ultrasonicSensorClass] class UltrasonicSensor implements DistanceSensor { - @Override - public double getDistanceMeters() { - // In real life, this would actually interact with hardware - return 1.5; - } + @Override + public double getDistanceMeters() { + // In real life, this would actually interact with hardware + return 1.5; + } } // [/ultrasonicSensorClass] diff --git a/examples/stage0/solutions/build.gradle b/examples/stage0/solutions/build.gradle index 1be82b48..8711d350 100644 --- a/examples/stage0/solutions/build.gradle +++ b/examples/stage0/solutions/build.gradle @@ -3,6 +3,10 @@ plugins { id "com.diffplug.spotless" version "8.0.0" } +repositories { + mavenCentral() +} + java { sourceCompatibility = JavaVersion.VERSION_25 targetCompatibility = JavaVersion.VERSION_25 @@ -31,10 +35,46 @@ tasks.register('runSolutions') { dependsOn solutionRunTasks } +def allJavaFiles = fileTree(".") { + include "**/*.java" + exclude "**/build/**", "**/build-*/**" +} + +// Compact source files (JEP 512) declare members at the top level with no enclosing +// type, which google-java-format cannot parse. They only get whitespace cleanup. +def compactSourceFiles = allJavaFiles.filter { it.text =~ /(?m)^void main\(/ } + spotless { java { - target fileTree('.') { include '**/*.java' } - licenseHeaderFile(rootProject.file('../../gradle/LICENSE_HEADER'), "^(?!/\\*|\\s*\\*)") + target allJavaFiles - compactSourceFiles + toggleOffOn() + googleJavaFormat() + trimTrailingWhitespace() + endWithNewline() + } + format "compactSources", { + target compactSourceFiles + trimTrailingWhitespace() + endWithNewline() + } + groovyGradle { + target fileTree(".") { + include "**/*.gradle" + exclude "**/build/**", "**/build-*/**" + } + greclipse() + leadingTabsToSpaces(4) + trimTrailingWhitespace() + endWithNewline() + } + format "misc", { + target fileTree(".") { + include "**/*.md", "**/.gitignore" + exclude "**/build/**", "**/build-*/**" + } + trimTrailingWhitespace() + leadingTabsToSpaces(2) + endWithNewline() } } diff --git a/examples/stage0/solutions/src/Conditionals.java b/examples/stage0/solutions/src/Conditionals.java index 41e1b0fd..0fe13d9c 100644 --- a/examples/stage0/solutions/src/Conditionals.java +++ b/examples/stage0/solutions/src/Conditionals.java @@ -77,4 +77,4 @@ void main() { boolean intakeDisabled = false; boolean intakeEnabled = !intakeDisabled; System.out.println(intakeEnabled); -} \ No newline at end of file +} diff --git a/examples/stage0/solutions/src/Operators.java b/examples/stage0/solutions/src/Operators.java index e227ba46..9388a211 100644 --- a/examples/stage0/solutions/src/Operators.java +++ b/examples/stage0/solutions/src/Operators.java @@ -36,7 +36,7 @@ void main() { // order to perform the division and preserve the decimal part. double quotient2 = 5.0 / 3; System.out.println(quotient2); - + // Convert `rawEncoderDegrees` to its corresponding degree amount on a scale // from 0 to 360, using an arithmetic operator, and store this value in a // variable `normalizedAngle`. Then print the value of `normalizedAngle`. @@ -74,4 +74,4 @@ void main() { // incorrectly. double avg = (2 + 5 + 4) / 3.0; System.out.println(avg); -} \ No newline at end of file +} diff --git a/examples/stage0/solutions/src/Print.java b/examples/stage0/solutions/src/Print.java index 550e8f0c..fa1e90a7 100644 --- a/examples/stage0/solutions/src/Print.java +++ b/examples/stage0/solutions/src/Print.java @@ -32,11 +32,11 @@ void main() { // equal to 22 divided by 7). Then, print the value of `pi` again. pi = 3.142857; System.out.println(pi); - + // Create a variable `degrees` of type `double` and assign it a value of // 360. Then, print the variable to observe type narrowing behavior // (it prints 360.0 with a decimal part, instead of just 360, since the // variable uses a data type with decimal parts). double degrees = 360; System.out.println(degrees); -} \ No newline at end of file +} diff --git a/examples/stage0/solutions/src/array.java b/examples/stage0/solutions/src/array.java index d9a2ee5a..17e81836 100644 --- a/examples/stage0/solutions/src/array.java +++ b/examples/stage0/solutions/src/array.java @@ -7,7 +7,7 @@ void main() { // Create an integer array named `driveMotors` that holds the values // 1, 2, 3, 4 and print out the third value in the array. - int[] driveMotors = {1, 2, 3, 4}; + int[] driveMotors = {1, 2, 3, 4}; System.out.println(driveMotors[2]); // Create another integer array named `distance` that holds the values @@ -20,8 +20,8 @@ void main() { //Create an double array named `motorSpeeds` that holds the values // 0.1, 0.2, 0.3, 0.4, 0.5, Then print out the length of the - // motorSpeeds array + // motorSpeeds array double[] motorSpeeds = {0.1, 0.2, 0.3, 0.4, 0.5}; - System.out.println(motorSpeeds.length); + System.out.println(motorSpeeds.length); -} \ No newline at end of file +} diff --git a/examples/stage0/templates/build.gradle b/examples/stage0/templates/build.gradle index 4193dea0..706c44dd 100644 --- a/examples/stage0/templates/build.gradle +++ b/examples/stage0/templates/build.gradle @@ -3,6 +3,10 @@ plugins { id "com.diffplug.spotless" version "8.0.0" } +repositories { + mavenCentral() +} + java { sourceCompatibility = JavaVersion.VERSION_25 targetCompatibility = JavaVersion.VERSION_25 @@ -31,10 +35,46 @@ tasks.register('runTemplates') { dependsOn templateRunTasks } +def allJavaFiles = fileTree(".") { + include "**/*.java" + exclude "**/build/**", "**/build-*/**" +} + +// Compact source files (JEP 512) declare members at the top level with no enclosing +// type, which google-java-format cannot parse. They only get whitespace cleanup. +def compactSourceFiles = allJavaFiles.filter { it.text =~ /(?m)^void main\(/ } + spotless { java { - target fileTree('.') { include '**/*.java' } - licenseHeaderFile(rootProject.file('../../gradle/LICENSE_HEADER'), "^(?!/\\*|\\s*\\*)") + target allJavaFiles - compactSourceFiles + toggleOffOn() + googleJavaFormat() + trimTrailingWhitespace() + endWithNewline() + } + format "compactSources", { + target compactSourceFiles + trimTrailingWhitespace() + endWithNewline() + } + groovyGradle { + target fileTree(".") { + include "**/*.gradle" + exclude "**/build/**", "**/build-*/**" + } + greclipse() + leadingTabsToSpaces(4) + trimTrailingWhitespace() + endWithNewline() + } + format "misc", { + target fileTree(".") { + include "**/*.md", "**/.gitignore" + exclude "**/build/**", "**/build-*/**" + } + trimTrailingWhitespace() + leadingTabsToSpaces(2) + endWithNewline() } } diff --git a/examples/stage0/templates/src/Conditionals.java b/examples/stage0/templates/src/Conditionals.java index beb76e41..bcc7fbb0 100644 --- a/examples/stage0/templates/src/Conditionals.java +++ b/examples/stage0/templates/src/Conditionals.java @@ -54,4 +54,4 @@ void main() { // `false`. boolean intakeDisabled = false; -} \ No newline at end of file +} diff --git a/examples/stage0/templates/src/Operators.java b/examples/stage0/templates/src/Operators.java index d0a3db2f..647a91fc 100644 --- a/examples/stage0/templates/src/Operators.java +++ b/examples/stage0/templates/src/Operators.java @@ -61,4 +61,4 @@ void main() { // "truncation", and it often results in a loss of information if handled // incorrectly. -} \ No newline at end of file +} diff --git a/examples/stage0/templates/src/Print.java b/examples/stage0/templates/src/Print.java index 7d9eceb1..cb7ea2ef 100644 --- a/examples/stage0/templates/src/Print.java +++ b/examples/stage0/templates/src/Print.java @@ -37,4 +37,4 @@ void main() { // (it prints 360.0 with a decimal part, instead of just 360, since the // variable uses a data type with decimal parts). -} \ No newline at end of file +} diff --git a/examples/stage0/templates/src/array.java b/examples/stage0/templates/src/array.java index 80f71fd7..b01528dd 100644 --- a/examples/stage0/templates/src/array.java +++ b/examples/stage0/templates/src/array.java @@ -16,7 +16,7 @@ void main() { //Create an double array named `motorSpeeds` that holds the values // 0.1, 0.2, 0.3, 0.4, 0.5, Then print out the length of the - // motorSpeeds array - + // motorSpeeds array -} \ No newline at end of file + +} diff --git a/examples/stage1/stage1a/solutions/ctre/build.gradle b/examples/stage1/stage1a/solutions/ctre/build.gradle index 6dca85fb..35e8c98e 100644 --- a/examples/stage1/stage1a/solutions/ctre/build.gradle +++ b/examples/stage1/stage1a/solutions/ctre/build.gradle @@ -126,7 +126,7 @@ spotless { exclude '**/build/**', '**/build-*/**' } greclipse() - indentWithSpaces(4) + leadingTabsToSpaces(4) trimTrailingWhitespace() endWithNewline() } @@ -137,7 +137,7 @@ spotless { } eclipseWtp('xml') trimTrailingWhitespace() - indentWithSpaces(2) + leadingTabsToSpaces(2) endWithNewline() } format 'misc', { @@ -146,7 +146,7 @@ spotless { exclude '**/build/**', '**/build-*/**' } trimTrailingWhitespace() - indentWithSpaces(2) + leadingTabsToSpaces(2) endWithNewline() } } diff --git a/examples/stage1/stage1a/solutions/ctre/src/main/java/first/robot/simulation/FuelSim.java b/examples/stage1/stage1a/solutions/ctre/src/main/java/first/robot/simulation/FuelSim.java index ce2bbd74..14e5c28e 100644 --- a/examples/stage1/stage1a/solutions/ctre/src/main/java/first/robot/simulation/FuelSim.java +++ b/examples/stage1/stage1a/solutions/ctre/src/main/java/first/robot/simulation/FuelSim.java @@ -23,20 +23,27 @@ private enum Mode { OUTTAKE } - private static final double SHOT_DT = 0.1, SHOT_VELOCITY_X = -2, SHOT_VELOCITY_Z = 5.5; - private static final Transform3d - FIRST_ROW_POSE = new Transform3d(-0.22, 0, 0.35, Rotation3d.ZERO), - SECOND_ROW_POSE = new Transform3d(-0.08, 0, 0.3, Rotation3d.ZERO), - THIRD_ROW_POSE = new Transform3d(0.06, 0, 0.25, Rotation3d.ZERO), - SHOT_ORIGIN = new Transform3d(0.2, 0, 0.5, Rotation3d.ZERO); + private static final double SHOT_DT = 0.1; + private static final double SHOT_VELOCITY_X = -2; + private static final double SHOT_VELOCITY_Z = 5.5; + + private static final Transform3d FIRST_ROW_POSE = + new Transform3d(-0.22, 0, 0.35, Rotation3d.ZERO); + private static final Transform3d SECOND_ROW_POSE = + new Transform3d(-0.08, 0, 0.3, Rotation3d.ZERO); + private static final Transform3d THIRD_ROW_POSE = new Transform3d(0.06, 0, 0.25, Rotation3d.ZERO); + private static final Transform3d SHOT_ORIGIN = new Transform3d(0.2, 0, 0.5, Rotation3d.ZERO); private static final NetworkTable logTable = NetworkTableInstance.getDefault().getTable("FuelSim"); - private static final StructArrayPublisher - row1FuelPub = logTable.getStructArrayTopic("Row1Fuel", Pose3d.struct).publish(), - row2FuelPub = logTable.getStructArrayTopic("Row2Fuel", Pose3d.struct).publish(), - row3FuelPub = logTable.getStructArrayTopic("Row3Fuel", Pose3d.struct).publish(), - parabolaFuelPub = logTable.getStructArrayTopic("ParabolaFuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row1FuelPub = + logTable.getStructArrayTopic("Row1Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row2FuelPub = + logTable.getStructArrayTopic("Row2Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row3FuelPub = + logTable.getStructArrayTopic("Row3Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher parabolaFuelPub = + logTable.getStructArrayTopic("ParabolaFuel", Pose3d.struct).publish(); private static Mode mode = null; private static boolean isPaused = false; private static double rowsOfFuel = 0; diff --git a/examples/stage1/stage1a/solutions/rev/build.gradle b/examples/stage1/stage1a/solutions/rev/build.gradle index 6dca85fb..35e8c98e 100644 --- a/examples/stage1/stage1a/solutions/rev/build.gradle +++ b/examples/stage1/stage1a/solutions/rev/build.gradle @@ -126,7 +126,7 @@ spotless { exclude '**/build/**', '**/build-*/**' } greclipse() - indentWithSpaces(4) + leadingTabsToSpaces(4) trimTrailingWhitespace() endWithNewline() } @@ -137,7 +137,7 @@ spotless { } eclipseWtp('xml') trimTrailingWhitespace() - indentWithSpaces(2) + leadingTabsToSpaces(2) endWithNewline() } format 'misc', { @@ -146,7 +146,7 @@ spotless { exclude '**/build/**', '**/build-*/**' } trimTrailingWhitespace() - indentWithSpaces(2) + leadingTabsToSpaces(2) endWithNewline() } } diff --git a/examples/stage1/stage1a/solutions/rev/src/main/java/first/robot/simulation/FuelSim.java b/examples/stage1/stage1a/solutions/rev/src/main/java/first/robot/simulation/FuelSim.java index ce2bbd74..14e5c28e 100644 --- a/examples/stage1/stage1a/solutions/rev/src/main/java/first/robot/simulation/FuelSim.java +++ b/examples/stage1/stage1a/solutions/rev/src/main/java/first/robot/simulation/FuelSim.java @@ -23,20 +23,27 @@ private enum Mode { OUTTAKE } - private static final double SHOT_DT = 0.1, SHOT_VELOCITY_X = -2, SHOT_VELOCITY_Z = 5.5; - private static final Transform3d - FIRST_ROW_POSE = new Transform3d(-0.22, 0, 0.35, Rotation3d.ZERO), - SECOND_ROW_POSE = new Transform3d(-0.08, 0, 0.3, Rotation3d.ZERO), - THIRD_ROW_POSE = new Transform3d(0.06, 0, 0.25, Rotation3d.ZERO), - SHOT_ORIGIN = new Transform3d(0.2, 0, 0.5, Rotation3d.ZERO); + private static final double SHOT_DT = 0.1; + private static final double SHOT_VELOCITY_X = -2; + private static final double SHOT_VELOCITY_Z = 5.5; + + private static final Transform3d FIRST_ROW_POSE = + new Transform3d(-0.22, 0, 0.35, Rotation3d.ZERO); + private static final Transform3d SECOND_ROW_POSE = + new Transform3d(-0.08, 0, 0.3, Rotation3d.ZERO); + private static final Transform3d THIRD_ROW_POSE = new Transform3d(0.06, 0, 0.25, Rotation3d.ZERO); + private static final Transform3d SHOT_ORIGIN = new Transform3d(0.2, 0, 0.5, Rotation3d.ZERO); private static final NetworkTable logTable = NetworkTableInstance.getDefault().getTable("FuelSim"); - private static final StructArrayPublisher - row1FuelPub = logTable.getStructArrayTopic("Row1Fuel", Pose3d.struct).publish(), - row2FuelPub = logTable.getStructArrayTopic("Row2Fuel", Pose3d.struct).publish(), - row3FuelPub = logTable.getStructArrayTopic("Row3Fuel", Pose3d.struct).publish(), - parabolaFuelPub = logTable.getStructArrayTopic("ParabolaFuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row1FuelPub = + logTable.getStructArrayTopic("Row1Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row2FuelPub = + logTable.getStructArrayTopic("Row2Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row3FuelPub = + logTable.getStructArrayTopic("Row3Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher parabolaFuelPub = + logTable.getStructArrayTopic("ParabolaFuel", Pose3d.struct).publish(); private static Mode mode = null; private static boolean isPaused = false; private static double rowsOfFuel = 0; diff --git a/examples/stage1/stage1b/snippets/build.gradle b/examples/stage1/stage1b/snippets/build.gradle index 66195a19..d75e7634 100644 --- a/examples/stage1/stage1b/snippets/build.gradle +++ b/examples/stage1/stage1b/snippets/build.gradle @@ -115,9 +115,7 @@ spotless { exclude "**/build/**", "**/build-*/**" } toggleOffOn() - palantirJavaFormat() - leadingSpacesToTabs(4) - leadingTabsToSpaces(2) + googleJavaFormat() trimTrailingWhitespace() endWithNewline() } diff --git a/examples/stage1/stage1b/snippets/src/main/java/sources/CommandBasedKitbot.java b/examples/stage1/stage1b/snippets/src/main/java/sources/CommandBasedKitbot.java index 2ccc9080..e841aada 100644 --- a/examples/stage1/stage1b/snippets/src/main/java/sources/CommandBasedKitbot.java +++ b/examples/stage1/stage1b/snippets/src/main/java/sources/CommandBasedKitbot.java @@ -18,6 +18,7 @@ class CommandBasedKitbot { public class Feeder implements Mechanism { // your code here... } + // [/feederDef] void schedulerExample() { @@ -46,13 +47,15 @@ public MyTeleop(Robot robot) { private final ExampleMotor motor = new ExampleMotor(); // [feederSim] - private final SingleFlywheelSim sim = new SingleFlywheelSim(motor, "Feeder"); // Create a flywheel simulation + private final SingleFlywheelSim sim = + new SingleFlywheelSim(motor, "Feeder"); // Create a flywheel simulation public void periodic() { // Update the simulation if (RobotBase.isSimulation()) { sim.periodic(); } } + // [/feederSim] class ExampleMechanism { diff --git a/examples/stage1/stage1b/snippets/src/main/java/sources/CommandBasedKitbotPt2.java b/examples/stage1/stage1b/snippets/src/main/java/sources/CommandBasedKitbotPt2.java index 6a59500a..11bd1572 100644 --- a/examples/stage1/stage1b/snippets/src/main/java/sources/CommandBasedKitbotPt2.java +++ b/examples/stage1/stage1b/snippets/src/main/java/sources/CommandBasedKitbotPt2.java @@ -30,6 +30,7 @@ public MyOpModeName(Robot robot) { @Override public void start() {} } + // [/opModeSkeleton] class AutoModeExampleCode extends PeriodicOpMode { @@ -40,6 +41,7 @@ class AutoModeExampleCode extends PeriodicOpMode { public void start() { Scheduler.getDefault().schedule(myAutoCommand); } + // [/startMethod] public AutoModeExampleCode(Robot robot) { @@ -52,7 +54,8 @@ public AutoModeExampleCode(Robot robot) { var driveCmdWithTimeout = // [4SecDriveCommand] - robot.drivetrain + robot + .drivetrain .arcadeDrive(forwardThrottle, rotationThrottle) .withTimeout(Seconds.of(4)); // [/4SecDriveCommand] @@ -65,7 +68,8 @@ class Robot { class DriveCommandExamples implements Mechanism { private final OnboardIMU imu = new OnboardIMU(MountOrientation.FLAT); - private final DifferentialDrive differentialDrive = new DifferentialDrive(throttle -> {}, throttle -> {}); + private final DifferentialDrive differentialDrive = + new DifferentialDrive(throttle -> {}, throttle -> {}); Command arcadeDrive(DoubleSupplier forwardThrottle, DoubleSupplier rotationThrottle) { return run(coroutine -> { diff --git a/examples/stage1/stage1b/snippets/src/main/java/sources/CommandBody.java b/examples/stage1/stage1b/snippets/src/main/java/sources/CommandBody.java index d6b0fc01..8a331e39 100644 --- a/examples/stage1/stage1b/snippets/src/main/java/sources/CommandBody.java +++ b/examples/stage1/stage1b/snippets/src/main/java/sources/CommandBody.java @@ -22,28 +22,30 @@ void main() { } // [/triangleLoop] - var exampleCommand = Command.noRequirements(coroutine -> { - var motor = new ExampleMotor(); - var differentialDrive = new DifferentialDrive(throttle -> {}, throttle -> {}); + var exampleCommand = + Command.noRequirements( + coroutine -> { + var motor = new ExampleMotor(); + var differentialDrive = new DifferentialDrive(throttle -> {}, throttle -> {}); - // [rotate90CommandBody] - double targetDirection = getCurrentYaw() + 90; - while (getCurrentYaw() < targetDirection) { - differentialDrive.arcadeDrive(0, 0.5); - coroutine.yield(); - } - differentialDrive.arcadeDrive(0, 0); - // [/rotate90CommandBody] + // [rotate90CommandBody] + double targetDirection = getCurrentYaw() + 90; + while (getCurrentYaw() < targetDirection) { + differentialDrive.arcadeDrive(0, 0.5); + coroutine.yield(); + } + differentialDrive.arcadeDrive(0, 0); + // [/rotate90CommandBody] - // [fullThrottleCmdBody] - System.out.println("Full Speed Baby!"); - while (true) { - motor.setThrottle(1.0); - coroutine.yield(); // Confused? We'll explain this in the section below - } - // [/fullThrottleCmdBody] - }) - .named("Example!"); + // [fullThrottleCmdBody] + System.out.println("Full Speed Baby!"); + while (true) { + motor.setThrottle(1.0); + coroutine.yield(); // Confused? We'll explain this in the section below + } + // [/fullThrottleCmdBody] + }) + .named("Example!"); } private double getCurrentYaw() { diff --git a/examples/stage1/stage1b/snippets/src/main/java/sources/CommandsAndMechsPt1.java b/examples/stage1/stage1b/snippets/src/main/java/sources/CommandsAndMechsPt1.java index 993c7d25..411172ec 100644 --- a/examples/stage1/stage1b/snippets/src/main/java/sources/CommandsAndMechsPt1.java +++ b/examples/stage1/stage1b/snippets/src/main/java/sources/CommandsAndMechsPt1.java @@ -69,6 +69,7 @@ public Command fullThrottle() { .named("Set to Full Throttle"); } } + // [/fullThrottleIntake] // [runAtThrottleCommand] @@ -82,6 +83,7 @@ public Command runAtThrottle(double throttle) { }) .named("Set Throttle to " + throttle); } + // [/runAtThrottleCommand] // [commandAwait] @@ -93,6 +95,7 @@ public Command printHiThenFullThrottle() { }) .named("Set to Full Throttle & Print Hi"); } + // [/commandAwait] // [commandSequence] diff --git a/examples/stage1/stage1b/snippets/src/main/java/sources/CommandsAndMechsPt2.java b/examples/stage1/stage1b/snippets/src/main/java/sources/CommandsAndMechsPt2.java index fb774289..25e09f6d 100644 --- a/examples/stage1/stage1b/snippets/src/main/java/sources/CommandsAndMechsPt2.java +++ b/examples/stage1/stage1b/snippets/src/main/java/sources/CommandsAndMechsPt2.java @@ -30,17 +30,20 @@ public Command idle() { .named("Idle"); } } + // [/defaultCommand] // [noRequirementsCommand] class Robot { public Command justPrintHi() { - return Command.noRequirements(coroutine -> { - System.out.println("Hello World!"); - }) + return Command.noRequirements( + coroutine -> { + System.out.println("Hello World!"); + }) .named("Hello World!"); } } + // [/noRequirementsCommand] class CommandUsages implements Mechanism { @@ -52,6 +55,7 @@ public Command wait5SecsThenPrintHi() { }) .named("Wait 5 Secs, Then Print Hi"); } + // [/delayCommand] // [timeoutCommand] @@ -62,6 +66,7 @@ public Command fullThrottleForFiveSeconds() { public Command fullThrottle() { return null; // placeholder for actual command } + // [/timeoutCommand] // [parallelCommands] diff --git a/examples/stage1/stage1b/snippets/src/main/java/sources/SpotTheError.java b/examples/stage1/stage1b/snippets/src/main/java/sources/SpotTheError.java index 63163e3d..b65afbae 100644 --- a/examples/stage1/stage1b/snippets/src/main/java/sources/SpotTheError.java +++ b/examples/stage1/stage1b/snippets/src/main/java/sources/SpotTheError.java @@ -51,6 +51,7 @@ Command runAtThrottle(double throttle) { .named("Intake"); } } + // [/intakeClass] void intakeClassWithDefaultCmd() { diff --git a/examples/stage1/stage1b/snippets/src/main/java/sources/SpotTheErrorPt2.java b/examples/stage1/stage1b/snippets/src/main/java/sources/SpotTheErrorPt2.java index 3d3bd9b4..eec1e0b3 100644 --- a/examples/stage1/stage1b/snippets/src/main/java/sources/SpotTheErrorPt2.java +++ b/examples/stage1/stage1b/snippets/src/main/java/sources/SpotTheErrorPt2.java @@ -59,15 +59,17 @@ public Robot() { public void robotPeriodic() {} private Command printHelloWorld() { - return Command.noRequirements(coroutine -> { - while (true) { - System.out.println("Hello World!"); - coroutine.yield(); - } - }) + return Command.noRequirements( + coroutine -> { + while (true) { + System.out.println("Hello World!"); + coroutine.yield(); + } + }) .named("Hello World!"); } } + // [/robotPeriodicBug] class RobotFixed extends OpModeRobot { diff --git a/examples/stage1/stage1b/snippets/src/main/java/sources/SuppliersInCommandBased.java b/examples/stage1/stage1b/snippets/src/main/java/sources/SuppliersInCommandBased.java index 7d2902f3..b42ed8b9 100644 --- a/examples/stage1/stage1b/snippets/src/main/java/sources/SuppliersInCommandBased.java +++ b/examples/stage1/stage1b/snippets/src/main/java/sources/SuppliersInCommandBased.java @@ -44,12 +44,15 @@ public Command runAtThrottle(DoubleSupplier throttleSupplier) { }) .named("Run Intake"); } + // [/runAtThrottleSupplier] // [untilModifier] // From the Intake class mentioned earlier public Command fullThrottleUntilRobotDisabled() { - return fullThrottle().until(() -> RobotState.isDisabled()).named("Full Throttle Until Disable"); + return fullThrottle() + .until(() -> RobotState.isDisabled()) + .named("Full Throttle Until Disable"); } private Command fullThrottle() { diff --git a/examples/stage1/stage1b/snippets/src/main/java/sources/Triggers.java b/examples/stage1/stage1b/snippets/src/main/java/sources/Triggers.java index cbc8ca94..379114f2 100644 --- a/examples/stage1/stage1b/snippets/src/main/java/sources/Triggers.java +++ b/examples/stage1/stage1b/snippets/src/main/java/sources/Triggers.java @@ -100,6 +100,7 @@ public Robot() { new Trigger(() -> teleopEnabled()).onTrue(intake.runAtThrottle(0.5)); } } + // [/teleopEnabledRobot] Command myAutonomousCommand() { diff --git a/examples/stage1/stage1b/solutions/ctre/build.gradle b/examples/stage1/stage1b/solutions/ctre/build.gradle index 6dca85fb..35e8c98e 100644 --- a/examples/stage1/stage1b/solutions/ctre/build.gradle +++ b/examples/stage1/stage1b/solutions/ctre/build.gradle @@ -126,7 +126,7 @@ spotless { exclude '**/build/**', '**/build-*/**' } greclipse() - indentWithSpaces(4) + leadingTabsToSpaces(4) trimTrailingWhitespace() endWithNewline() } @@ -137,7 +137,7 @@ spotless { } eclipseWtp('xml') trimTrailingWhitespace() - indentWithSpaces(2) + leadingTabsToSpaces(2) endWithNewline() } format 'misc', { @@ -146,7 +146,7 @@ spotless { exclude '**/build/**', '**/build-*/**' } trimTrailingWhitespace() - indentWithSpaces(2) + leadingTabsToSpaces(2) endWithNewline() } } diff --git a/examples/stage1/stage1b/solutions/ctre/src/main/java/first/robot/simulation/FuelSim.java b/examples/stage1/stage1b/solutions/ctre/src/main/java/first/robot/simulation/FuelSim.java index ce2bbd74..14e5c28e 100644 --- a/examples/stage1/stage1b/solutions/ctre/src/main/java/first/robot/simulation/FuelSim.java +++ b/examples/stage1/stage1b/solutions/ctre/src/main/java/first/robot/simulation/FuelSim.java @@ -23,20 +23,27 @@ private enum Mode { OUTTAKE } - private static final double SHOT_DT = 0.1, SHOT_VELOCITY_X = -2, SHOT_VELOCITY_Z = 5.5; - private static final Transform3d - FIRST_ROW_POSE = new Transform3d(-0.22, 0, 0.35, Rotation3d.ZERO), - SECOND_ROW_POSE = new Transform3d(-0.08, 0, 0.3, Rotation3d.ZERO), - THIRD_ROW_POSE = new Transform3d(0.06, 0, 0.25, Rotation3d.ZERO), - SHOT_ORIGIN = new Transform3d(0.2, 0, 0.5, Rotation3d.ZERO); + private static final double SHOT_DT = 0.1; + private static final double SHOT_VELOCITY_X = -2; + private static final double SHOT_VELOCITY_Z = 5.5; + + private static final Transform3d FIRST_ROW_POSE = + new Transform3d(-0.22, 0, 0.35, Rotation3d.ZERO); + private static final Transform3d SECOND_ROW_POSE = + new Transform3d(-0.08, 0, 0.3, Rotation3d.ZERO); + private static final Transform3d THIRD_ROW_POSE = new Transform3d(0.06, 0, 0.25, Rotation3d.ZERO); + private static final Transform3d SHOT_ORIGIN = new Transform3d(0.2, 0, 0.5, Rotation3d.ZERO); private static final NetworkTable logTable = NetworkTableInstance.getDefault().getTable("FuelSim"); - private static final StructArrayPublisher - row1FuelPub = logTable.getStructArrayTopic("Row1Fuel", Pose3d.struct).publish(), - row2FuelPub = logTable.getStructArrayTopic("Row2Fuel", Pose3d.struct).publish(), - row3FuelPub = logTable.getStructArrayTopic("Row3Fuel", Pose3d.struct).publish(), - parabolaFuelPub = logTable.getStructArrayTopic("ParabolaFuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row1FuelPub = + logTable.getStructArrayTopic("Row1Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row2FuelPub = + logTable.getStructArrayTopic("Row2Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row3FuelPub = + logTable.getStructArrayTopic("Row3Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher parabolaFuelPub = + logTable.getStructArrayTopic("ParabolaFuel", Pose3d.struct).publish(); private static Mode mode = null; private static boolean isPaused = false; private static double rowsOfFuel = 0; diff --git a/examples/stage1/stage1b/solutions/rev/build.gradle b/examples/stage1/stage1b/solutions/rev/build.gradle index 0da66926..3d72ac21 100644 --- a/examples/stage1/stage1b/solutions/rev/build.gradle +++ b/examples/stage1/stage1b/solutions/rev/build.gradle @@ -126,7 +126,7 @@ spotless { exclude '**/build/**', '**/build-*/**' } trimTrailingWhitespace() - indentWithSpaces(2) + leadingTabsToSpaces(2) endWithNewline() } } \ No newline at end of file diff --git a/examples/stage1/stage1b/solutions/rev/src/main/java/first/robot/simulation/FuelSim.java b/examples/stage1/stage1b/solutions/rev/src/main/java/first/robot/simulation/FuelSim.java index d77757a2..cca60226 100644 --- a/examples/stage1/stage1b/solutions/rev/src/main/java/first/robot/simulation/FuelSim.java +++ b/examples/stage1/stage1b/solutions/rev/src/main/java/first/robot/simulation/FuelSim.java @@ -24,20 +24,27 @@ private enum Mode { OUTTAKE } - private static final double SHOT_DT = 0.1, SHOT_VELOCITY_X = -2, SHOT_VELOCITY_Z = 5.5; - private static final Transform3d - FIRST_ROW_POSE = new Transform3d(-0.22, 0, 0.35, Rotation3d.ZERO), - SECOND_ROW_POSE = new Transform3d(-0.08, 0, 0.3, Rotation3d.ZERO), - THIRD_ROW_POSE = new Transform3d(0.06, 0, 0.25, Rotation3d.ZERO), - SHOT_ORIGIN = new Transform3d(0.2, 0, 0.5, Rotation3d.ZERO); + private static final double SHOT_DT = 0.1; + private static final double SHOT_VELOCITY_X = -2; + private static final double SHOT_VELOCITY_Z = 5.5; + + private static final Transform3d FIRST_ROW_POSE = + new Transform3d(-0.22, 0, 0.35, Rotation3d.ZERO); + private static final Transform3d SECOND_ROW_POSE = + new Transform3d(-0.08, 0, 0.3, Rotation3d.ZERO); + private static final Transform3d THIRD_ROW_POSE = new Transform3d(0.06, 0, 0.25, Rotation3d.ZERO); + private static final Transform3d SHOT_ORIGIN = new Transform3d(0.2, 0, 0.5, Rotation3d.ZERO); private static final NetworkTable logTable = NetworkTableInstance.getDefault().getTable("FuelSim"); - private static final StructArrayPublisher - row1FuelPub = logTable.getStructArrayTopic("Row1Fuel", Pose3d.struct).publish(), - row2FuelPub = logTable.getStructArrayTopic("Row2Fuel", Pose3d.struct).publish(), - row3FuelPub = logTable.getStructArrayTopic("Row3Fuel", Pose3d.struct).publish(), - parabolaFuelPub = logTable.getStructArrayTopic("ParabolaFuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row1FuelPub = + logTable.getStructArrayTopic("Row1Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row2FuelPub = + logTable.getStructArrayTopic("Row2Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row3FuelPub = + logTable.getStructArrayTopic("Row3Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher parabolaFuelPub = + logTable.getStructArrayTopic("ParabolaFuel", Pose3d.struct).publish(); private static Mode mode = null; private static boolean isPaused = false; private static double rowsOfFuel = 0; diff --git a/examples/stage1/templates/ctre/build.gradle b/examples/stage1/templates/ctre/build.gradle index 6dca85fb..35e8c98e 100644 --- a/examples/stage1/templates/ctre/build.gradle +++ b/examples/stage1/templates/ctre/build.gradle @@ -126,7 +126,7 @@ spotless { exclude '**/build/**', '**/build-*/**' } greclipse() - indentWithSpaces(4) + leadingTabsToSpaces(4) trimTrailingWhitespace() endWithNewline() } @@ -137,7 +137,7 @@ spotless { } eclipseWtp('xml') trimTrailingWhitespace() - indentWithSpaces(2) + leadingTabsToSpaces(2) endWithNewline() } format 'misc', { @@ -146,7 +146,7 @@ spotless { exclude '**/build/**', '**/build-*/**' } trimTrailingWhitespace() - indentWithSpaces(2) + leadingTabsToSpaces(2) endWithNewline() } } diff --git a/examples/stage1/templates/ctre/src/main/java/first/robot/simulation/FuelSim.java b/examples/stage1/templates/ctre/src/main/java/first/robot/simulation/FuelSim.java index ce2bbd74..14e5c28e 100644 --- a/examples/stage1/templates/ctre/src/main/java/first/robot/simulation/FuelSim.java +++ b/examples/stage1/templates/ctre/src/main/java/first/robot/simulation/FuelSim.java @@ -23,20 +23,27 @@ private enum Mode { OUTTAKE } - private static final double SHOT_DT = 0.1, SHOT_VELOCITY_X = -2, SHOT_VELOCITY_Z = 5.5; - private static final Transform3d - FIRST_ROW_POSE = new Transform3d(-0.22, 0, 0.35, Rotation3d.ZERO), - SECOND_ROW_POSE = new Transform3d(-0.08, 0, 0.3, Rotation3d.ZERO), - THIRD_ROW_POSE = new Transform3d(0.06, 0, 0.25, Rotation3d.ZERO), - SHOT_ORIGIN = new Transform3d(0.2, 0, 0.5, Rotation3d.ZERO); + private static final double SHOT_DT = 0.1; + private static final double SHOT_VELOCITY_X = -2; + private static final double SHOT_VELOCITY_Z = 5.5; + + private static final Transform3d FIRST_ROW_POSE = + new Transform3d(-0.22, 0, 0.35, Rotation3d.ZERO); + private static final Transform3d SECOND_ROW_POSE = + new Transform3d(-0.08, 0, 0.3, Rotation3d.ZERO); + private static final Transform3d THIRD_ROW_POSE = new Transform3d(0.06, 0, 0.25, Rotation3d.ZERO); + private static final Transform3d SHOT_ORIGIN = new Transform3d(0.2, 0, 0.5, Rotation3d.ZERO); private static final NetworkTable logTable = NetworkTableInstance.getDefault().getTable("FuelSim"); - private static final StructArrayPublisher - row1FuelPub = logTable.getStructArrayTopic("Row1Fuel", Pose3d.struct).publish(), - row2FuelPub = logTable.getStructArrayTopic("Row2Fuel", Pose3d.struct).publish(), - row3FuelPub = logTable.getStructArrayTopic("Row3Fuel", Pose3d.struct).publish(), - parabolaFuelPub = logTable.getStructArrayTopic("ParabolaFuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row1FuelPub = + logTable.getStructArrayTopic("Row1Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row2FuelPub = + logTable.getStructArrayTopic("Row2Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row3FuelPub = + logTable.getStructArrayTopic("Row3Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher parabolaFuelPub = + logTable.getStructArrayTopic("ParabolaFuel", Pose3d.struct).publish(); private static Mode mode = null; private static boolean isPaused = false; private static double rowsOfFuel = 0; diff --git a/examples/stage1/templates/rev/build.gradle b/examples/stage1/templates/rev/build.gradle index 6dca85fb..35e8c98e 100644 --- a/examples/stage1/templates/rev/build.gradle +++ b/examples/stage1/templates/rev/build.gradle @@ -126,7 +126,7 @@ spotless { exclude '**/build/**', '**/build-*/**' } greclipse() - indentWithSpaces(4) + leadingTabsToSpaces(4) trimTrailingWhitespace() endWithNewline() } @@ -137,7 +137,7 @@ spotless { } eclipseWtp('xml') trimTrailingWhitespace() - indentWithSpaces(2) + leadingTabsToSpaces(2) endWithNewline() } format 'misc', { @@ -146,7 +146,7 @@ spotless { exclude '**/build/**', '**/build-*/**' } trimTrailingWhitespace() - indentWithSpaces(2) + leadingTabsToSpaces(2) endWithNewline() } } diff --git a/examples/stage1/templates/rev/src/main/java/first/robot/simulation/FuelSim.java b/examples/stage1/templates/rev/src/main/java/first/robot/simulation/FuelSim.java index ce2bbd74..14e5c28e 100644 --- a/examples/stage1/templates/rev/src/main/java/first/robot/simulation/FuelSim.java +++ b/examples/stage1/templates/rev/src/main/java/first/robot/simulation/FuelSim.java @@ -23,20 +23,27 @@ private enum Mode { OUTTAKE } - private static final double SHOT_DT = 0.1, SHOT_VELOCITY_X = -2, SHOT_VELOCITY_Z = 5.5; - private static final Transform3d - FIRST_ROW_POSE = new Transform3d(-0.22, 0, 0.35, Rotation3d.ZERO), - SECOND_ROW_POSE = new Transform3d(-0.08, 0, 0.3, Rotation3d.ZERO), - THIRD_ROW_POSE = new Transform3d(0.06, 0, 0.25, Rotation3d.ZERO), - SHOT_ORIGIN = new Transform3d(0.2, 0, 0.5, Rotation3d.ZERO); + private static final double SHOT_DT = 0.1; + private static final double SHOT_VELOCITY_X = -2; + private static final double SHOT_VELOCITY_Z = 5.5; + + private static final Transform3d FIRST_ROW_POSE = + new Transform3d(-0.22, 0, 0.35, Rotation3d.ZERO); + private static final Transform3d SECOND_ROW_POSE = + new Transform3d(-0.08, 0, 0.3, Rotation3d.ZERO); + private static final Transform3d THIRD_ROW_POSE = new Transform3d(0.06, 0, 0.25, Rotation3d.ZERO); + private static final Transform3d SHOT_ORIGIN = new Transform3d(0.2, 0, 0.5, Rotation3d.ZERO); private static final NetworkTable logTable = NetworkTableInstance.getDefault().getTable("FuelSim"); - private static final StructArrayPublisher - row1FuelPub = logTable.getStructArrayTopic("Row1Fuel", Pose3d.struct).publish(), - row2FuelPub = logTable.getStructArrayTopic("Row2Fuel", Pose3d.struct).publish(), - row3FuelPub = logTable.getStructArrayTopic("Row3Fuel", Pose3d.struct).publish(), - parabolaFuelPub = logTable.getStructArrayTopic("ParabolaFuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row1FuelPub = + logTable.getStructArrayTopic("Row1Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row2FuelPub = + logTable.getStructArrayTopic("Row2Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher row3FuelPub = + logTable.getStructArrayTopic("Row3Fuel", Pose3d.struct).publish(); + private static final StructArrayPublisher parabolaFuelPub = + logTable.getStructArrayTopic("ParabolaFuel", Pose3d.struct).publish(); private static Mode mode = null; private static boolean isPaused = false; private static double rowsOfFuel = 0;