Roborio unable to load .wpilib.json paths file

Hi everyone, I tried to follow this tutorial
FRC Java Tutorial - WPILib 2022 Command Based Programming Ep 3:Autonomous Trajectory & Path Planning - YouTube (checkout time : 1h12 min)
trying to learn about trajectories and cannot have the Roborio loading the generated JSON files. I used the PathPlanner to generate my paths and placed them in the deploy folder.

I am pretty sure that the problem resides in how I copy the path
I tried to copy the relative path

//When simply copying the path  - the windows format is wrong and gives an error 
 m_choixTrajectoireAuto.addOption("Aller au element de jeu", lierTrajetsACommandeRamsete(" C:\Users\src\main\deploy\deploy\pathplanner\generatedJSON\SnakePath.wpilib.json", true));

// Tried to swap the "\" for "/" still does not work 
// Tried to copy the relative path instead  still does not work - Ex: src/main/deploy/deploy/pathplanner/generatedJSON/SnakePath.wpilib.json 
// tried to shorten path still doesn't work ex: pathplanner/generatedJSON/SnakePath.wpilib.json 

// Here is the code for the commad tying the file to the Ramsete command
public Command lierTrajetsACommandeRamsete(String fileName, boolean resetOdometry) {

      Trajectory trajectory;
        Path trajectoryPath = Filesystem.getDeployDirectory().toPath().resolve(fileName);
        trajectory = TrajectoryUtil.fromPathweaverJson(trajectoryPath);
      }catch(IOException exception){
        DriverStation.reportError("Incappable d'ouvrir la trajectoire" + fileName, exception.getStackTrace());
        System.out.println("Impossible de lire le fichier" + fileName);
        return new InstantCommand();

I basically tried with no success - here is the stacktrace message

  • Error at frc.robot.RobotContainer.lierTrajetsACommandeRamsete( Incappable d’ouvrir la trajectoire/SnakePath.wpilib.json
  • at edu.wpi.first.math.WPIMathJNI.fromPathweaverJson(Native Method)
  • at edu.wpi.first.math.trajectory.TrajectoryUtil.fromPathweaverJson(
  • at frc.robot.RobotContainer.lierTrajetsACommandeRamsete(
  • at frc.robot.RobotContainer.(
  • at frc.robot.Robot.robotInit(
  • at edu.wpi.first.wpilibj.TimedRobot.startCompetition(
  • at edu.wpi.first.wpilibj.RobotBase.runRobot(
  • at edu.wpi.first.wpilibj.RobotBase.startRobot(
  • at frc.robot.Main.main(
  • Impossible de lire le fichier/SnakePath.wpilib.json

Any help would be so appreciated!

You’re giving it an absolute Windows path (C:\.....), when it needs to be a linux path. Vscode deploys the “deploy” directory (and all of its contents) to the roborio, which runs linux. This is covered in the wpilib docs as well


Thanks a lot, Fletch1373! I was able to get rid of the error by creating a folder named “paths” and copying the generated JSON paths in it.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.