How did you do OTF Trajectories

We never fully got on the fly trajectories working with path planner. Though we did get direct line to Pose navigation with a PID. I don’t have access to the bot now to work on it. So I was curious if any of you who used PathPlanner to make on the fly trajectories care to share your code?

Did you generate the trajectory on a button press or were you continuously generating in the back ground?

Did you use logic to determine different way points based on the position in the field?

1 Like

We did use the PP libraries to generate OTF trajectories, although they are only straight lines. I imagine you could add some more waypoints to get curves.

You can find the code here:

You want to look in commands/TagPositionDrive.java in initialize(). That creates the trajectory, and then hands it to subsystem/Drivetrain.java makeFollowTrajectoryCommand() to create a command.

2 Likes

If you want OTF trajectories that avoid obstacles we used A* with a lot of path gen control after that, lets you go from anywhere to anywhere else and make your paths on the fly,

Auto-scoring with Dynamic Pathfinding and Inverse Kinematics - Technical / Programming - Chief Delphi
Pathfinding On The Fly with a 3d Field - FIRST / Robot Showcase - Chief Delphi

1 Like

We just released 3061-lib with this season’s code, which includes a MoveToPose command and associated classes that generate paths on the fly. The path generation was triggered on a button press. The field was modeled as a collection of regions with transition points defined from a region to each of its neighbors. The path was generated to pass through these points between the starting and ending points.

The MoveToPose command class is a good place to start with more details in the Field2d and Region2d classes.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.