LST Robotics Logo

Learning • Sensors • Tech

LST Robotics

Lessons
← Back to C++ Coding Track

C++ Coding Track · Lesson 3

VS Code Project Setup

With WPILib VS Code installed, you're ready to create your first robot project. This lesson walks through starting a new Command-based C++ project, generating it, switching the deploy target to the VMX-pi, and installing the navX and Titan vendor libraries. Follow each step in order and watch the terminal for the Build Successful message that confirms things worked.

When you open WPILib VS Code for the first time, it should look similar to Figure 1.1.

VS Code home screen
Figure 1.1 — VS Code home screen

Creating a New Project

To start a project, click the WPILib icon in the top-right corner (Figure 1.2).

WPILib icon location in VS Code
Figure 1.2 — WPILib icon location

A pop-up window will appear. Type Create a new project and press Enter. If done correctly, you should see a screen similar to Figure 1.3.

Create-new-project screen
Figure 1.3 — Create-new-project screen

Select a project type from the two options — Template or Example — then choose a language, either C++ or Java. In our case we select C++. After that, choose a project base from the five options below.

Choosing a Project Base

1. Timed Robot Most common

The standard and easiest project base. Runs code in a loop every 20 ms automatically. You override methods like robotInit(), teleopPeriodic(), and autonomousPeriodic().

Best for — Beginners · simple robots · full control without complexity

2. Timed Skeleton Advanced

Basically TimedRobot, but stripped down: minimal structure, no example code, you build everything yourself.

Best for — People who already understand WPILib · custom architectures

3. RobotBase Skeleton Advanced

Gives you very low-level control. Doesn't use TimedRobot at all — you manually control the robot loop and decide timing and execution.

Best for — Advanced users · custom frameworks · performance optimisation

4. Command Robot Recommended

The modern structured system used in competitions. Uses Subsystems (drive, arm, intake) and Commands (actions like drive, shoot), built on top of TimedRobot.

Best for — Medium to complex robots · clean, organised code · team projects

5. Old Command Robot Deprecated

The deprecated version of Command-based programming: outdated, not maintained, and structured differently from modern WPILib.

Why avoid — Outdated · not maintained · different structure from modern WPILib
We use Command Robot going forward. After selecting it, choose where to save the project folder, enter the project name, then enter your team number.

Note that the team number changes during competition, because the official competition team number will be provided there. For training, we use team number 1234. If everything is entered correctly, your screen should look similar to Figure 1.4.

Completed project-creation form
Figure 1.4 — Completed project-creation form

Generating and Deploying

While connected to the internet, click the Generate Project button and give it a minute to load fully. Once loading is complete, the terminal should display Build Successful, as shown in Figure 1.5.

Build Successful terminal message
Figure 1.5 — "Build Successful" terminal message

At the top left, click the VMX button (Figure 1.6) and change the deploy target to VMX-Pi (from RoboRIO). Make sure you are connected to the internet during this process.

VMX deploy-target button
Figure 1.6 — VMX deploy-target button
Check the build.gradle version. It should be 20.3.2.30. If it shows any other version, change it to 20.3.2.30, then change the deploy target again (stay connected to the internet). Once the terminal shows BUILD SUCCESSFUL, you know everything was done correctly (Figure 1.7).
Successful VMX-pi build
Figure 1.7 — Successful VMX-pi build

Installing Vendor Libraries

Click the WPILib button again and select Manage Vendor Libraries, then Install new libraries (online) and paste the links below. Make sure you are connected to Wi-Fi. After installing the first library the terminal will show Build Successful; repeat the same process for the second.

Installing the C++ Toolchain

Because we're working with C++, we need to install the Raspbian toolchain. Click the WPILib button again, search for Run a command in Gradle, press Enter, and type the command below.

installRaspbianToolchain
You're done. If everything has been done correctly, you will no longer need an internet connection from this point forward.
← Setting Up the Control Station Simple Auto: Timed Movement →