Pathplanner (Python)

Hello! I am wondering if anyone was able to help me learn to use pathplanner and how to incorporate it into a robot. We wanted to use it for the 2024 Season but we couldn’t figure it out. So I was hoping that the Chief Delphi community could help us out! Giving examples help as well

Hello!

Sure!

Unfortunately - we’re going to struggle a bit here. The issue is that we don’t know what it is that you couldn’t figure out.

Two options on how to proceed - Both in your camp:

Path 1 - start from “scratch”. Go through Pathplanner’s documentation, specifically clicking the python tabs. See how far you can get. When you see something you don’t understand and can’t figure out, stop to ask a specific question here, and we’ll see what we can do.

Path 2 - Take some time to flesh out your question for this audience of contextless strangers. It usually helps to format in three parts:

  1. What have you already done, that worked fine?
  2. What is not yet working?
  3. For the broken things - what do you expect to see, and what do you actually see?

From there, it’s a lot easier to deduce root cause, or correct a misunderstanding.

1 Like

Ok thanks for the two options you provided me! I’ll send some time rewriting it whilst following the documentation and then come back with questions I have. In the meantime, here is kore info on what we have

So my team had used Swerve Drive for the first time last year and we were able to configure the auto and assign commands to that would be used. Our main issue was figuring out how properly create and utilize the pathplanner app to use the commands we made and how to actually write code so that our robot would actually follow paths we made.

If there is more info that you would need to help us I’m more than willing to give it to you. We wanna make sure that we can properly utilizes the resources out there to better prepare ourselves for the 2025 season. Our code for last year hasn’t been uploaded to our GitHub and so that might limit the help you could offer us.

Here I have put some of the code we have written if it helps! I know this isn’t the best way to provide the code but its the only way I can do it right now.

These we the commands -
pathplannerlib.auto.NamedCommands.registerCommand(“Shoot”, self.shooter.getShooterCommand_auto())
pathplannerlib.auto.NamedCommands.registerCommand(“Intake”, self.intake.getIntakeCommand_ws())
pathplannerlib.auto.NamedCommands.registerCommand(“Pivot60”, self.arm.setpoint(60))
pathplannerlib.auto.NamedCommands.registerCommand(“Pivot70”, self.arm.setpoint(70))
pathplannerlib.auto.NamedCommands.registerCommand(“IC”, self.intake.getIntakeCommand_ic())

This was to configure it -
def configureauto(self):
self.poseinit = wpimath.geometry.Pose2d(2,2 ,0)
self.translationPID = pathplannerlib.config.PIDConstants(0,0,0,0)
self.rotationPID = pathplannerlib.config.PIDConstants(0,0,0,0)
self.replanning = pathplannerlib.config.ReplanningConfig(True, False, 1, 0.25)

    self.l = pathplannerlib.config.HolonomicPathFollowerConfig(self.translationPID,self.rotationPID, constants.AutoConstants.kMaxSpeedMetersPerSecond, wpimath.units.inchesToMeters(21.21), self.replanning, 0.02)
    AutoBuilder.configureHolonomic(self.robotDrive.getPose,self.robotDrive.resetOdometry, self.robotDrive.getSpeed, self.robotDrive.setSpeeds,self.l, self.robotDrive.getAlliance, self.robotDrive)