From 329bfd24c437e6df43553fc641e3a82d9be3bf03 Mon Sep 17 00:00:00 2001 From: MrC Date: Sun, 3 May 2026 21:00:18 +0000 Subject: [PATCH] Index Team 2890 Mothman robot code for training reference --- sources/2890/mothman-robot-code.md | 54 ++++++++ training/modules/2890-codebase-index.md | 158 ++++++++++++++++++++++++ 2 files changed, 212 insertions(+) create mode 100644 sources/2890/mothman-robot-code.md create mode 100644 training/modules/2890-codebase-index.md diff --git a/sources/2890/mothman-robot-code.md b/sources/2890/mothman-robot-code.md new file mode 100644 index 0000000..81c7a0b --- /dev/null +++ b/sources/2890/mothman-robot-code.md @@ -0,0 +1,54 @@ +--- +type: source +id: source.team2890-mothman +title: Mothman — Team 2890 Robot Code +domain: robotics +status: active +access: gitea-api-token +sourceType: gitea-repo +repo: Team2890/Mothman +url: http://2890.duckdns.org:3002/Team2890/Mothman +language: Java +description: 2026 FRC robot code — swerve drive, PathPlanner autonomous, PhotonVision +tags: [frc, 2890, java, swerve, autonomous, pathplanner, photonvision, yagsl] +--- + +# Team 2890 — Mothman Robot Code + +**Repo:** http://2890.duckdns.org:3002/Team2890/Mothman +**Language:** Java (WPILib 2026) +**Season:** 2026 REBUILT + +--- + +## What's Here + +### Subsystems +- **SwerveSubsystem** — YAGSL swerve drive with field-relative control +- **Vision** — AprilTag detection via PhotonVision, pose estimation +- **ClimberSubsystem** — Climber mechanism +- **IntakeSubsystem** — Game piece intake +- **ShooterSubsystem** — Scoring shooter +- **TargetingSubsystems** — Aim assist + +### Commands +- **AbsoluteDriveAdv** — Advanced field-relative swerve drive +- **AutoBalanceCommand** — Auto leveling on charge station +- PathPlanner autonomous routines + +### Config +- Swerve module JSON configs (NEO motors) +- PathPlanner paths + autos +- Vendor dependencies (Phoenix 5/6, REV, PathPlanner, PhotonVision) + +--- + +## For Training + +This codebase demonstrates real FRC programming patterns: +- Command-based architecture +- Swerve drive implementation +- Autonomous path planning +- Vision processing integration + +**C++ note:** Patterns are identical. Syntax differs but logic is the same. \ No newline at end of file diff --git a/training/modules/2890-codebase-index.md b/training/modules/2890-codebase-index.md new file mode 100644 index 0000000..14abf57 --- /dev/null +++ b/training/modules/2890-codebase-index.md @@ -0,0 +1,158 @@ +--- +type: training-material +domain: robotics +subdomain: code-index +level: reference +tags: [frc, java, swerve, autonomous, pathplanner, photonvision, yagsl] +status: active +source: Team2890 Gitea (Mothman repo) +--- + +# Team 2890 Codebase Index — Training Reference + +**Source:** http://2890.duckdns.org:3002/Team2890/Mothman +**Access:** Via Gitea API token (read) +**Language:** Java (WPILib) +**Note:** Concepts apply to C++ — syntax differs, patterns identical + +--- + +## Repo Structure Overview + +``` +Mothman/ +├── src/main/java/frc/robot/ +│ ├── Constants.java — Robot-wide constants +│ ├── LimelightHelpers.java — Vision targeting helpers +│ ├── Main.java — Robot entry point +│ ├── Robot.java — Main robot class (periodic methods) +│ ├── RobotContainer.java — Joysticks, commands, subsystems wiring +│ ├── commands/ — Command classes +│ └── subsystems/ — Hardware subsystem controllers +├── src/main/deploy/ +│ ├── pathplanner/ — Autonomous paths + autos +│ └── swerve/ — Swerve module JSON configs +└── vendordeps/ — Vendor libraries (Phoenix, REV, etc.) +``` + +--- + +## Key Training Resources by Topic + +### 🏎️ Swerve Drive (YAGSL) + +**Config files:** +- `deploy/swerve/neo/swervedrive.json` — swerve drive config +- `deploy/swerve/neo/modules/*.json` — per-module PID/physical properties + +**Code:** +- `subsystems/swervedrive/SwerveSubsystem.java` — main swerve controller +- `commands/swervedrive/drivebase/AbsoluteDriveAdv.java` — advanced field-relative drive + +**Training value:** +- YAGSL configuration structure (JSON-based swerve setup) +- Swerve module characterization +- Field-relative vs robot-relative control + +--- + +### 📍 PathPlanner (Autonomous) + +**Config:** +- `src/main/deploy/pathplanner/autos/*.auto` — named autonomous routines +- `src/main/deploy/pathplanner/paths/*.path` — individual path segments + +**Example autos:** +- `1 Meter Test Auto.auto` +- `90 Degree Test Auto.auto` + +**Training value:** +- Auto path structure (waypoints, constraints) +- PathPlannerLib integration +- Auto command sequencing + +--- + +### 👁️ Vision (PhotonVision + Limelight) + +**Code:** +- `subsystems/swervedrive/Vision.java` — AprilTag detection, pose estimation +- `LimelightHelpers.java` — Limelight vision helpers + +**Training value:** +- Camera pipeline setup (PhotonVision) +- AprilTag interpretation (field layout) +- Pose estimation from vision + +--- + +### 🎮 Subsystems + +| File | What it Controls | +|------|------------------| +| `ClimberSubsystem.java` | Robot climber mechanism | +| `IntakeSubsystem.java` | Game piece intake | +| `ShooterSubsystem.java` | Scoring shooter | +| `TargetingSubsystems.java` | Aim assist | + +**Training value:** +- Subsystem architecture (commands bound to triggers) +- Motor controller setup (Phoenix/REV) + +--- + +### ⚙️ Vendor Dependencies (vendordeps/) + +| Library | Purpose | +|---------|---------| +| `Phoenix5-replay-5.36.0.json` | TalonFX (legacy) | +| `Phoenix6-replay-26.1.0.json` | TalonFX (new) | +| `REVLib.json` | NEO, SparkFlex motors | +| `PathplannerLib-2026.1.2.json` | Auto/path planning | +| `photonlib.json` | PhotonVision | +| `yagsl-2026.1.14.json` | Swerve library | +| `ReduxLib-2026.1.1.json` | Sensors | +| `Studica-2026.0.0.json` | Contour following | +| `ThriftyLib-2026.json` | Thrifty cameras | + +--- + +## Key Files for C++ Developers + +**For C++ teams learning from Java code:** + +| Pattern | Java (Mothman) | C++ (WPILib) | +|---------|----------------|--------------| +| Subsystem class | `extends SubsystemBase` | Inherit `frc::SubsystemBase` | +| Command binding | `+=` operator | `AddCommands()` | +| Motor controller | `.set()` | `Set()` | +| Joystick input | `driver.getRawButton()` | `GetRawButton()` | +| Auto commands | `pathplanner` | `pathplanner` (same lib) | + +--- + +## What to Use for Training + +**For students learning FRC programming:** +1. Start with `SwerveSubsystem.java` — see swerve control in action +2. Look at `AbsoluteDriveAdv.java` — field-relative swerve drive logic +3. Check `RobotContainer.java` — how subsystems + commands + joysticks wire together +4. Study the path files — how autos are composed from paths + +**For C++ students:** +- The pattern is identical. Focus on the logic, not the syntax. +- YAGSL config (JSON) works the same in both languages + +--- + +## External Mirrors + +| Repo | URL | Purpose | +|------|-----|---------| +| PhotonVision | Team2890/PhotonVision | Vision processing (mirrored from github) | +| YAGSL | Team2890/YAGSL | Swerve library (mirrored) | +| allwpilib | Team2890/allwpilib | WPILib source (mirrored) | + +--- + +**Access:** `http://2890.duckdns.org:3002/Team2890/Mothman` \ No newline at end of file