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

fix jittery path planner with 2025 code #9

Closed
icros-personal opened this issue Feb 1, 2025 · 6 comments
Closed

fix jittery path planner with 2025 code #9

icros-personal opened this issue Feb 1, 2025 · 6 comments
Assignees

Comments

@icros-personal
Copy link
Contributor

icros-personal commented Feb 1, 2025

When we try to run PathPlanner 2025 with simple paths, we get very strange velocity requests, where the requested velocity seems to jump up and down repeatedly without any apparent reason.

Image

@peter9477 peter9477 added this to Coding Jan 30, 2025
@icros-personal icros-personal converted this from a draft issue Feb 1, 2025
@icros-personal
Copy link
Contributor Author

icros-personal commented Feb 1, 2025

After some investigation, this also happens on simulator, and appears to be generated by the PathPlanner trajectory code.
Here are more graphs from attempts to tune the LTV parameters, specifically the velocity control effort, on simulator. Note that the oscillations change in amplitude but do not go away at all.

Image Image Image Image Image Image Image

@icros-personal
Copy link
Contributor Author

After more debugging in simulator, I noticed that there is actually some drift in heading as well - despite the name, "straightlong" is not perfectly straight, because the control points are not quite accurate. Fixing this makes the heading drift go away, but the velocity oscillations persist. This appears to have been introduced in the GUI tool and then committed in 14e88df. The change is probably not enough to be too concerned, but we should be careful when using the PathPlanner GUI to avoid unwanted changes.

@icros-personal
Copy link
Contributor Author

Debugging into the PathPlannerTrajectory class, this is the line where the problem seems to start. Before this point, the states show a clear increase in velocity up to the maximum. After that, the velocities oscillate. This may be a PathPlanner 2025 bug?

@icros-personal
Copy link
Contributor Author

More evidence of a PathPlanner bug. The 2024 code (here) uses the max acceleration as the value for vf^2 = v0^2 + 2ad. In the new code, the acceleration is calculated in a more fancy way, based on the robot config that is provided. However, it uses the forceVec from here which causes the acceleration term to be negative. This acceleration term must not be negative for this calculation to work, because it's using the robot's config to make sure our changes in velocity are within the spec. Since it's negative, this calculation is just wrong, and we get strange velocities as a result.
Do we open a bug with the PathPlanner library? Or just fix it ourselves?

@peter9477
Copy link
Contributor

I'd open a bug, unless it is clear that nobody could possibly be using this with the apparent bug, in which case it's more likely our understanding that's wrong and maybe a chiefdelphi thread makes more sense.

@icros-personal
Copy link
Contributor Author

I opened mjansen4857/pathplanner#1049. I did also attempt to fix it by overriding the code locally (lots of copy/paste, in retrospect I should probably just have forked the library) and that definitely made things better in terms of jitter. The problem I noticed was that the path did seem to consistently overshoot the stopping point. I'm not sure if this could be fixed with better tuning, or if it's a problem that's introduced by the change.

@noke5 noke5 moved this from In progress to Done in Coding Feb 8, 2025
@noke5 noke5 closed this as completed by moving to Done in Coding Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

5 participants