Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Common Bugs And FAQs

WebCoder49 edited this page Feb 25, 2024 · 11 revisions

🤔 Common Bugs and FAQs

Please contribute any general problems you encounter here and/or any solutions to the questions below by clicking "Edit" in the top-right corner, then let us know on MS Teams. Any longer tutorials/explanations should go in their own pages.


Installing a vendor library

If you need to import a class from a library that is not already in the frc library that we work with, follow these steps

Solution (click)

The reason was that you need a vendor library to use certain imports. Here's how to fix it:

  1. Download the vendor library. This can be found online. For example, the link for the CTRE Phoenix vendor library is https://store.ctr-electronics.com/software/

  2. Go to WPILib

  3. Right click build.gradle (just under .gitignore)

  4. Select "manage vendor libraries"

  5. Select "Install new libraries (offline)". It is advised that you choose the offline option as it allows you to code without access to the wifi.

  6. Select the box for the library that you want to install

  7. Let WPILib make a build. This build might fail, but it doesn't really matter (I don't think). Then check that you can import the necessary classes.

Uninstalling a vendor library

If for whatever reason you realise you don't need a vendor library, here is how to uninstall it

Solution (click)

Here's how to fix it:

  1. Go to WPILib
  2. Right click build.gradle (just under .gitignore
  3. Select "manage vendor libraries"
  4. Select "manage current libraries"
  5. Select the boxes for the library that you want to uninstall

Build fails as could not find main Gradle class

When trying to build robot code in WPILib VS Code, the output gives this error:

Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
Solution (click)

The reason was that a folder named in non-English letters contained the code folder. Here's how to fix it:

  1. Press Ctrl+Shift+' in WPILib VS Code. A terminal should open. image

  2. The file path will contain non-English characters, and that is the cause of the bug. Navigate in File Explorer to the parent folder of the path, selecting the folder the path refers to. This is your cloned version of the GitHub repository (the code). image

  3. Close GitHub Desktop if it is open and close WPILib VS Code. Now, either rename the non-English folder (汉字 here) or move (don't copy) the code folder (2023-offseason) to another folder so the path shown at the top of File Explorer consists of only letters, numbers, spaces, -s, _s, etc. image

  4. Open GitHub Desktop and switch to the Robotics repository (2023-offseason here). Click "Locate" on the error message that shows up and select the new location of the code folder.

  5. Open WPILib VS Code, press Ctrl+K then Ctrl+O to open a folder, then select the new location of the code folder again. image

Installing the CTRE motor controller

When trying to write code that uses the WPI_TalonFX class, an error is raised saying "WPI_TalonFX cannot be resolved to type"

Solution (click)

The reason was you have not installed the CTRE Phoenix library. Here's how to fix it:

  1. Go to https://store.ctr-electronics.com/software/
  2. Download the Phoenix FrameWork Installer
  3. When your system tells you that it has an "unknown publisher", select "More info" and choose to trust it anyway. (Not sure about Mac, but probably some similiar process)
  4. Follow the instructions on the installer. When in doubt about whether you need to download one of the options prompted, just download it. There is always an option to uninstall it later.
  5. Follow the instructions in "Installing a vendor library" to install the vendor library into WPILib VSCode.

DB/String 0, etc. appears in Shuffleboard/SmartDashboard

Shuffleboard has entries DB/String..., DB/Button..., DB/Slider... that aren't set in my code.

Solution (click)

The reason was that the Driver Station creates these entries behind the scenes, as explained here, in their "FRC PC Dashboard" which we aren't using (we are using Shuffleboard instead). You can:

  • Remove the entries from Shuffleboard by selecting them (drag to form a rectangle around them), right-clicking them and clicking "Remove".