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

Formula for checked_max_v appears incorrect #43

Open
jwhite66 opened this issue Mar 20, 2018 · 2 comments
Open

Formula for checked_max_v appears incorrect #43

jwhite66 opened this issue Mar 20, 2018 · 2 comments

Comments

@jwhite66
Copy link

We've been making use of Pathfinder (thanks!), and believe we have found an error in a computation.

The symptoms it causes if that if you ask for a long move with a max velocity of, say, 140, sometimes the resulting trajectory will have a computed max velocity lower than you would expect (e.g. 131).

As an example, these waypoints:
Waypoint points[] = {{0,0,0},{160, 0, 0}};

with a maxv of 140, maxa of 600, and maxj of 600 result in a trajectory that has a top velocity of 131.

The code in question is here:
https://github.com/JacisNonsense/Pathfinder/blob/master/Pathfinder-Core/src/trajectory.c#L28
That appears to be using this formula:
https://physics.stackexchange.com/questions/34077/maximum-velocity-allowed-for-motion-profile-with-constant-jerk

That code also exactly mirrors the original 254 code, so this computation appears to have originated with the poofs.

However, if you solve the quadratic equation and do the math, it appears as though there should be a '* 8' term, not a '* 4' term. And switching in an 8 for the 4 does seem to improve matters; you get a trajectory with the 140, not the 131.

@JaciBrunning
Copy link
Owner

It would seem you're correct here. I'm currently working on the next rendition of the Pathfinder project that fixes this issue, but it isn't available out to the public yet.

Given that Pathfinder is already out there for this season, I won't bother putting this change in just yet, but it's certainly on my checklist for the next release.

Thanks,
~Jaci

@Leo428
Copy link

Leo428 commented May 20, 2018

Thank you very much for improving this project Jaci! I have been using and loving this library and I am working on using this in the Vex competition this summer. Thank you again for the amazing work you have done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants