Files
learning-garden/training/modules/2890-codebase-index.md
psb-gemma 47a8b40fdb Add growth state frontmatter to all 280 wiki files
TREE(74): training modules, entity profiles, 2890 references, keyword indices
SPROUT(42): knowledge pages, project docs, curated source material
SEED(164): daily notes, raw session logs, unprocessed material

Updated AUDIT_MANIFEST.json with growth classifications.
2026-05-14 01:27:59 +00:00

159 lines
4.7 KiB
Markdown

---
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)
growth: tree
---
# 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`