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

PathPlannerTrajectory generates jittery speeds for simple paths #1049

Closed
icros-personal opened this issue Feb 2, 2025 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@icros-personal
Copy link
Contributor

Describe the bug
I have a path configured with two waypoints, 6m apart, so the robot only needs to drive forwards. Start and end states are both stopped, and no turning is required. I expect the trajectory that is generated to have a speed that increases, reaches some maximum, and then slows down to 0. Instead, the trajectory states have speed values that oscillate up and down, so that states 3, 5, 7 are all significantly higher than states 2, 4, 6, ...
This happens both in simulator and on the field.

To Reproduce
Steps to reproduce the behavior:

  1. Create a straight path with two waypoints.
  2. Load the path and try to follow it.
  3. Can look at the states that are generated in the PathPlannerTrajectory, or observe the robot behaviour.

Expected behavior
The speed should increase and decrease fairly smoothly, probably monotonically.

Screenshots
This is the plot of requested velocity (blue) and measured velocity (orange). There's definitely more tuning that could be done here, but I think the trajectory is not right, so tuning doesn't seem to help.
Image

Versions: (please complete the following information):

  • OS: N/A
  • GUI Version: N/A
  • PPLib Version: 2025.2.2
  • PPLib Language: Java

Additional context
I was wondering if this could be the problem. On the reverse accel pass, the force direction has been reversed (here) so when I debug through in simulator, the moduleAcceleration is always negative. This seems different from the 2024 code where the multiplier was the maximum acceleration value.
Modifying the library, if I take the absolute value so that moduleAcceleration is always positive, I get much more similar results to what I want, where the speed is smooth, but it seems to always overshoot the end. I don't know if this is a tuning problem or something else.

@icros-personal
Copy link
Contributor Author

I discovered that this is true only for differential drives. Swerve drives appear to have positive acceleration, and they do not show the same oscillation.

@icros-personal
Copy link
Contributor Author

I attempted to fix this with #1052, but I need some help with the unit test configuration. I don't know much about Gradle, and I've only configured it to pull in Windows-x64 libraries for the unit tests here.

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

No branches or pull requests

2 participants