Skip to content

Pearadox/2024BetaRobot

Repository files navigation

2024BetaRobot

FRC Team 5414's code for the 2024 competition robot for Crescendo ⭕, Checkout 🛒. The code is written in Java and uses WPILib's Java command-based structure.

Code Highlights

  • Field-Centric Swerve Drive

    The robot's drivetrain is a standard swerve drivetrain with field-centric control using double Kraken X60 modules. The drivetrain uses encoders, a Pigeon 2 gyro, and odometry to control movement during the autonomous and teleoperated phases. The rotation of the drivetrain can be controlled either through speed or heading.

  • Note Shooter Flywheels and Pivot, Transport System, Arm Bar Pivot, Climbing Sequence

    The robot uses WPILib subsystems and enums to effectively create a state machine that controls each mechanism. The robot features a note shooter that uses dynamic voltage control to change shooting speeds using velocity PID control, and positional PID control for the shooter pivot; both relying on LerpTables based off of intended angle of the pivot calculated from the distance from to the speaker. The transport system to bring the note from the intake to the shooter uses a beam break sensor to detect if the note is in the shooter using a debouncer. The amp bar uses positional PID control for each setpoint, as does the climber, which also controlled through a climbing sequence that triggers various commands in step-wise function for ease of usability.

  • Autonomous Path Following

    The robot uses Team 3015's PathPlanner, a motion profile generator for FRC robots, to generate and follow autonomous trajectories. Autonomous routines are created using PathPlanner's built-in AutoBuilder and declaring NamedCommands with the PathPlanner application, and selected through sendable choosers in SmartDashboard.

  • Speaker and Note Alignment/Limelight Vision

    The robot uses Limelight's Vision Software to manage two mounted Limelight cameras that provide real-time positional data (Pose) of the robot based on field elements with Team 3636 General's vision backend code modified to support multiple cameras and MegaTag2. Speaker Alignment when shooting a note relies on either aligning to a specific AprilTag using "tx" values, or using 3D localization to align to a specific Pose, dependant on the visibility of the AprilTag. Note Alignment uses a TFLite machine learning model, trained with Dataset Colab's database, on the Limelight software, and aligns using "tx" values. All types of alignment use a PIDController with different values for constants.

  • AdvantageKit & AdvantageScope

    The robot uses AdvantageKit and AdvantageScope made by 6328 Mechanical Advantage to log useful information about the robot for debugging purposes.

Variable Naming Conventions

  • XXX_XXX (i.e. WHEEL_DIAMETER): All constants (screaming snake case)
  • xxXxxXxx (i.e. autoStartingSideChooser): All private instance variables (camel case)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages