[UNTESTED, DO NOT MERGE YET] Path Follower #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a port of taolib's path follower to JAR. The implementation has been roughly ported from this function.
This isn't pure pursuit per se, but rather a somewhat simplified version of it that uses PID targeting for waypoint intersections. The algorithm has been fairly effective at following curves nonetheless. Arc curvature of the path and whatnot is not considered, and the path is followed at constant velocity (determined by
lookahead_distance). The higher the lookahead, the faster but less accurate it will follow the path.Example (make a robot follow
y=6sin(x/6)):This path was generated using the following python script:
Some notes:
Pointstruct that stores x and y values. This means thatOdomno longer deals with separatefloatvalues for x and y. I could go a lot further with this and overloaddrive_to_pointand other functions inDriveto support passing aroundPointand also clean up the math used in other functions, but for now it's just used as a helper for pursuit math-related things.follow_pathfor customizing things like max voltage and PID gains per-movement yet, but let me know what should be added in that area.