Pathplanner Auto Events

Our team is trying to use swerve drive and pathplanner for auto this year.
Right now we have a working swerve drive and auto with pathplanner.
We also have a separate command for running a motor by itself.
We are stuck on how to separate the path into separate segments and add events in between the path segments and make the robot stop and preformed a command during these periods. This is our code at the moment. We have tried using the pathplanner wiki but some of the implementation is unclear there.
Any help is appreciated.

Use a sequential command group. It’s a command that runs one command after another. You can also put parallel command groups inside of it if you want multiple commands running at the same time. Last year my team used pathweaver, but the implementation should be very similar. (We had a command that would make the robot follow a given trajectory, and used .withTimeout to specify how long it should run, don’t do that.) Instead, in the sequential command group’s constructor, you can make PPSwerveControllerCommand for every segment of the path you want it to follow, then you can call each of them in the sequential command group.

Our auto:

Thanks do you have any idea how to split one long path into several segments

In Pathplanner, make a segment as one path, then create a new path and make that a segment too. For example, you would have one path file be for going to pick up a cone, then do another command to pick up the cone, then make another path to go back to place the cone. Do this as many times as necessary.


Use path groups instead. Then you don’t need to edit the start of another path when you edit the end of another. Use the loadPathGroup method to return a list of all the paths in the group.


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