|
| 1 | +# Robot Project Deploy Directory |
| 2 | + |
| 3 | +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. |
| 4 | + |
| 5 | +## Location of the Deploy Directory |
| 6 | + |
| 7 | +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. |
| 8 | + |
| 9 | +## How the Deploy Directory Works |
| 10 | + |
| 11 | +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. |
| 12 | + |
| 13 | +### Example Use Cases |
| 14 | + |
| 15 | +Here are some common examples of how teams use the ``deploy`` directory: |
| 16 | + |
| 17 | +1. **Configuration Files** |
| 18 | + 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 :doc:`Preferences class <robot-preferences>` provides another method to store configuration on the roboRIO. |
| 19 | + |
| 20 | +2. **Path Planning Files** |
| 21 | + For teams using path planning libraries, trajectory files such as those from :doc:`Choreo </docs/software/pathplanning/choreo/index>` and [PathPlanner](https://github.com/mjansen4857/pathplanner) can be stored in the deploy directory and loaded by the robot code. |
| 22 | + |
| 23 | +### Accessing Deploy Files in Code |
| 24 | + |
| 25 | +To access files from the deploy directory in your robot code, use the ``Filesystem`` class ([Java](https://github.wpilib.org/allwpilib/docs/release/java/edu/wpi/first/wpilibj/Filesystem.html), [C++](https://github.wpilib.org/allwpilib/docs/release/cpp/_filesystem_8h.html)). 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. |
| 26 | + |
| 27 | +## Deleting Unused Deploy Files |
| 28 | + |
| 29 | +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. |
| 30 | + |
| 31 | +.. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/vscode-wpilib/refs/tags/v2025.3.2/vscode-wpilib/resources/gradle/java/build.gradle |
| 32 | + :language: groovy |
| 33 | + :lines: 32-38 |
| 34 | + :lineno-match: |
| 35 | + |
| 36 | +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 :doc:`Choreo </docs/software/pathplanning/choreo/index>` and [PathPlanner](https://github.com/mjansen4857/pathplanner) from getting confused by files that were deleted locally but still exist on the roboRIO. |
| 37 | + |
| 38 | +If you want to manage the roboRIO files directly, the :doc:`FTP documentation </docs/software/roborio-info/roborio-ftp>` provides one method to do so. |
0 commit comments