โ ๏ธ EDUCATIONAL PURPOSE ONLYThis repository is a reference implementation created for educational purposes. It is NOT production-ready competition code. I am a parent mentor learning FTC programming to better support student teams. This codebase represents my learning journey and is shared openly so others can learn alongside me.
If you're a student team: Use this as a learning resource, but write your own code! The learning process is the most valuable part of FTC.
๐ Important: See the FTC Competition Rules & Ethics section below for guidance on using this code in compliance with FTC Rule R102.
This is a reference implementation for an FTC (FIRST Tech Challenge) robot designed for the DECODE season (2025-2026). The game involves shooting 5-inch spherical foam balls called "Artifacts" into goals, with scoring patterns called "Motifs" determined by AprilTag detection.
As a parent mentor with a software background but no robotics experience, I found it challenging to understand how all the pieces of an FTC robot fit together. The official documentation is excellent but scattered across many sources. I created this reference implementation to:
- Learn by doing - Building a complete system helped me understand the concepts
- Document patterns - Capture best practices I discovered along the way
- Help other mentors - Share what I learned so others don't start from zero
- Support student teams - Be a more effective mentor by understanding the code
- โ Not competition-ready - This code has never been tested on a real robot
- โ Not optimized - Performance and reliability need real-world tuning
- โ Not official - This is one person's interpretation, not FIRST-endorsed
- โ Not a shortcut - Students should write their own code to truly learn
Important for Student Teams:
This code is provided for learning purposes only. According to FTC Rule R102, "Only STUDENTS may be credited for design." This means:
- Study this code to understand concepts and patterns
- Use ideas and adapt them to your robot's specific needs
- Write your own code based on what you learn
- Understand any code you use - be able to explain it in your own words
- Document your learning process and decisions
- Don't copy code without understanding how it works
- Don't use code you can't explain to judges
- Don't treat this as a solution - it's a learning resource
- Don't skip the learning process - that's the most valuable part!
You must be able to explain your code. Judges will ask questions like:
- "How does this work?"
- "Why did you choose this approach?"
- "What would you do differently?"
If you use concepts from this reference, be ready to explain them in your own words. The best teams can discuss their code confidently because they understand it deeply.
The FTC Competition Manual (as of 2025-2026) does not explicitly prohibit AI-assisted coding tools. However, Rule R102 still applies: students must understand and be able to explain their code.
Best practices:
- Use AI as a learning tool, not a replacement for understanding
- Explain AI-generated code in your own words
- Modify and adapt code to fit your robot's needs
- Document your learning process
Remember: The learning process is more valuable than the final code!
The DECODE game (2025-2026 FTC season) features:
| Element | Description |
|---|---|
| Artifacts | 5-inch spherical foam balls (purple and green) |
| Motif | A pattern of 2 purple + 1 green artifacts in a specific order |
| Obelisk | Triangular structure with AprilTags (21, 22, 23) that reveals the Motif |
| Goals | 3-sided structures with triangular openings for scoring |
| Ramp & Gate | Classifier elements for pattern-based scoring |
- Autonomous: 30 seconds
- Transition: 8 seconds
- TeleOp: 2 minutes
- LEAVE: Robot must move off LAUNCH LINE by end of AUTO for points
- Expansion Limits (R105): 20ร42 inches starting, 20ร42ร42 during match
- PINNING: Cannot pin opponent for more than ~3 seconds
This reference implementation assumes a robot with:
| Component | Description |
|---|---|
| Drivetrain | Mecanum wheels with goBILDA Pinpoint odometry |
| Turret | Rotating platform for aiming (motor-controlled) |
| Hood | Adjustable angle for shot trajectory (servo-controlled) |
| Shooter | Flywheel mechanism for launching Artifacts |
| Gate | Servo-controlled ball release mechanism |
| Intake | Wide roller system for collecting Artifacts |
| Vision | Limelight 3A camera mounted on turret |
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/
โโโ common/ # Shared utilities and base classes
โ โโโ Robot.java # Central robot class (subsystem coordinator)
โ โโโ Subsystem.java # Abstract base for all subsystems
โ โโโ Alliance.java # RED/BLUE enum
โ โโโ MatchState.java # AUTO/TELEOP enum
โ โโโ AutoConstants.java # Autonomous configuration
โ
โโโ subsystems/ # Hardware abstraction layer
โ โโโ drive/
โ โ โโโ MecanumDrive.java # Drivetrain with Pedro Pathing integration
โ โ
โ โโโ turret/
โ โ โโโ Turret.java # Turret motor control + auto-aim
โ โ โโโ TurretConstants.java
โ โ
โ โโโ shooter/
โ โ โโโ Shooter.java # Flywheel control with RPM feedback
โ โ โโโ ShooterConstants.java
โ โ โโโ Hood.java # Adjustable hood angle
โ โ โโโ HoodConstants.java
โ โ โโโ Gate.java # Ball release timing
โ โ โโโ GateConstants.java
โ โ โโโ ShootOnMoveController.java
โ โ
โ โโโ vision/
โ โโโ LimelightVision.java # Limelight 3A interface
โ โโโ VisionConstants.java # All vision configuration
โ โโโ PoseFusion.java # Odometry + vision fusion
โ โโโ TurretAimController.java # Vision-based aiming
โ โโโ README.md # Vision system documentation
โ
โโโ pedroPathing/ # Motion planning
โ โโโ Constants.java # Pedro Pathing v2.0 configuration
โ โโโ tuning/
โ โโโ Tuning.java # Interactive tuning OpMode
โ
โโโ opmodes/ # Driver-runnable programs
โ โโโ teleop/
โ โ โโโ MainTeleOp.java # Primary driver control
โ โ
โ โโโ auto/
โ โ โโโ Auto_Blue_Park_Basic.java # Simple park (no pathing)
โ โ โโโ Auto_Red_Park_Basic.java
โ โ โโโ Auto_Blue_MVP.java # Full auto with shooting
โ โ โโโ Auto_Red_MVP.java
โ โ โโโ MotifAutoExample.java # Motif detection demo
โ โ
โ โโโ test/
โ โโโ (test opmodes)
โ
โโโ utils/
โโโ GamepadEvents.java # Button edge detection
Pedro Pathing provides smooth, curved autonomous paths using Bezier curves.
Key files:
pedroPathing/Constants.java- All configuration in one placesubsystems/drive/MecanumDrive.java- Follower integration
Concepts demonstrated:
- Follower initialization with FollowerBuilder
- Path following with PathChains
- Localization via goBILDA Pinpoint
- Field-centric teleop driving
The Limelight camera enables target tracking, AprilTag detection, and pose estimation.
Key files:
subsystems/vision/LimelightVision.java- Camera interfacesubsystems/vision/VisionConstants.java- All vision tuningsubsystems/vision/README.md- Detailed documentation
Capabilities:
- Target Tracking: Find Obelisk/Goals and calculate aim error
- Distance Estimation: Trigonometric calculation from target
- AprilTag Detection: Read Motif pattern, localize on field
- Pose Fusion: Correct odometry drift after collisions
The shooting system automatically aims and adjusts based on target distance.
Components:
| Subsystem | Function |
|---|---|
Turret |
Rotates to aim at target |
Hood |
Adjusts angle for distance |
Shooter |
Spins flywheel to calculated RPM |
Gate |
Controls ball release timing |
Shot sequence:
- Vision acquires target
- Turret auto-aims (PID control)
- Hood adjusts angle for distance
- Flywheel spins to distance-based RPM
- All conditions met โ Gate opens โ Ball fires
When the robot collides with field elements or other robots, odometry can drift. The PoseFusion system uses AprilTags to snap back to the correct position.
Key file: subsystems/vision/PoseFusion.java
How it works:
- Continuously compare odometry pose to AprilTag-based pose
- When drift exceeds threshold and tags are visible
- Smoothly correct position (configurable alpha blending)
- Cooldown prevents jittery corrections
For efficient autonomous cycles, the robot pre-spools the shooter while approaching the shooting position.
Key file: subsystems/shooter/ShootOnMoveController.java
Strategy:
- At 70% path completion: Start acquiring target
- At 80% path completion: Start spooling flywheel
- At 100%: Ready to shoot immediately
| Control | Action |
|---|---|
| Left Stick | Drive (field-centric) |
| Right Stick | Rotate |
| Right Trigger | Intake |
| Left Trigger | Reverse intake |
| A Button | Toggle auto-aim |
| B Button | Fire shot |
| X Button | Queue shot |
| Y Button | Cancel queued shot |
| D-Pad Up/Down | Manual RPM adjust |
| Left Bumper | Manual turret left |
| Right Bumper | Manual turret right |
These names must match your Robot Configuration on the Control Hub:
| Type | Name | Description |
|---|---|---|
| Motor | leftFront |
Front left drive motor |
| Motor | leftRear |
Rear left drive motor |
| Motor | rightFront |
Front right drive motor |
| Motor | rightRear |
Rear right drive motor |
| Motor | turret |
Turret rotation motor |
| Motor | flywheel |
Shooter flywheel motor |
| Motor | intakeMotor |
Intake motor |
| Servo | hood |
Hood angle servo |
| Servo | gate |
Ball release servo |
| Servo | indexer |
Ball indexer servo |
| I2C | pinpoint |
goBILDA Pinpoint module |
| Other | limelight |
Limelight 3A camera |
Most constants are annotated with @Config for real-time tuning via FTC Dashboard:
- Connect to
http://192.168.43.1:8080/dash - Modify values in the configuration panel
- Changes apply immediately (no recompile needed)
Key tunable classes:
VisionConstants- All vision parametersTurretConstants- Turret PID and limitsShooterConstants- RPM targets and PIDF gainsHoodConstants- Angle mappingGateConstants- Shot timing
- Android Studio Ladybug (2024.2) or later
- JDK 17 installed and configured
- FTC SDK (this repository is based on the official SDK)
-
Clone this repository:
git clone https://github.com/marktsears/ftc-decode-reference.git
-
Open in Android Studio:
- File โ Open โ Select the cloned folder
-
Configure JDK (if needed):
- Edit
gradle.properties - Set
org.gradle.java.hometo your JDK 17 path
- Edit
-
Build:
- Build โ Make Project (or Ctrl+F9)
-
Deploy to Control Hub:
- Connect via USB or WiFi
- Run โ Select your configuration
- Review the architecture: Start with
common/Robot.javato understand how subsystems connect - Study a simple OpMode: Look at
Auto_Blue_Park_Basic.javafor minimal complexity - Understand vision: Read
subsystems/vision/README.mdthoroughly - Trace a feature: Follow the auto-aim flow from
MainTeleOpthrough all subsystems
๐ก Learning Tip: As you study this code, ask yourself:
- "Why was this approach chosen?"
- "How would I adapt this for my robot?"
- "Can I explain this to someone else?"
The goal is understanding, not copying. Write your own code based on what you learn!
This is a personal learning project, but I welcome:
- Bug reports - If you spot errors in the code
- Suggestions - Better patterns or approaches
- Questions - Help me improve the documentation
Please open an issue or submit a pull request!
This project is based on the official FTC SDK and follows its licensing terms. The custom code in TeamCode/ is provided as-is for educational purposes.
Teams may:
- โ Study and learn from the code
- โ Adapt concepts for their own robots
- โ Use code snippets with attribution
- โ Reference patterns and architectures
Teams must:
- โ Understand any code they use
- โ Be able to explain it during judging
- โ Follow FTC Rule R102 (student work requirements)
- โ Write their own code based on what they learn
Attribution: If you use significant portions of this code, consider adding a comment like:
// Adapted from FTC DECODE Reference Implementation
// Original concepts learned from: [repository URL]This is not required, but demonstrates good practice and transparency.
- FIRST for creating the FTC program
- Pedro Pathing team for their excellent motion planning library
- Limelight for making vision accessible
- The FTC community for countless tutorials and examples
- Student teams everywhere who inspire mentors to keep learning
Built with โ and curiosity by a parent mentor learning alongside the students