Hello. This is our first year trying path planner for our swerve robot. We are using the 2025 beta. All of our systems (wpilib, roborio, etc) have been updated for the 2025 beta’s. Our problem is that when we start up autonomous, we are getting this error that we can’t figure out.
Error at com.pathplanner.lib.commands.FollowPathCommand.initialize(FollowPathCommand.java:108): Unhandled exception: java.lang.NullPointerException: Cannot read field "vxMetersPerSecond" because "currentSpeeds" is null at com.pathplanner.lib.commands.FollowPathCommand.initialize(FollowPathCommand.java:108) at edu.wpi.first.wpilibj2.command.SequentialCommandGroup.initialize(SequentialCommandGroup.java:66) at edu.wpi.first.wpilibj2.command.SequentialCommandGroup.execute(SequentialCommandGroup.java:83) at com.pathplanner.lib.commands.PathPlannerAuto.execute(PathPlannerAuto.java:568) at edu.wpi.first.wpilibj2.command.CommandScheduler.run(CommandScheduler.java:288) at frc.robot.Robot.robotPeriodic(Robot.java:46) at edu.wpi.first.wpilibj.IterativeRobotBase.loopFunc(IterativeRobotBase.java:400) at edu.wpi.first.wpilibj.TimedRobot.startCompetition(TimedRobot.java:131) at edu.wpi.first.wpilibj.RobotBase.runRobot(RobotBase.java:350) at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:438) at frc.robot.Main.main(Main.java:23)
Our code is: GitHub - SGFRobots/Swerve2025
We can’t find anything about this anywhere on the internet, so we were wondering if anyone had any solution.
Thanks
This appears to be because getRobotRelativeSpeeds
is returning a null value, as chassisSpeeds
is only initialized when you call drive
.
getRobotRelativeSpeeds
ought to be implemented to report the current speeds, not the commanded speeds. You should be calling kDriveKinematics.toChassisSpeeds
with an array of module states (from modules[i].getState
).
Thank you! This was our problem. The error isn’t there anymore. However, we have a new issue. We cannot change the speed of our robot. It doesn’t follow the speed limits/parameters set in the pathplanner application. It does follow the max acceleration but not the max speed so we are confused.
Could you be a little more specific in what you think you’re setting and why you think it isn’t being honoured? Looking in your path files, I see a global maximum velocity of 5m/s (about 16 fps). Is your robot going faster than that?
This is our current settings inside of the path planner application. The maximum speed is set to 0.1 m/s, alongside the max acceleration. This speed is also reflected in our current test path, where it is showing as going very slow. However, when we run this on the robot, it goes much faster than pathplanner indicates. We are just confused on if we need to change the speed somewhere else rather than in the GUI.