try {
var trajJson = Filesystem.getDeployDirectory().toPath().resolve("paths/GoStraight.wpilib.json");
m_currentTraj = TrajectoryUtil.fromPathweaverJson(trajJson);
} catch (Exception ex) {
DriverStation.reportError("Failed to init trajectory with exception: " + ex.getMessage(), ex.getStackTrace());
}
Results in a crash related to it failed to read the JSON
Error at frc.robot.StateMachine.updateAutonomous(StateMachine.java:46): Failed to init trajectory with exception: [json.exception.type_error.302] type must be number, but is null
at edu.wpi.first.math.WPIMathJNI.fromPathweaverJson(Native Method)
at edu.wpi.first.math.trajectory.TrajectoryUtil.fromPathweaverJson(TrajectoryUtil.java:78)
at frc.robot.StateMachine.updateAutonomous(StateMachine.java:46)
at frc.robot.Robot.autonomousPeriodic(Robot.java:74)
at edu.wpi.first.wpilibj.IterativeRobotBase.loopFunc(IterativeRobotBase.java:344)
at edu.wpi.first.wpilibj.TimedRobot.startCompetition(TimedRobot.java:130)
at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:343)
at edu.wpi.first.wpilibj.RobotBase.lambda$startRobot$0(RobotBase.java:413)
at java.base/java.lang.Thread.run(Thread.java:833)
Reading a valid trajectory with code
Results in a crash related to it failed to read the JSON
I have attached the JSON below.
GoStraight.zip