PathWeaver Error: unable to open trajectory & The startCompetition() method (or methods called by it) should have handled the exception above

Hey everyone. I’ve been studying PID, Encoders and PathWeaver tool this week, and it came out quite difficult. In this base Drivetrain code, I got some errors in regards to the path directory and one called “start competion method”, that I’m not quite sure what it is about.

My github repository is in this link: https://github.com/ehne-al/PathWeaver

I would very much appreciate any help!

Errors message:

unable to open trajectory: “test1.wpilib.json”

The startCompetition() method (or methods called by it) should have handled the exception above

java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0

The JSON file needs to be in the deploy folder if you want it to be deployed to the robot so the robot code can read the file. You may also need to prepend the result of edu.wpi.first.wpilibj.Filesystem.getDeployDirectory().

I’m not sure whether you need the project JSON file or the export JSON file because the documentation isn’t clear, and I didn’t write TrajectoryUtil.fromPathweaverJson().

You need to set your output directory to the deploy folder. To do this in the project settings page change the output directory then build the paths again. See docs for more details (from what I remember project settings and new project are pretty much identical screens)

Export JSON

Thanks! It worked. I just changed the directory.