Does anyone have any examples of PathPlannerLib being used to follow a trajectory?

We are trying to use pathplanner, but I can’t get some of their methods to work. Does anyone have pathplanner code that we could reference for this and would be willing to share?
Thank you in advance

From last year. Our command that just drove forward using a path planner path FRC2022/ at main · Frc5572/FRC2022 · GitHub

I apricate the reply but this is my first year of FRC and the 1st thing I was taught was swerve = hard. I was hoping to see some code for a West Coast driveTrain.

I don’t have anything for west coast drive. A tank drive example should be very similar conceptually, just using a slight different command.

Here is 4469’s code from this past offseason:

GitHub Code

It hasn’t been kept up to date with all the latest PathPlanner updates but should be a good starting point. Also of note, we use a navX gyroscope so all the rotation inputs are negative to account for its being CW positive instead of the standard of CCW positive.

Edit: Also if you have specific questions, please feel free to ask so that you can develop an understanding of the code.


the line “public static ArrayList pathGroupAuto1 = PathPlanner.loadPathGroup(
new PathConstraints(
AutoConstants.kMaxSpeedMetersPerSecond, //Velocity
AutoConstants.kMaxAccelerationMetersPerSecondSquared));” is giving us this error:

Type mismatch: cannot convert from List to ArrayListJava(16777233)

Do you know whats causing this? Trying to cast it to an arraylist or using a list instead of arraylist gives us null pointer exception errors

Later versions of PathPlannerLib has changed to use the list function. I haven’t been keeping that repo up to date but this should work:

public static List<PathPlannerTrajectory> pathGroupAuto1 = PathPlanner
        new PathConstraints(
        AutoConstants.kMaxSpeedMetersPerSecond, //Velocity
        AutoConstants.kMaxAccelerationMetersPerSecondSquared)); //Acceleration

Look at the wpi docs would be my reccomendation. The pathplanner command code is built off of wpi’s iirc so the docs apply to both.

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