Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(auto): auto programs #14

Merged
merged 4 commits into from
Mar 6, 2025
Merged

feat(auto): auto programs #14

merged 4 commits into from
Mar 6, 2025

Conversation

Baconing
Copy link
Member

@Baconing Baconing commented Mar 6, 2025

works okay but i need to merge for more progress

Summary by CodeRabbit

  • Deployment Improvements

    • Now, obsolete files are automatically removed during deployment, ensuring the system stays synchronized.
  • Autonomous Routines & Paths

    • Introduced new and updated autonomous routines and path configurations for more refined navigation.
  • Robot Performance Enhancements

    • Updated physical and performance settings—including dimensions, weight, drive capabilities, and module positions—for improved operation.
    • Streamlined autonomous command scheduling for enhanced responsiveness.

Baconing and others added 4 commits March 5, 2025 17:20
Co-authored-by: Brenden Freier <iam@baconi.ng>
i'm not 100% sure on the module's X locations, but im fairly confident because it looks very close in pathplanner

Co-authored-by: Brenden Freier <iam@baconi.ng>
@Baconing Baconing added Kind/Enhancement Improve existing functionality Kind/Feature New functionality labels Mar 6, 2025
@Baconing Baconing requested a review from Trip-kun March 6, 2025 03:51
@Baconing Baconing self-assigned this Mar 6, 2025
Copy link

coderabbitai bot commented Mar 6, 2025

Walkthrough

This pull request updates deployment configurations and robot behavior. The changes ensure that obsolete files are removed during deployment by toggling the delete flag. Multiple autonomous routine and path configuration files have been added or modified to reflect updated paths, waypoints, and commands. Adjustments to robot settings and physical constants—including a dynamic motor speed calculation—were made. Finally, the autonomous mode selection in the robot code was streamlined, and unused initialization code was removed from the drive subsystem.

Changes

File(s) Change Summary
build.gradle.kts Updated deleteOldFiles property for the frcStaticFileDeploy artifact (from false to true).
deploy/pathplanner/autos/... New Files: Added autonomous configuration files for routines "Left Coral", "Middle Coral", "Right Coral", and "Right Cower".
Modified: Updated Left Cower.auto to change the pathName value from "Example Path" to "Left Cower".
deploy/pathplanner/paths/... New Files: Introduced path configuration files for "Left Coral", "Left Cower", "Right Coral", and "Right Cower".
Modified: Adjusted waypoint coordinates and control points in Middle Coral.path.
deploy/pathplanner/settings.json Modified robot dimensions, mass, drive wheel radius, max drive speed, and module positions.
src/main/kotlin/org/frc5183/Robot.kt Removed the AutoMode enum and related chooser; introduced a LoggedDashboardChooser<Command> for autonomous command selection; simplified autonomousPeriodic.
src/main/kotlin/org/frc5183/constants/AutoConstants.kt
src/main/kotlin/org/frc5183/constants/PhysicalConstants.kt
src/main/kotlin/org/frc5183/constants/swerve/modules/...
In AutoConstants.kt, removed an unused import and adjusted constructor parameters.
In PhysicalConstants.kt, replaced static MAX_SPEED with a computed formula using motor free speed, gear ratio, and wheel diameter.
Swerve module constants (BackLeft, BackRight, FrontLeft, FrontRight) updated their LOCATION coordinates.
src/main/kotlin/org/frc5183/subsystems/drive/SwerveDriveSubsystem.kt Removed commented-out auto builder initialization code from the initialization block.

Sequence Diagram(s)

sequenceDiagram
    participant R as Robot
    participant AC as autoChooser
    participant S as CommandScheduler

    R->>AC: Initialize via AutoBuilder.buildAutoChooser()
    AC-->>R: Provide the selected autonomous Command
    R->>S: Schedule the returned Command for autonomous mode
Loading

Suggested reviewers

  • Trip-kun

Poem

I'm a rabbit hopping through code all day,
Tweaking files in a curious, nimble way.
Paths and commands now dance in a row,
With each update, the systems glow.
Hoppy cheers for changes bright and new!
Carrots and code—a blend so true!

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Collaborator

