Robot Project Deploy Directory

The deploy directory is a part of an FRC project, used to store files that are transferred to the roboRIO during the deployment process. This directory allows teams to include additional resources, such as configuration files, scripts, or other assets, that their robot code may need at runtime.

Location of the Deploy Directory

In a standard GradleRIO project, the deploy directory is located under the src/main folder. Any files placed in this directory will automatically be copied to the roboRIO when the code is deployed.

How the Deploy Directory Works

When you run the deploy task, GradleRIO packages the contents of the deploy directory and transfers them to the roboRIO. By default, these files are placed in the /home/lvuser/deploy directory on the roboRIO. This ensures that your robot code can access these files during runtime.

Example Use Cases

Here are some common examples of how teams use the deploy directory:

  1. Configuration Files Teams may include configuration files (e.g., JSON, YAML, or XML) that define robot-specific settings, such as PID constants, swerve configuration, or autonomous routines. The Preferences class provides another method to store configuration on the roboRIO.

  2. Path Planning Files For teams using path planning libraries, trajectory files such as those from Choreo and PathPlanner can be stored in the deploy directory and loaded by the robot code.

Accessing Deploy Files in Code

To access files from the deploy directory in your robot code, use the Filesystem class (Java, C++). The getDeployDirectory method returns the path to the deploy directory. This ensures that your code can locate the files regardless of whether the code is running on the roboRIO or in simulation on your computer.

Deleting Unused Deploy Files

By default the deploy directory in your project is transferred to the roboRIO when code is deployed. It is initiated by this section of the build.gradle file.

32                // Static files artifact
33                frcStaticFileDeploy(getArtifactTypeClass('FileTreeArtifact')) {
34                    files = project.fileTree('src/main/deploy')
35                    directory = '/home/lvuser/deploy'
36                    deleteOldFiles = false // Change to true to delete files on roboRIO that no
37                                           // longer exist in deploy directory of this project
38                }

This will overwrite any duplicate files found in the /home/lvuser/deploy directory on the RIO and copy over any additional not present there. If deleteOldFiles is false it will not remove any files no longer present in the project deploy directory. Changing it to true helps prevent programs like Choreo and PathPlanner from getting confused by files that were deleted locally but still exist on the roboRIO.

If you want to manage the roboRIO files directly, the FTP documentation provides one method to do so.