Course Rules¶
These rules apply to everyone working on the project, including the AI assistant (Claude Code) that helps us.
- Hands-on, in the simulator. Labs 0–10 run in the WPILib simulator against our simulated swerve robot (
robot/src/main/java/frc/robot/sim/). Start from the smallest code that does something visible, then add one piece at a time. Lab 11 moves the same code to the real robot. - Explain just in time. Each lab starts with a short plain-language "Why" (a worked example or ASCII diagram when useful), right before the code that needs it.
- Knobs, toggles, and faults. Every lab exposes its important numbers as live dashboard tunables and its features as on/off toggles. The simulator adds fault switches (backwards motors, encoders, gyro) and imperfections (friction, lag, worn wheels). Change one, predict, observe.
- Let us write the core math. For the optimizer, kinematics, field-relative, and odometry, walk through the math and attempt the implementation first. Reviewers point out bugs and ask guiding questions instead of immediately rewriting. Hardware plumbing (the simulator, motor setup, logging) can be given.
- Hand-roll first, then compare to WPILib. For each core concept, implement our own version, then write a unit test comparing it to the WPILib class (
SwerveDriveKinematics,SwerveModuleState.optimize,SwerveDriveOdometry, etc.). - Do not use YAGSL, the CTRE Tuner X swerve generator, or copied template swerve code (until Lab 12). Using the WPILib math/geometry classes is fine.
- Comment for learning. Comments explain why, including units (meters, radians, m/s, rad/s) and coordinate frames.
- Units everywhere. Use SI units internally. Name variables with units when ambiguous (
angleRadians,velocityMetersPerSecond). - Check current docs. WPILib and REVLib APIs change every season. Verify against current documentation before using an API. If something is deprecated, say so.
- Our code only talks to hardware through
ModuleIOandGyroIO, never to the simulator directly. That's what lets the same code run on the real robot. - Safety on the real robot (Lab 11 on). Before any code moves the real robot: robot on blocks, someone on the E-stop, low speed limits. See the safety checklist.
- End each lab with a checkpoint: a short summary, 3–5 quiz questions, and what could go wrong in the real world. Commit once it works.
Safety first (real robot)
A swerve robot can move in any direction instantly. On the real robot, never enable without it on blocks (until the lab says otherwise), a person ready on the E-stop, and low speed limits.