@Trip-kun Trip-kun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto auto auto auto auto auto auto auto

@Baconing Baconing merged commit 58fc006 into master Mar 6, 2025
1 check passed
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/kotlin/org/frc5183/constants/PhysicalConstants.kt (1)

109-122: Well-organized maximum constraints block.
Keeping max acceleration and angular definitions together improves readability. If you haven’t already, measure these values through swerve characterization to ensure more precise control.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 65057d8 and 9e752f0.

📒 Files selected for processing (20)
  • build.gradle.kts (1 hunks)
  • deploy/pathplanner/autos/Left Coral.auto (1 hunks)
  • deploy/pathplanner/autos/Left Cower.auto (1 hunks)
  • deploy/pathplanner/autos/Middle Coral.auto (1 hunks)
  • deploy/pathplanner/autos/Right Coral.auto (1 hunks)
  • deploy/pathplanner/autos/Right Cower.auto (1 hunks)
  • deploy/pathplanner/paths/Left Coral.path (1 hunks)
  • deploy/pathplanner/paths/Left Cower.path (1 hunks)
  • deploy/pathplanner/paths/Middle Coral.path (1 hunks)
  • deploy/pathplanner/paths/Right Coral.path (1 hunks)
  • deploy/pathplanner/paths/Right Cower.path (1 hunks)
  • deploy/pathplanner/settings.json (2 hunks)
  • src/main/kotlin/org/frc5183/Robot.kt (4 hunks)
  • src/main/kotlin/org/frc5183/constants/AutoConstants.kt (2 hunks)
  • src/main/kotlin/org/frc5183/constants/PhysicalConstants.kt (1 hunks)
  • src/main/kotlin/org/frc5183/constants/swerve/modules/BackLeftSwerveModuleConstants.kt (1 hunks)
  • src/main/kotlin/org/frc5183/constants/swerve/modules/BackRightSwerveModuleConstants.kt (1 hunks)
  • src/main/kotlin/org/frc5183/constants/swerve/modules/FrontLeftSwerveModuleConstants.kt (1 hunks)
  • src/main/kotlin/org/frc5183/constants/swerve/modules/FrontRightSwerveModuleConstants.kt (1 hunks)
  • src/main/kotlin/org/frc5183/subsystems/drive/SwerveDriveSubsystem.kt (0 hunks)
💤 Files with no reviewable changes (1)
  • src/main/kotlin/org/frc5183/subsystems/drive/SwerveDriveSubsystem.kt
✅ Files skipped from review due to trivial changes (5)
  • deploy/pathplanner/autos/Left Cower.auto
  • deploy/pathplanner/paths/Left Coral.path
  • deploy/pathplanner/autos/Right Cower.auto
  • deploy/pathplanner/autos/Right Coral.auto
  • deploy/pathplanner/paths/Right Cower.path
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (20)
deploy/pathplanner/autos/Left Coral.auto (1)

1-25:

❓ Verification inconclusive

New autonomous routine looks well-structured

This new autonomous routine follows the correct format for PathPlanner 2025.0. The sequential command structure that follows the "Left Coral" path and then executes the "Shoot Coral" command is clear and straightforward.

Make sure that the "Left Coral" path and "Shoot Coral" command referenced here are properly defined elsewhere in the codebase.


🏁 Script executed:

#!/bin/bash
# Check if the referenced path and command exist
echo "Checking for 'Left Coral' path..."
fd "Left Coral.path" deploy/pathplanner/paths/

echo "Checking for 'Shoot Coral' command definition..."
rg "Shoot Coral" src/ -A 10 --type java --type kotlin

Length of output: 341


Autonomous Routine Structure Verified – Please Verify "Shoot Coral" Command Definition

  • The JSON structure for PathPlanner 2025.0 is correct and the sequential command structure is clear.
  • The "Left Coral" path was confirmed to exist at deploy/pathplanner/paths/Left Coral.path.
  • However, our search for a "Shoot Coral" command definition (in Java/Kotlin source files) returned no results. Please manually verify that "Shoot Coral" is properly defined elsewhere in the codebase (e.g., in configuration files or another supported location) to ensure the command executes as intended.
