This guide will teach you how to install WPILIB VS code and create your first WPILib Project.
WPiLib is code library developed by Worcester Polytechnic Institute (WPI) built for the FIRST Robotics Competition (FRC). This library contains helpful classes starting from direct interaction with motors, pneumatics, LEDs all the way to advanced path planning. Officially supported languages are Java and C/C++. (Read More)
WPILib is the basis of FRC Programming. All other programs and libraries will built around WPILib. Teams start off with WPILib and build upon this central library when they become more advanced.
WPILib usually has yearly releases parallel to yearly FRC game releases where the library of code is updated to fit new hardware and new features are added.
Please follow this guide to install WPILib.
- Hit
ctrl + p
(cmd + shift + p
on mac) to open up the command palette - Type
Create a new project
and hit enter
right click on image and click open image in new tab to view a bigger version of what to fill in
- Fill out the Project Creator so it looks something like above.
- Chose which ever folder you want your project to be made in
- The project name should indicate what year it is, the project should also be in pascal case. (e.g.
YEAR-SomeName
) - Type 3647 for the team number. You will not be able to deploy code to the robot if your have the wrong team number.
- Click
Generate Project
. After this, a terminal should pop up at the bottom of your screen.
Note
YEAR should be the current year (e.g. 2024-SomeName
).
In about 35 seconds, your terminal sound read BUILD SUCCESSFUL
Current Default File Structure
java
└── frc
└── robot
├── commands
│ └── ExampleCommand.java
├── Constants.java
├── Main.java
├── RobotContainer.java
├── Robot.java
└── subsystems
└── ExampleSubsystem.java
Note: all folder names should be lower cased
- Go into the java folder of your project through vscode or through file explorer
- Inside of the
java
folder, create a folder calledteam 3647
- Inside of the
team3647
folder you just made, create a folder calledfrcYEAR
(or whatever year it is) andlib
- Inside of
frcYEAR
, add- autonomous
- commands
- inputs
- robot
- subsystems
- Move
Main.java
,Robot.java
, andRobotContainer.java
into team3647/frcYEAR/robot - Delete the frc folder
- remove all import statements from
RobotContainer.java
- return null in getAutonomousCommand() in
RobotContainer.java
Make appropriate edits to the package statements at the top of these files
Final Adjusted File Structure
java
└── team3647
├── frcYEAR
│ ├── autonomous
│ ├── commands
│ │ └── ExampleCommand.java
│ ├── constants
│ │ └── Constants.java
│ ├── robot
│ │ ├── Main.java
│ │ ├── RobotContainer.java
│ │ └── Robot.java
│ └── subsystems
│ └── ExampleSubsystem.java
└── lib
modify this line on build.gradle from:
def ROBOT_MAIN_CLASS = 'frc.robot.Main'
to
def ROBOT_MAIN_CLASS = 'team3647.frcYEAR.robot.Main'
This is because the path to your Main.java
file has changed after you adjust your file structure according to the instructions above.
- Hit
ctrl + p
(cmd + shift + p
on mac) to open up the command palette - Type
build
and press enter forWPILib: Build Robot Code
- If all has been done correctly, the terminal should say
BUILD SUCCESSFUL
in about 30 seconds