-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
Add pure pursuit library #23387
Add pure pursuit library #23387
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
Added some minor stylistic comments
@Jaeyoung-Lim Thanks for the review! |
After discussing the implementation with @bresch I made some major changes to how the intersection point is calculated. It is now done using vectors which eliminates many of the edgecases I had to consider.
the algorithm now returns NAN if any of the inputs are invalid rather than using the bearing to the current waypoint as a fallback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much nicer :)
ec4923f
to
9cdb00b
Compare
rebased on main and squashed |
Solved Problem
The pure pursuit algorithm is used by the new ackermann rover module and soon also by the updated differential rover and the upcoming boat module.
Creating a library for the algorithm avoids having to copy the same code into all the modules.
Solution
The algorithm calculates the intersection point between a circle around the vehicle and the line segment connecting the previous and current waypoint and returns the heading towards that point. The radius of the circle around the vehicle is used to tune the controller and is often referred to as look-ahead distance ($l_d$ ).
Test coverage