build.gradle.kts (1)

49-49: Good deployment hygiene practice

Changing deleteOldFiles to true ensures that old, unused files are removed from the RoboRIO during deployment. This is particularly important when managing autonomous routines and paths to prevent confusion or errors from outdated files.

deploy/pathplanner/autos/Middle Coral.auto (1)

1-25:

✅ Verification successful

Well-formed autonomous routine configuration

This autonomous routine for "Middle Coral" follows the correct PathPlanner format and maintains consistency with other auto routines. The sequential commands to follow the "Middle Coral" path and then execute "Shoot Coral" are clearly defined.

Verify that the "Middle Coral" path exists in the project:


🏁 Script executed:

#!/bin/bash
# Check if the referenced path exists
echo "Checking for 'Middle Coral' path..."
fd "Middle Coral.path" deploy/pathplanner/paths/

Length of output: 180


Final Review Comment: Autonomous Routine Configuration Approved

The "Middle Coral" autonomous routine configuration is well-formed and consistent with other auto routines. The verification has confirmed that the expected path file (deploy/pathplanner/paths/Middle Coral.path) exists in the project. No changes are needed.

src/main/kotlin/org/frc5183/constants/AutoConstants.kt (2)

48-49: Fixed comma syntax

The added comma after PhysicalConstants.OPTIMAL_VOLTAGE ensures proper syntax for the constructor call.


27-27:

✅ Verification successful

Using consistent speed constants

Good change to use PhysicalConstants.MAX_SPEED directly, which provides a more consistent approach to speed calculations throughout the codebase.

Let's verify how MAX_SPEED is defined in PhysicalConstants:


🏁 Script executed:

#!/bin/bash
# Check the definition of MAX_SPEED in PhysicalConstants
rg "MAX_SPEED" src/main/kotlin/org/frc5183/constants/PhysicalConstants.kt -A 5

Length of output: 312


Consistent use of speed constants verified
The update to use PhysicalConstants.MAX_SPEED directly in AutoConstants.kt is confirmed by its clear definition in PhysicalConstants.kt (using Units.MetersPerSecond with an appropriate formula). This centralized approach ensures consistent speed calculations throughout the codebase.

src/main/kotlin/org/frc5183/constants/swerve/modules/FrontLeftSwerveModuleConstants.kt (1)

16-17: Coordinate update for front left module looks correct

The update to (12.5, 12.0) for the front left module follows the expected coordinate convention for a swerve drive, placing it in the front left quadrant of the robot.

src/main/kotlin/org/frc5183/constants/swerve/modules/FrontRightSwerveModuleConstants.kt (1)

16-17: Coordinate update for front right module looks correct

The update to (12.5, -12.0) for the front right module follows the expected coordinate convention for a swerve drive, placing it in the front right quadrant of the robot.

src/main/kotlin/org/frc5183/constants/swerve/modules/BackRightSwerveModuleConstants.kt (1)

16-17: Coordinate update for back right module looks correct

The update to (-12.5, -12.0) for the back right module follows the expected coordinate convention for a swerve drive, placing it in the back right quadrant of the robot.

deploy/pathplanner/paths/Left Cower.path (1)

1-54: Path configuration looks well-structured

This new path configuration for "Left Cower" defines a clear trajectory from the "Left Start Point" to the specified end point. The path uses appropriate constraints for velocity, acceleration, and angular movement that align with the global settings.

A couple of observations:

  • The version "2025.0" indicates this is using a newer version of PathPlanner
  • The waypoints are precisely defined with proper control points for smooth trajectory generation
deploy/pathplanner/paths/Middle Coral.path (1)

6-7: Waypoint positioning adjustments look reasonable

The coordinate changes for the Middle Coral path create a straight-line path along the same y-coordinate (4.011881408691406). This should result in simpler, more predictable robot movement.

The addition of the "Middle Start Point" link will help maintain consistency if the starting position needs to be adjusted globally in the future.

Also applies to: 11-12, 15-15, 19-20, 23-24

deploy/pathplanner/paths/Right Coral.path (1)

1-54: Path configuration is well-defined

