Skip to content

Commit

Permalink
linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
legoguy1000 committed Oct 3, 2024
1 parent 38249bb commit 1d5e7a4
Show file tree
Hide file tree
Showing 15 changed files with 128 additions and 48 deletions.
3 changes: 3 additions & 0 deletions src/main/java/frc/lib/profiling/EmptyProfiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public final class EmptyProfiler implements Profiler {
*/
public static final EmptyProfiler INSTANCE = new EmptyProfiler();

/**
* Empty Profiler
*/
private EmptyProfiler() {}

@Override
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/frc/lib/profiling/Profiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/**
* Interface supporting profiling calls for measuring and saving runtime performance.
*

Check warning on line 5 in src/main/java/frc/lib/profiling/Profiler.java

View workflow job for this annotation

GitHub Actions / Linting

[checkstyle] reported by reviewdog 🐶 Empty line should be followed by <p> tag on the next line. Raw Output: /github/workspace/./src/main/java/frc/lib/profiling/Profiler.java:5:0: warning: Empty line should be followed by <p> tag on the next line. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck)
* <p>
* Operates on the idea of a "profile stack", which is just a stack of names with associated
* profiling metrics. For instance, the following code
*
Expand All @@ -20,7 +19,6 @@
* }
* </pre>
*

Check warning on line 21 in src/main/java/frc/lib/profiling/Profiler.java

View workflow job for this annotation

GitHub Actions / Linting

[checkstyle] reported by reviewdog 🐶 Empty line should be followed by <p> tag on the next line. Raw Output: /github/workspace/./src/main/java/frc/lib/profiling/Profiler.java:21:0: warning: Empty line should be followed by <p> tag on the next line. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck)
* <p>
* will produce a profile with three sections:
* <ul>
* <li>{@code root}, which describes the time between {@link #startTick() profiler.startTick()} and
Expand All @@ -31,7 +29,6 @@
* profiler.swap("World")} and {@link #pop() profiler.pop()}.
* </ul>
*

Check warning on line 31 in src/main/java/frc/lib/profiling/Profiler.java

View workflow job for this annotation

GitHub Actions / Linting

[checkstyle] reported by reviewdog 🐶 Empty line should be followed by <p> tag on the next line. Raw Output: /github/workspace/./src/main/java/frc/lib/profiling/Profiler.java:31:0: warning: Empty line should be followed by <p> tag on the next line. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck)
* <p>
* A call to {@link #save() profiler.save()} would output the performance metrics of these sections
* in the case of a {@link LoggingProfiler}.
*/
Expand Down
1 change: 0 additions & 1 deletion src/main/java/frc/lib/util/FieldConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* of corners start in the lower left moving clockwise. <b>All units in Meters</b> <br>
* <br>
*
* <p>
* All translations and poses are stored with the origin at the rightmost point on the BLUE ALLIANCE
* wall.<br>
* <br>
Expand Down
1 change: 0 additions & 1 deletion src/main/java/frc/lib/util/LongArrayList.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* An optimized long array. Used in lieu of an {@code ArrayList<Long>} to avoid boxing (and the
* performance implications that come with it).
*
* <p>
* Current interface is limited to the methods used by {@link LoggingProfiler}, though its interface
* may expand in the future to match the full {@link List} interface.
*/
Expand Down
21 changes: 14 additions & 7 deletions src/main/java/frc/lib/util/photon/PhotonIO.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package frc.lib.util.photon;

import java.io.File;
import java.io.IOException;
import java.util.Optional;
import org.littletonrobotics.junction.LogTable;
import org.littletonrobotics.junction.inputs.LoggableInputs;
Expand All @@ -14,7 +12,9 @@
import edu.wpi.first.math.numbers.N3;
import edu.wpi.first.math.numbers.N5;

/** PhotonVision Camera IO. */
/**
* PhotonVision Camera IO.
*/
public abstract class PhotonIO {

/**
Expand Down Expand Up @@ -93,17 +93,24 @@ public Optional<Matrix<N5, N1>> getDistCoeffs() {
protected final String name;
protected final String ip;

/**
* Photon IO
*
* @param name Name of the camera
* @param ip IP of the camera
*/
public PhotonIO(String name, String ip) {
this.name = name;
this.ip = ip;

}

/**
* Update IO Inputs
*
* @param inputs Photon Inputs
*/
public void updateInputs(PhotonInputs inputs) {
inputs.name = name;
}

public boolean uploadSettings(String ip, File file) throws IOException {
return false;
}
}
3 changes: 0 additions & 3 deletions src/main/java/frc/lib/util/photon/PhotonIOPoseEstimator.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ private void checkUpdate(Object oldObj, Object newObj) {
/**
* Get the AprilTagFieldLayout being used by the PositionEstimator.
*

Check warning on line 117 in src/main/java/frc/lib/util/photon/PhotonIOPoseEstimator.java

View workflow job for this annotation

GitHub Actions / Linting

[checkstyle] reported by reviewdog 🐶 Empty line should be followed by <p> tag on the next line. Raw Output: /github/workspace/./src/main/java/frc/lib/util/photon/PhotonIOPoseEstimator.java:117:0: warning: Empty line should be followed by <p> tag on the next line. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck)
* <p>
* Note: Setting the origin of this layout will affect the results from this class.
*
* @return the AprilTagFieldLayout
Expand All @@ -127,7 +126,6 @@ public AprilTagFieldLayout getFieldTags() {
/**
* Set the AprilTagFieldLayout being used by the PositionEstimator.
*

Check warning on line 128 in src/main/java/frc/lib/util/photon/PhotonIOPoseEstimator.java

View workflow job for this annotation

GitHub Actions / Linting

[checkstyle] reported by reviewdog 🐶 Empty line should be followed by <p> tag on the next line. Raw Output: /github/workspace/./src/main/java/frc/lib/util/photon/PhotonIOPoseEstimator.java:128:0: warning: Empty line should be followed by <p> tag on the next line. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck)
* <p>
* Note: Setting the origin of this layout will affect the results from this class.
*
* @param fieldTags the AprilTagFieldLayout
Expand All @@ -140,7 +138,6 @@ public void setFieldTags(AprilTagFieldLayout fieldTags) {
/**
* Get the TargetModel representing the tags being detected. This is used for on-rio multitag.
*
* <p>
* By default, this is {@link TargetModel#kAprilTag16h5}.
*/
public TargetModel getTagModel() {
Expand Down
24 changes: 23 additions & 1 deletion src/main/java/frc/lib/util/photon/PhotonReal.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

/** Represents an actual camera that is connected to PhotonVision. Based on {@link PhotonCamera}. */
/**
* Represents an actual camera that is connected to PhotonVision. Based on {@link PhotonCamera}.
*/
public class PhotonReal extends PhotonIO implements AutoCloseable {
public static final String kTableName = "photonvision";
private static int InstanceCount = 0;
Expand All @@ -43,21 +45,33 @@ public class PhotonReal extends PhotonIO implements AutoCloseable {
private long prevHeartbeatValue = -1;
private double prevHeartbeatChangeTime = 0;

/**
* Photon Pipeline Result
*/
private static class PhotonPipelineResultIntermediate {
public PhotonPipelineResult result;
public byte[] rawBytes;

/**
* Photon Pipeline Result
*/
public PhotonPipelineResultIntermediate() {
result = new PhotonPipelineResult();
rawBytes = new byte[0];
}

/**
* Photon Pipeline Result
*/
public PhotonPipelineResultIntermediate(PhotonPipelineResult result, byte[] rawBytes) {
this.result = result;
this.rawBytes = rawBytes;
}
}

/**
* Photon Pipeline Result Builder
*/
private static class PhotonResultIntermediateBuilder
implements PacketSerde<PhotonPipelineResultIntermediate> {

Expand All @@ -81,6 +95,14 @@ public PhotonPipelineResultIntermediate unpack(Packet packet) {

}

/**
* Upload Camera Settings
*
* @param ip Camera IP
* @param file Camera Settings file
* @return true if settings upload was successful
* @throws IOException

Check warning on line 104 in src/main/java/frc/lib/util/photon/PhotonReal.java

View workflow job for this annotation

GitHub Actions / Linting

[checkstyle] reported by reviewdog 🐶 At-clause should have a non-empty description. Raw Output: /github/workspace/./src/main/java/frc/lib/util/photon/PhotonReal.java:104:0: warning: At-clause should have a non-empty description. (com.puppycrawl.tools.checkstyle.checks.javadoc.NonEmptyAtclauseDescriptionCheck)
*/
public boolean uploadSettings(String ip, File file) throws IOException {
try (final CloseableHttpClient httpClient = HttpClients.createDefault()) {
HttpPost postReq = new HttpPost("http://" + ip + "/api/settings");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ private Main() {}
/**
* Main initialization function. Do not perform any initialization here.
*

Check warning on line 19 in src/main/java/frc/robot/Main.java

View workflow job for this annotation

GitHub Actions / Linting

[checkstyle] reported by reviewdog 🐶 Empty line should be followed by <p> tag on the next line. Raw Output: /github/workspace/./src/main/java/frc/robot/Main.java:19:0: warning: Empty line should be followed by <p> tag on the next line. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck)
* <p>
*

Check warning on line 20 in src/main/java/frc/robot/Main.java

View workflow job for this annotation

GitHub Actions / Linting

[checkstyle] reported by reviewdog 🐶 Empty line should be followed by <p> tag on the next line. Raw Output: /github/workspace/./src/main/java/frc/robot/Main.java:20:0: warning: Empty line should be followed by <p> tag on the next line. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck)
* If you change your main robot class, change the parameter type.
*
* @param args String args
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public Robot() {
new PowerDistribution(1, ModuleType.kRev); // Enables power distribution logging
setUseTiming(true);
robotRunType = RobotRunType.kReal;
gcTimer.start();
} else {
String logPath = findReplayLog();
if (logPath == null) {
Expand Down Expand Up @@ -122,7 +123,6 @@ public Robot() {
* This function is called every robot packet, no matter the mode. Use this for items like
* diagnostics that you want ran during disabled, autonomous, teleoperated and test.
*

Check warning on line 125 in src/main/java/frc/robot/Robot.java

View workflow job for this annotation

GitHub Actions / Linting

[checkstyle] reported by reviewdog 🐶 Empty line should be followed by <p> tag on the next line. Raw Output: /github/workspace/./src/main/java/frc/robot/Robot.java:125:0: warning: Empty line should be followed by <p> tag on the next line. (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck)
* <p>
* This runs after the mode specific periodic functions, but before LiveWindow and
* SmartDashboard integrated updating.
*/
Expand Down
29 changes: 8 additions & 21 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,33 +123,20 @@ public class RobotContainer {
// private PhotonCamera backLeftCamera = new PhotonCamera("back-left");

/**
* Robot Container
*/
public RobotContainer(RobotRunType runtimeType) {
numNoteChooser.setDefaultOption("0", 0);
for (int i = 0; i < 7; i++) {
numNoteChooser.addOption(String.valueOf(i), i);
}
cameras =
/*
* Camera Order: 0 - Front Left 1 - Front RIght 2 - Back Left 3 - Back Right
*/
new PhotonCameraWrapper[] {
// new PhotonCameraWrapper(
// new PhotonReal(Constants.CameraConstants.FrontLeftFacingCamera.CAMERA_NAME,
// Constants.CameraConstants.FrontLeftFacingCamera.CAMERA_IP),
// Constants.CameraConstants.FrontLeftFacingCamera.KCAMERA_TO_ROBOT),
new PhotonCameraWrapper(
new PhotonReal(Constants.CameraConstants.FrontRightFacingCamera.CAMERA_NAME,
Constants.CameraConstants.FrontRightFacingCamera.CAMERA_IP),
Constants.CameraConstants.FrontRightFacingCamera.KCAMERA_TO_ROBOT),
// new PhotonCameraWrapper(
// new PhotonReal(Constants.CameraConstants.BackLeftFacingCamera.CAMERA_NAME,
// Constants.CameraConstants.BackLeftFacingCamera.CAMERA_IP),
// Constants.CameraConstants.BackLeftFacingCamera.KCAMERA_TO_ROBOT)
};
// new PhotonCameraWrapper(
// new PhotonReal(Constants.CameraConstants.BackRightFacingCamera.CAMERA_NAME),
// Constants.CameraConstants.BackRightFacingCamera.KCAMERA_TO_ROBOT)};
/*
* Camera Order: 0 - Front Left 1 - Front RIght 2 - Back Left 3 - Back Right
*/
cameras = new PhotonCameraWrapper[] {new PhotonCameraWrapper(
new PhotonReal(Constants.CameraConstants.FrontRightFacingCamera.CAMERA_NAME,
Constants.CameraConstants.FrontRightFacingCamera.CAMERA_IP),
Constants.CameraConstants.FrontRightFacingCamera.KCAMERA_TO_ROBOT),};

Check warning on line 139 in src/main/java/frc/robot/RobotContainer.java

View workflow job for this annotation

GitHub Actions / Linting

[checkstyle] reported by reviewdog 🐶 ',' is not followed by whitespace. Raw Output: /github/workspace/./src/main/java/frc/robot/RobotContainer.java:139:79: warning: ',' is not followed by whitespace. (com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck)

switch (runtimeType) {
case kReal:
Expand Down
13 changes: 8 additions & 5 deletions src/main/java/frc/robot/commands/CommandFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static Command runIntake(Intake intake, Indexer indexer, ElevatorWrist el
* Wrist follows the speaker until it is met, then it shoots
*
* @param shooter Shooter subsystem
* @param intake Intake subsystem
* @param indexer Indexer subsystem
* @return Returns a command
*/
public static Command shootSpeaker(Shooter shooter, Indexer indexer) {
Expand All @@ -51,6 +51,7 @@ public static Command shootSpeaker(Shooter shooter, Indexer indexer) {
*
* @param shooter Shooter subsystem
* @param intake Intake subsystem
* @param indexer Indexer Subsystem
* @return Returns a command
*/
public static Command passThroughShoot(Shooter shooter, Intake intake, Indexer indexer) {
Expand All @@ -65,7 +66,7 @@ public static Command passThroughShoot(Shooter shooter, Intake intake, Indexer i
* Command to spit out the notes
*
* @param shooter Shooter Subsystem
* @param intake Intake Subsystem
* @param indexer Indexer Subsystem
* @return Command
*/
public static Command spit(Shooter shooter, Indexer indexer) {
Expand All @@ -76,6 +77,7 @@ public static Command spit(Shooter shooter, Indexer indexer) {
* Command to run the intake and indexer at the proper speed to intake a note
*
* @param intake Intake Subsystem
* @param indexer Indexer Subsystem
* @return Command
*/
public static Command intakeNote(Intake intake, Indexer indexer) {
Expand All @@ -99,6 +101,7 @@ public static Command autoAngleWristSpeaker(ElevatorWrist elevatorWrist, Swerve
* New intake command to prevent intaking past the intake when the elevator isn't home
*
* @param intake Intake Subsystem
* @param indexer Indexer Subsystem
* @param elevatorWrist Elevator Wrist Subsystem
* @return Command
*/
Expand All @@ -123,7 +126,7 @@ public class Auto {
* Command to run the indexer to shoot a note until .25 seconds after the beam brake is no
* longer broken
*
* @param intake Intake Subsystem
* @param indexer Indexer Subsystem
* @return Command
*/
public static Command runIndexer(Indexer indexer) {
Expand All @@ -136,7 +139,7 @@ public static Command runIndexer(Indexer indexer) {
* Command to run the indexer to shoot a note until .25 seconds after the beam brake is no
* longer broken
*
* @param intake Intake Subsystem
* @param indexer Indexer Subsystem
* @return Command
*/
public static Command runIndexer(Indexer indexer, Shooter shooter) {
Expand All @@ -147,7 +150,7 @@ public static Command runIndexer(Indexer indexer, Shooter shooter) {
/**
* Command to wait for Intake beam brake is tripped
*
* @param intake Intake Subsystem
* @param indexer Indexer Subsystem
* @return Command
*/
public static Command waitForIntake(Indexer indexer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;

/**
* Proxy Conditional Command
*/
public class ProxyConditionalCommand extends Command {
private final Command m_onTrue;
private final Command m_onFalse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import java.util.function.Supplier;
import edu.wpi.first.wpilibj2.command.Command;

/**
* Proxy Parallel Command
*/
public class ProxyParallelCommand extends Command {
private final Supplier<List<Command>> m_supplier;
private final Map<Command, Boolean> m_commands = new HashMap<>();
Expand All @@ -15,8 +18,6 @@ public class ProxyParallelCommand extends Command {
* Creates a new ProxyParallelCommand that schedules the supplied command when initialized, and
* ends when it is no longer scheduled. Useful for lazily creating commands at runtime.
*
* Supplier<List<String>> str = () -> new ArrayList<>();
*
* @param supplier the command supplier
*/
public ProxyParallelCommand(Supplier<List<Command>> supplier) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import java.util.function.Supplier;
import edu.wpi.first.wpilibj2.command.Command;

/**
* Proxy Sequential Command
*/
public class ProxySequentialCommand extends Command {
private final Supplier<List<Command>> m_supplier;
private final List<Command> m_commands = new ArrayList<>();
Expand All @@ -15,8 +18,6 @@ public class ProxySequentialCommand extends Command {
* Creates a new ProxySequentialCommand that schedules the supplied command when initialized,
* and ends when it is no longer scheduled. Useful for lazily creating commands at runtime.
*
* Supplier<List<String>> str = () -> new ArrayList<>();
*
* @param supplier the command supplier
*/
public ProxySequentialCommand(Supplier<List<Command>> supplier) {
Expand Down
Loading

0 comments on commit 1d5e7a4

Please sign in to comment.