Driver Station & Robot Code Setup

Team 4096, last edited 5/2025

Overview

This guide explains how to set up a new PC (or Driver Station PC) with the environment necessary to write, test, and run Python code on the robot.


Requirements

  • Driver Station PC: Must be a Windows PC (not Mac or Linux).
  • Code/Training Only: Linux is supported for code/training (Python, VS Code, etc.), but motor control libraries are not supported on MacOS.

1. Install Python

  • Download and install Python 3.12 (or the latest supported version) from the Python downloads page.
  • Use the 64-bit version.
  • During installation, select Add Python to PATH.
  • Note: RobotPy2023 does not support Python 3.12.0, but for 2024, use Python 3.12.

Windows Only


2. Install Python Extensions

Open a command prompt:

  1. Press Start, type cmd, and open Command Prompt.
  2. Upgrade pip:
     py -m pip install --upgrade pip
    
  3. Install required packages:
     py -m pip install --upgrade robotpy[all]
    

If you have questions, ask a mentor or reach out on the #code channel in Slack!


3. Install Git

  • Download and install Git
  • If you are uncomfortable with command line, download and install GitHub Desktop.
  • Create a GitHub account if needed.
  • Ask a code moderator (e.g., Miles or Adam) for access to the latest robot Python repository.

Clone the Repository

You can also perform this step after installing VS Code by typing Git: Clone into the Command Palette (Ctrl + Shift + P)


4. Install Visual Studio Code

  • Download and install VS Code.
  • Open VS Code and install the Python extension by Microsoft.
  • Go to File > Open Workspace... and open the .code-workspace file from your cloned repo.

Make sure you are in the directory containing robot.py.


5. Installing on the Robot


6. Deploying and Running Code

  • Read the Programmers Guide on the RobotPy website.
  • To deploy and run code, connect to the robot’s network and navigate to the folder with robot.py (usually Robot-20xx/robot).
  • Deploy code with:
    py -3 -m robotpy deploy
    
  • Simulate code with
    py -3 -m robotpy sim
    

7. Installing Driver Station

  • Follow the install directions on the WPILib website.
  • After installation, you can cancel when asked to activate the software.

8. Configuring the Radio

Follow the radio programming to configure the VH-109 radio so you can connect to the robot.

9. Phoenix Tuner X

Phoenix Tuner is Cross the Road Electronics (CTRE) software that updates, configures, analyzes, and can even control most of the electronics on our robot.

Follow the installation instructions here. It is recommended to install using the Windows app store if you are on a windows device.

The documentation has good tutorials on using the software. The main use phoenix for tuner is to set up CAN bus IDs which allow the code to communicate with the motors. We also use it to control individual motors on the robot for troubleshooting, monitor output speeds and current to set thresholds for logic, and quickly tune controllers.