The "Right Coral" path creates a trajectory from the "Right Start Point" with appropriate control points for a smooth path. The final rotation of 61.6° at the goal end state is intentional and likely positions the robot correctly for a shooting position.

All constraints appear to use the global settings (useDefaultConstraints: true), which maintains consistency with other paths.

deploy/pathplanner/settings.json (1)

2-3: Robot physical parameters updated to match actual hardware

The changes to the robot's physical dimensions, mass, wheel radius, and module positions appear to be calibrations to match the actual hardware. A few key observations:

  1. The swerve module positions now form a rectangle that's wider than it is long (0.636m × 0.6096m)
  2. The maximum drive speed (5.39496 m/s) is now more realistic given the smaller wheel radius
  3. The reduced mass (35kg vs 50kg) will affect trajectory following and should improve acceleration

These changes should result in more accurate path following during autonomous routines.

Also applies to: 12-12, 15-15, 17-17, 21-28

src/main/kotlin/org/frc5183/Robot.kt (6)

3-4: Check if the new imports are fully utilized.
While these imports look correct, verify that NamedCommands is actually referenced. If not, removing the unused import can reduce clutter.


62-65: Great clarity on brake timer usage.
The comment clearly explains the purpose of the timer, and the instantiation seems correct. No further issues noted.


67-67: Streamlined approach using LoggedDashboardChooser looks good.
Replacing the old enum-based auto mode selection with a chooser-based system is simpler and more flexible.


129-130: Ensure auto routines are displayed and accessible.
The call to SmartDashboard.putData ensures the user can view and select autonomous routines. This is a clean integration with the new auto command approach.


165-165: Consistent scheduling of autonomous commands.
Canceling all commands before scheduling the chosen auto ensures a fresh state. This is best practice for FRC autonomous.


169-169: Confirm removal of any needed autonomous updates.
If the autonomous commands handle all periodic tasks, leaving this method empty is fine. However, ensure any essential per-cycle logic has been moved to commands.

src/main/kotlin/org/frc5183/constants/PhysicalConstants.kt (2)

90-90: Validate the updated wheel diameter.
Ensure that the 4-inch wheel diameter is accurate. If it differs from real hardware, the calculated speeds may be off.


91-108: Effective calculation of MAX_SPEED.
Your formula for theoretical max speed is appropriate. Note that real-world friction and battery voltage drops may lower the actual top speed. Consider verifying the final speed through on-field testing.

Comment on lines 16 to +17
override val LOCATION: Translation2d
= Translation2d(Units.Inches.of(12.25), Units.Inches.of(-15.0))
= Translation2d(Units.Inches.of(12.5), Units.Inches.of(-12.0))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Potential coordinate error in BackLeftSwerveModuleConstants

The coordinates (12.5, -12.0) for the back left module appear incorrect. Based on standard swerve drive coordinate conventions, the back left module should be in the (-X, +Y) quadrant. The current coordinates place it in the same position as the front right module, which isn't physically possible.

Consider updating to something like: Translation2d(Units.Inches.of(-12.5), Units.Inches.of(12.0))


🏁 Script executed:

#!/bin/bash
# Check the coordinates of all swerve modules to verify
echo "Checking all swerve module locations for consistency..."

# Find all SwerveModuleConstants files
fd ".*SwerveModuleConstants.kt" src/main/kotlin/org/frc5183/constants/swerve/modules/

Length of output: 634


Swerve Module Coordinate Correction Needed for BackLeftSwerveModuleConstants.kt

  • The current definition:
        override val LOCATION: Translation2d = Translation2d(Units.Inches.of(12.5), Units.Inches.of(-12.0))
    places the back left module in the same quadrant as the front right module.
  • Based on standard swerve drive conventions (with the back left module expected in the (-X, +Y) quadrant), please update this value. For example, consider changing it to:
        override val LOCATION: Translation2d = Translation2d(Units.Inches.of(-12.5), Units.Inches.of(12.0))
  • Verify that this modification restores symmetry across all module constants.

@Baconing Baconing deleted the feat_auton-programs branch March 6, 2025 17:18
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Kind/Enhancement Improve existing functionality Kind/Feature New functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants