When VS code is closed and reopened the PhotonLib import in our files appears to fail. The band-aid solution that I have found is to uninstall the PhotonVision library and reinstall it. I am unsure of what could be causing this issue but I think it has something to do with the way that PhotonVision is stored on my laptop.
Error reads as follows:
C:\Users\kphan\OneDrive\Documents\GitHub\ChargedUp2023\src\main\java\frc\robot\commands\AimTarget.java:7: error: package org.photonlib does not exist
import org.photonlib.PhotonUtils;
^
C:\Users\kphan\OneDrive\Documents\GitHub\ChargedUp2023\src\main\java\frc\robot\commands\AimTarget.java:38: error: cannot find symbol
range = PhotonUtils.calculateDistanceToTargetMeters(CameraConstants.cameraHeightMeters, CameraConstants.goalDistanceMeters, CameraConstants.cameraAngleRadians, Units.degreesToRadians(result.getBestTarget().getPitch()));
^
symbol: variable PhotonUtils
location: class AimTarget
2 errors
Both of these errors are in Constants
After a bit of messing around with trying to get it out of OneDrive I got it out and rebuilt it, the new error that appears is as follows:
C:\GitHub\ChargedUp2023\src\main\java\frc\robot\commands\AimTarget.java:7: error: package org.photonlib does not exist
import org.photonlib.PhotonUtils;
^
C:\GitHub\ChargedUp2023\src\main\java\frc\robot\commands\AimTarget.java:38: error: cannot find symbol
range = PhotonUtils.calculateDistanceToTargetMeters(CameraConstants.cameraHeightMeters, CameraConstants.goalDistanceMeters, CameraConstants.cameraAngleRadians, Units.degreesToRadians(result.getBestTarget().getPitch()));
^
symbol: variable PhotonUtils
location: class AimTarget
2 errors
it doesn’t appear to be an issue with one drive, I also tried to uninstall and reinstall the library to still have the same error.
Edit: I should add that I am on Windows 11 at this moment however I do not believe this should matter, like at all.