PathPlanner v2025.0.0 Beta 6
Pre-releaseThis release will be the last major beta release before the kickoff release of PathPlanner 2025. This release updates to WPILib beta 3, fixes various issues, updates support for Choreo beta 8, adds a version of SwerveSetpointGenerator to PPLib python, and updates trajectory state interpolation to greatly increase path following accuracy.
Trajectory State Interpolation Updates
Historically, trajectories for PathPlanner, Choreo, PathWeaver/WPILib, etc. have used interpolation to generate a setpoint for the robot to target while path following, based on the exact point in time it is currently at along a trajectory. This is done with linear interpolation for all fields in the trajectory states. However, the robot's position does not actually change linearly between states while the robot is accelerating or decelerating. This causes a disconnect between the generated state's target velocity and target position. The target position of the interpolated state will be incorrect, and impossible for the robot to reach if it is following the target velocity. This means that while path following, the X & Y PID controllers will be putting in quite a bit of effort to keep the robot at this incorrect target position, fighting against the correct target velocity.
This issue is normally not very noticeable, but it has always been present to some extent. At very low speeds/accelerations, or lower trajectory resolution (which Trajectory V2 uses), this issue is much more noticeable because there is more time in-between individual states. The following graph shows a nearly worst-case scenario for this issue.
Yellow: Target robot position
Blue: Actual robot position
Orange: Target robot velocity
Red: Output robot velocity (including PID controller feedback)
As you can see, the PID controllers are significantly altering the output speeds to try and keep the robot on track with an incorrect target position while accelerating and decelerating. To fix this issue, PPLib now interpolates trajectory state target positions by integrating the target velocity instead of just using linear interpolation. This generates a target position that perfectly matches what it should be based on the target velocity. This prevents the position PID controllers from fighting against the target velocity, greatly increasing path following accuracy across the board while the robot is accelerating or decelerating.
The following graph shows the same trajectory as above, but with the target position being integrated from velocity instead of linearly interpolated. This allows the target and actual robot positions to match up almost perfectly, with nearly 0 effort from the PID controllers.
Full Changelog
- Use deleteOldFiles = true by @jasondaming in #918
- Revert "Replace usage of deprecated ChassisSpeeds methods (#916)" by @mjansen4857 in #932
- [Swerve Setpoint Generator] Prevent force from being applied to chassisTorque if the magnitude of the force is 0 by @TheComputer314 in #927
- Integrate field speeds to interpolate state positions by @mjansen4857 in #935
- Add Swerve Setpoint Generator to PPLib Python by @PickleFace5 in #917
- Update SwerveSetpointGenerator to handle NaN Voltages by @mmilunicmobile in #930
- Update choreo trajectory version check by @mjansen4857 in #937
- Calculate heading for each state of choreo paths by @mjansen4857 in #939
New Contributors
- @jasondaming made their first contribution in #918
- @TheComputer314 made their first contribution in #927
- @mmilunicmobile made their first contribution in #930