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

Null Pointer Exception When Replaying Log via AdvantageKit #954

Closed
gcschmit opened this issue Dec 28, 2024 · 0 comments · Fixed by #955
Closed

Null Pointer Exception When Replaying Log via AdvantageKit #954

gcschmit opened this issue Dec 28, 2024 · 0 comments · Fixed by #955
Labels
bug Something isn't working PathPlannerLib Changes to PathPlannerLib

Comments

@gcschmit
Copy link

Describe the bug
When replaying a log file via AdvantageKit, a null pointer exception is generated in PathPlannerPath.precalcValues.

To Reproduce
Steps to reproduce the behavior:

  1. Run a PathPlanner auto in simulation in a project using AdvantageKit and LocalADStarAK.java.
  2. Load the resulting log file in AdvantageScope to prepare for replay.
  3. Run the same project in replay mode using the log file loaded in AdvantageScope.

Expected behavior
No crash.

Versions: (please complete the following information):

  • OS: macOS 15.2
  • PPLib Version: 2025.0.0-beta-6.1
  • PPLib Language: Java

Additional context

This line of code is in the Robot constructor after starting AdvantageKit logger and before anything else:
Pathfinding.setPathfinder(new LocalADStarAK());
The latest version of LocalADStarAK.java (from the gist) is used.

The ADStarIO class logs the x and y positions of each point but doesn't log the constraints. Therefore, during replay, the constraints instance variable is null which results in the following exception:

Error at com.pathplanner.lib.path.PathPlannerPath.precalcValues(PathPlannerPath.java:980): Unhandled exception: java.lang.NullPointerException: Cannot invoke "com.pathplanner.lib.path.PathConstraints.maxVelocityMPS()" because "point.constraints" is null
at com.pathplanner.lib.path.PathPlannerPath.precalcValues(PathPlannerPath.java:980)
at com.pathplanner.lib.path.PathPlannerPath.fromPathPoints(PathPlannerPath.java:188)
at frc.robot.LocalADStarAK.getCurrentPath(LocalADStarAK.java:56)
at com.pathplanner.lib.pathfinding.Pathfinding.getCurrentPath(Pathfinding.java:53)
at com.pathplanner.lib.commands.PathfindingCommand.execute(PathfindingCommand.java:295)
at edu.wpi.first.wpilibj2.command.SequentialCommandGroup.execute(SequentialCommandGroup.java:78)
at edu.wpi.first.wpilibj2.command.WrapperCommand.execute(WrapperCommand.java:44)
at edu.wpi.first.wpilibj2.command.CommandScheduler.run(CommandScheduler.java:288)
at frc.robot.Robot.robotPeriodic(Robot.java:176)
at edu.wpi.first.wpilibj.IterativeRobotBase.loopFunc(IterativeRobotBase.java:400)
at org.littletonrobotics.junction.LoggedRobot.startCompetition(LoggedRobot.java:116)
at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:419)
at edu.wpi.first.wpilibj.RobotBase.lambda$startRobot$1(RobotBase.java:490)
at java.base/java.lang.Thread.run(Thread.java:840)

@gcschmit gcschmit added the bug Something isn't working label Dec 28, 2024
@mjansen4857 mjansen4857 added the PathPlannerLib Changes to PathPlannerLib label Dec 30, 2024
@mjansen4857 mjansen4857 added this to the Kickoff Release milestone Dec 30, 2024
@mjansen4857 mjansen4857 linked a pull request Dec 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PathPlannerLib Changes to PathPlannerLib
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants