Skip to content

Feature/feb7 changes - #9

Merged
Orcasphynx merged 3 commits into
developmentfrom
feature/Feb7Changes
Feb 8, 2026
Merged

Feature/feb7 changes#9
Orcasphynx merged 3 commits into
developmentfrom
feature/Feb7Changes

Conversation

@Orcasphynx

Copy link
Copy Markdown
Collaborator

No description provided.

@github-actions

github-actions Bot commented Feb 8, 2026

Copy link
Copy Markdown

AI Code Review

Hello team!

This pull request introduces some fantastic improvements, especially around logging, drivetrain control, and overall code structure. It's great to see such a strong focus on best practices!

Positive Highlights

  1. Enhanced Telemetry and Logging: The new Telemetry class is an excellent addition, providing comprehensive logging and visualization of the swerve drive state. Using NetworkTables, SignalLogger, and Mechanism2d for diagnostics will be incredibly valuable for debugging and understanding robot behavior during practice and competition.
  2. Improved Drivetrain Command Design: The refactoring of driveForward() to include seedFieldCentric() and withTimeout for robust command sequencing is a significant step forward. Similarly, the DriveToPose command now consistently leverages centralized PID controller creation, which is great for maintainability.
  3. Centralized PID Configuration: Moving PID controller instantiation into factory methods (getTranslationPIDController, getRotationPIDController) within DrivetrainSubsystem is a prime example of good object-oriented design, promoting consistency and reducing code duplication.
  4. Spotless Enforcement: Adding compileJava.dependsOn 'spotlessApply' to build.gradle is a smart move that will help ensure consistent code formatting across the entire codebase, making it easier for everyone to read and contribute.

Suggestions

Here are a few suggestions to consider for further enhancements:

FRC/WPILib Best Practices

  • Thread Priority Management:
    • File: src/main/java/frc/robot/Robot.java
    • Suggestion: Consider adding Thread.currentThread().setPriority(4); in the Robot() constructor or robotInit() method. This can help ensure that the main robot thread receives consistent CPU time, which is crucial for maintaining a stable control loop and predictable robot performance.
    • Why it matters: Elevating the main thread's priority can prevent minor delays or "jitter" in your periodic loops, leading to more responsive and reliable robot control.

Java Standards

  • Javadoc for Telemetry Private Fields:
    • File: src/main/java/frc/robot/Telemetry.java
    • Suggestion: While the Telemetry class itself has a good Javadoc, it might be helpful to add brief Javadoc comments for the private NetworkTable publishers and Mechanism2d arrays (e.g., m_moduleMechanisms, m_moduleSpeeds, m_moduleDirections). This would clarify their specific purpose and how they contribute to the telemetry system at a glance.
    • Why it matters: Even for private fields, clear documentation significantly improves code maintainability, especially for custom classes like Telemetry that manage complex interactions with external systems like NetworkTables and SmartDashboard.

Code Quality

  • Error Logging in DriveState:
    • File: src/main/java/frc/robot/statemachines/DriveState.java
    • Suggestion: In the catch block within grabVisionEstimateList(), you're currently using System.out.println for error messages. For a production FRC robot, it might be more robust to use a dedicated logging mechanism (like Logger.recordOutput or CTRE Hoot logging if applicable) or DriverStation.reportError. This ensures that important error messages are consistently recorded and visible in the Driver Station logs.
    • Why it matters: Consistent error logging practices make it much easier to diagnose and debug issues during competition. System.out.println messages can sometimes be overlooked, whereas Driver Station errors are more prominent and persistent.

Custom Rules and Best Practices

  • Type-Safe Units for PID Tolerances:
    • File: src/main/java/frc/robot/subsystems/drive/DriveConstants.java
    • Suggestion: For TRANSLATION_ALIGN_TOLERANCE and ROTATION_ALIGN_TOLERANCE, consider defining these constants using WPILib's type-safe units (e.g., Meters.of(0.01) and Degrees.of(1)). Although the PIDController currently accepts double values, using units explicitly clarifies intent and helps prevent potential unit-related errors if these values are used in other unit-aware contexts in the future.
    • Why it matters: Adhering to type-safe units, as outlined in our guidelines, consistently reduces the risk of conversion errors and makes the code's meaning clearer, even when an external API might still require a raw double.

Questions

  • Regarding the Telemetry class, are there any plans to integrate this with AdvantageKit's @AutoLog annotation processing in the future, or is SignalLogger sufficient for the team's current logging and deterministic replay needs?

Keep up the fantastic work! These changes are a significant step forward for the robot's reliability and diagnostic capabilities.


This review was automatically generated by AI. Please use your judgment and feel free to discuss any suggestions!

@github-actions

github-actions Bot commented Feb 8, 2026

Copy link
Copy Markdown

✓ Build successful and code formatting check passed!

@github-actions

github-actions Bot commented Feb 8, 2026

Copy link
Copy Markdown

✓ Build successful and code formatting check passed!

@Orcasphynx
Orcasphynx merged commit 6f0bd3b into development Feb 8, 2026
2 checks passed
@Orcasphynx
Orcasphynx deleted the feature/Feb7Changes branch February 8, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant