This is an adaptation of FRC 254's TrajectoryLib. They created this code, I just adapted it for a WPI Command-Based robot
This Uses FRC254's Spline Path Generating Code and FeedFoward Path Following. HUGE Thanks to them!!!:
https://github.com/Team254/TrajectoryLib
In a new scope of the Main class, define the config values and the waypoints with the following syntax:
WaypointSequence p = new WaypointSequence(10);
p.new Waypoint(x_feet,y_feet,angle_radians);
the angles are absolute
If your angle was negative and the path didn't reticulate properly, try using a positive angle using invertY() on the Waypoint Sequence
Find the path file, and copy it to the location "://file/paths" on the rio
Make sure that in your robot code that your path has been added to the array "kPathNames" and "KPathDescriptions" in AutoPaths.java
Create an Autonomous Command/Command Group that uses the Follow Path command like this:
new FollowPath(AutoPaths.get("TestPath"))
Run your auto!
This Uses FRC254's Spline Path Generating Code and FeedFoward Path Following. HUGE Thanks to them!!!:
https://github.com/Team254/TrajectoryLib