Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 126 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,136 @@
# Standard_Swerve_Code
Originally the repository for creating FRC 3255's swerve drive classes in [SuperCORE](https://github.com/FRCTeam3255/SuperCORE), this repository now holds the example implementation of our SN_SuperSwerve class.
# 2026_Robot_Code — FRC Team 3255

## Important Things to Understand:
[Intro to Swerve - Software Overview](https://docs.google.com/presentation/d/1TPgX1LmMHTN7iIq1K4172TEAYrTftHnFnPqoAa06ExA/edit?usp=sharing) - *A presentation created to explain this code to 3255 members. Speaker notes contain what was generally spoken.*
- Generally, how a Swerve Drive works. I personally learned the most from my team & from SeanSun6814's (FRC 0 to Autonomous) [video](https://www.youtube.com/watch?v=0Xi9yb1IMyA)
- Optimization of swerve angles - Learn more [here](https://youtu.be/0Xi9yb1IMyA?t=226)
- What a Rotation2d is - [WPILib Documentation](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/geometry/pose.html#rotation)
- WPILib Robot Coordinate System & Field Coordinate System - [WPILib Documentation](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/geometry/coordinate-systems.html#robot-coordinate-system)
- What a Pose Estimator is and the constants required to tune it (standard deviation) - [WPILib Documentation](https://docs.wpilib.org/en/stable/docs/software/advanced-controls/state-space/state-space-pose-estimators.html#pose-estimators)
- Physical constants are measured in person or taken from the [online listing](https://www.swervedrivespecialties.com/products/mk4i-swerve-module).
Originally created to host FRC 3255's swerve-drive classes from [SuperCORE](https://github.com/FRCTeam3255/SuperCORE), this repository now contains the example implementation of our SN_SuperSwerve class and the full 2026 robot code.

## References:
- https://github.com/FRCTeam3255/Robot2023
- https://github.com/dirtbikerxz/BaseTalonFXSwerve
- https://github.com/SeanSun6814/FRC0ToAutonomous and his [video](https://www.youtube.com/watch?v=0Xi9yb1IMyA)
Jump into the code: `src/main/java/frc/robot`

# README Template
## Quick links

# XXXX_Robot_Code - FRC Team 3255's XXXX Robot
Jump into the code [`here!`](src/main/java/frc/robot)
- Intro to Swerve (presentation): https://docs.google.com/presentation/d/1TPgX1LmMHTN7iIq1K4172TEAYrTftHnFnPqoAa06ExA/edit?usp=sharing
- References:
- https://github.com/FRCTeam3255/Robot2023
- https://github.com/dirtbikerxz/BaseTalonFXSwerve
- https://github.com/SeanSun6814/FRC0ToAutonomous and his [video](https://www.youtube.com/watch?v=0Xi9yb1IMyA)

## This robot will compete at the following competitions:
## Competitions

## View Our Robots in Action!
- [Instagram](https://www.instagram.com/frcteam3255/)
- [YouTube (Primary)](https://www.youtube.com/@FRC3255)
- [YouTube (Clips)](https://www.youtube.com/@FRC3255Clips)
- [Build Thread (Chief Delphi)]()
- [Website](https://supernurds.com)
- California District Port Hueneme Event
- Califoania District Glendale Event
- FIRST South California State Champinship presented by Magna
- FIRST Championship - Hohnson Division

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
- FIRST Championship - Hohnson Division
- FIRST Championship - Johnson Division


## What is "The Game"
## Social

## Software Features
- Instagram: https://www.instagram.com/frcteam3255/
- YouTube (Primary): https://www.youtube.com/@FRC3255
- YouTube (Clips): https://www.youtube.com/@FRC3255Clips
- Build thread (Chief Delphi):

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

The "Build thread (Chief Delphi):" bullet has no URL/content. Consider adding the link or removing the bullet to avoid an empty entry in the Social list.

Suggested change
- Build thread (Chief Delphi):

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

add build thread link

- Website: https://supernurds.com

## Field Calibration
## REBUILT™ presented by Haas

## Checklists
- Game animation: https://www.youtube.com/watch?v=_fybREErgyM

## Software features

### Logging

We use Epilogue as our primary logging framework to record and visualize robot behavior in real time and after matches. We log:

- Motor outputs and velocities
- Current draw
- Sensor values (encoders, vision, etc.)
- Robot pose and estimator data
- State machine states and transitions
- Command execution timing

Key advantage

Logging allows us to understand exactly what the robot was "thinking" during a match. We can replay logs with data, graphs, and the field with robot poses to diagnose issues, tune performance, and identify inconsistencies.
Comment on lines +47 to +49

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

"Key advantage" is currently plain body text; if it's intended to be a label/heading, format it as a markdown heading/bold label (and consider adding a colon) so it renders distinctly from surrounding paragraphs.

Copilot uses AI. Check for mistakes.

### Simulation

We use WPILib simulation extensively during early development to validate robot logic without physical hardware. Simulation allows running full robot code in a virtual environment, including drivetrain movement, subsystem behavior, and autonomous routines.

In simulation we typically test:

- Autonomous routines and trajectory following
- State machine transitions
- Potential collisions

Key advantage

Simulation enables faster iteration and reduces risk before deploying to the real robot.
Comment on lines +61 to +63

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

"Key advantage" is currently plain body text; if it's intended to be a label/heading, format it as a markdown heading/bold label (and consider adding a colon) so it renders distinctly from surrounding paragraphs.

Copilot uses AI. Check for mistakes.

### Vision

#### Pose Align — vision-aided alignment

What it does

Pose Align automatically rotates the robot to face the target using vision. "Prep Anywhere" (smart shooting) allows accurate shots from anywhere on the field instead of using fixed presets.

How it works

- Using the robot's current pose we calculate shooting speed and hood angle based on distance using interpolation of calibration data.
- The robot "snaps" to the optimal heading by computing the target angle and applying a PID controller for smooth, precise rotation.
- During alignment the driver retains translational control while rotation is corrected automatically for consistent aiming.

#### Resistance to defence while shooting

We experienced heavy defence at our Division Championship, so the robot dynamically adjusts while shooting.
Comment on lines +79 to +81

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

Spelling is inconsistent with other repo references (e.g., "defense" in RobotContainer). For consistency/searchability, consider using a single spelling ("defense" or "defence") throughout.

Suggested change
#### Resistance to defence while shooting
We experienced heavy defence at our Division Championship, so the robot dynamically adjusts while shooting.
#### Resistance to defense while shooting
We experienced heavy defense at our Division Championship, so the robot dynamically adjusts while shooting.

Copilot uses AI. Check for mistakes.

How it works

- When at least one Limelight detects an AprilTag, the robot enters a generalized aiming state.
- In this state the hood angle, flywheel velocity, and drivetrain heading are continuously updated from vision data.
- If the drivetrain isn't at its target heading, both drivetrain rotation and hood angle are adjusted to converge on the correct shooting configuration.
- Once the robot reaches the desired heading the drivetrain may lock in an X-brake configuration to maintain stability while shooting.

### State machine control

What it is

Our state machine ensures the robot only transitions when it is fully ready, preventing invalid or unsafe actions.

How it works

- We use an enum-based system with nested switch logic to strictly control allowed transitions.
- The tryState method checks whether a requested transition is valid based on the current state and subsystem readiness, sensor inputs, and mechanism positions.
- If valid, tryState returns the new state and executes the associated command. Each state maps to commands with defined subsystem requirements to avoid conflicts.
- In `RobotContainer` we call tryState wrapped in a deferred proxy so the transition can be re-evaluated continuously and adapt to real-time conditions.

Key advantage

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

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

"Key advantage" is currently plain body text; if it's intended to be a label/heading, format it as a markdown heading/bold label (and consider adding a colon) so it renders distinctly from surrounding paragraphs.

Suggested change
Key advantage
**Key advantage:**

Copilot uses AI. Check for mistakes.

This system blocks invalid transitions, improves reliability under match pressure, simplifies debugging, and provides a structured, scalable framework for managing complex robot behavior.

### PID control & Motion Magic

PID is used for:

- Drivetrain heading control
- Shooter velocity regulation
- Vision alignment

Motion Magic is used for mechanisms that require motion profiling (for example: pivot, elevator). Our shooter hood and pivot use CTRE Motion Magic, which allows tuning of PID plus acceleration and cruise velocity.

### Autonomous (Autos)

Our autonomous routines use the command-based structure and trajectory following. Each auto typically combines:

- Preplanned paths (Choreo)
- Vision-assisted corrections
- State-machine-based actions (intake, shoot, align)

Driving modes

- Basic driving: Choreo-generated trajectories
- Pose Target driving: dynamically adjusts robot pose to enable Prep Anywhere (same smart-shooting logic used in teleop)

Commands

State-machine-based command sequencing ensures smooth, reliable execution. Many autonomous behaviors reuse teleop logic (drivetrain PID, alignment logic, state machine transitions), which reduces bugs and keeps behavior consistent between auto and teleop.

Optimizations

The robot will automatically run Prep Anywhere as soon as it crosses the alliance line to reduce aiming time.
Loading
Loading