Skip to content

TNilCode/scratch-swerve

Repository files navigation

FRC From-Scratch Programming Challenge

Author: Taha Nilforooshan
Inspired by a challenge concept by: Rylan Moseley
Original Rules: https://gist.github.com/rylanmoseley/b3906b1832faed0d57897ed86b93cd39


Overview*

Modern FRC programming is built on powerful abstractions—REVLib, Phoenix, AdvantageKit, WPIMath, and countless frameworks that make robot software easier and more robust.
But the layers of abstraction also hide how these systems actually work.

This project is my attempt to rebuild FRC robot code from the ground up, using C++ written like C, avoiding all unnecessary abstractions and implementing every subsystem, calculation, and control loop manually.

This is not about convenience.
This is about understanding.


Challenge Rules

Language & Library Restrictions

  • Only edu.wpi.first.wpilibj and Java standard library packages (or C++ equivalents) may be used
  • No vendordeps
  • No WPIMath
  • No external frameworks or utilities

Originality Requirements

  • All code must be written specifically for this project
  • All logic must be written from scratch
  • No transcribing or heavily referencing existing implementations
  • All math must be personally derived

Control & Hardware Rules

  • ✔ On-controller PID is allowed
  • ❌ On-controller motion profiling (Motion Magic, MaxMotion) is not allowed
  • ❌ On-controller built-in feedforward is not allowed

Research & Documentation Rules

  • External specifications and general technical explanations may be consulted, but:
    • All derivations and implementations must be fully original
    • Any resources consulted must be documented
  • A detailed development document must be included, containing:
    • Mathematical derivations
    • Specifications
    • Notes and reasoning
    • List of consulted resources

AI & Vibes

  • AI is not a resource
  • Vibecoding is banned
    • Every function must be intentional
    • Every formula must be derived
    • Every behavior must be understood
  • UNLESS ITS vibe-documentation, otherwise this README would not exist right now

Project Goals

1️. Understand the CAN Bus

Learn how devices communicate, how arbitration works, and how timing/data frames behave without relying on vendor abstractions.

2️. Derive All Math Myself

Implement PID, feedforward principles, drivetrain kinematics, swerve geometry, and coordinate transforms from first principles.

3️. Build a Custom Robot Architecture

No command-based framework.
Just:

  • manual state handling
  • hand-written loops
  • struct-based subsystem modeling
  • explicit data flow and timing

4️. Develop a Low-Level Understanding of the FRC Tech Stack

From CAN messages → WPILib internals → custom control laws → full robot behavior.


About

Swerve from scratch simply for fun.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors