Offseason · Week 2 of 8
WPILib Setup
Dev environment, project structure, RobotContainer, and Constants.
Install WPILib
Download and install WPILib from the official releases page. The installer includes VS Code, a JDK, all FRC libraries, and tools like SmartDashboard and AdvantageScope. Use the WPILib VS Code — not a personal install.
Use WPILib's VS Code, not your own. It comes pre-configured with the Java extension, WPILib extension, and the correct JDK. Installing into a personal VS Code causes path conflicts and missing classpath errors that waste a lot of time.
Project Structure
| File / Folder | Purpose |
|---|---|
| Robot.java | Entry point. Calls robotInit, teleopPeriodic, etc. |
| RobotContainer.java | Creates subsystems and binds commands to triggers |
| Constants.java | All motor IDs, gear ratios, PID values — no magic numbers |
| subsystems/ | One file per subsystem — extends SubsystemBase |
| commands/ | One file per action — extends Command |
java — Constants.java pattern
public final class Constants { public static final class DriveConstants { public static final int LEFT_LEADER_ID = 1; public static final int RIGHT_LEADER_ID = 2; public static final double GEAR_RATIO = 8.46; } public static final class ShooterConstants { public static final int MOTOR_ID = 5; public static final double TARGET_RPM = 4000.0; } }
Simulating Without Hardware
WPILib includes a robot simulator. You can run code, view sensor values, and test logic without touching the physical robot. Use it constantly — it's much faster than waiting for robot access.
terminal — run simulation
# In VS Code with WPILib extension: # Ctrl+Shift+P → WPILib: Simulate Robot Code # Or from terminal: ./gradlew simulateJavaRelease