Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TrajectoryUtil.fromPathweaverJson() fails to read Pathweaver JSON #5012

Closed
Daltz333 opened this issue Jan 26, 2023 · 1 comment
Closed

TrajectoryUtil.fromPathweaverJson() fails to read Pathweaver JSON #5012

Daltz333 opened this issue Jan 26, 2023 · 1 comment
Labels
type: bug Something isn't working.

Comments

@Daltz333
Copy link
Member

Reading a valid trajectory with code

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)

I have attached the JSON below.

GoStraight.zip

@Daltz333 Daltz333 added the type: bug Something isn't working. label Jan 26, 2023
@sciencewhiz
Copy link
Contributor

It's a bad path because of this issue: wpilibsuite/PathWeaver#274

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

2 participants