Path Planner Swerve Command Help

Hi, I was trying to code the Path Planner Swerve Controller Command, but it keeps giving an error. Can anyone help? Thanks!

public Command followTrajectoryCommand(PathPlannerTrajectory traj, boolean isFirstPath) {
return new SequentialCommandGroup(
new PPSwerveControllerCommand(
this::getPose, // Pose supplier
new SwerveDriveKinematics(
new Translation2d(0.57785/ 2, 0.57785 / 2),
new Translation2d(0.57785 / 2, -0.57785 / 2),
new Translation2d(-0.57785 / 2, 0.57785 / 2),
new Translation2d(-0.57785 / 2, -0.57785 / 2)),//kinematics, // SwerveDriveKinematics
new PIDController(0, 0, 0), // X controller. Tune these values for your robot. Leaving them 0 will only use feedforwards.
new PIDController(0, 0, 0), // Y controller (usually the same values as X controller)
new PIDController(0, 0, 0), // Rotation controller. Tune these values for your robot. Leaving them 0 will only use feedforwards.
this::setModuleStates, // Module states consumer
true, // Should the path be automatically mirrored depending on alliance color. Optional, defaults to true
this // Requires this drive subsystem

error: The constructor PPSwerveControllerCommand(PathPlannerTrajectory, this::getPose, SwerveDriveKinematics, PIDController, PIDController, PIDController, this::setModuleStates, boolean, DriveSubsystem) is undefined

Sorry - I don’t know how to format code here. Thanks!

I don’t have code in front of me, but it might be that you are passing PIDController objects instead of a set of PID Constants. Here’s a picture from my GitHub app.

We are creating a SwerveAutobuilder

1 Like

Do you have a getPose method that returns Pose2d, and a setModuleStates(SwerveModuleState[] states) method? I’m thinking one of those methods isn’t matching.

I also see that your P, I, and D are all zero. You probably want to have at least a P value.