PathPlanner Help

Trying to implement path planner this year. We are having an issue where I can’t get rid of an error on the PPSwerveContollComand

It doesn’t seem to like the supplier for setting module states. It works with the Pailin swerve command but then it doesn’t follow the holonomic rotation we put in pathplanner.

PPSwerveControllerCommand testAuto = new PPSwerveControllerCommand (
testPath,
swerveSubsystem::getPose,
DriveConstants.kDriveKinematics,
AutoConstants.kxController,
AutoConstants.kyController,
AutoConstants.kThetaController,
swerveSubsystem::setModuleStates,
swerveSubsystem);

public void setModuleStates(SwerveModuleState[] desiredStates) {
SwerveDriveKinematics.desaturateWheelSpeeds(desiredStates, DriveConstants.kPhysicalMaxSpeedMetersPerSecond);
frontLeft.setDesiredState(desiredStates[0]);
frontRight.setDesiredState(desiredStates[1]);
backLeft.setDesiredState(desiredStates[2]);
backRight.setDesiredState(desiredStates[3]);
}

Here is a link to complete code

https://github.com/mavericks2252/2023RobotCodeNew/tree/main/src/main/java/frc/robot

1 Like

That link seems to point to a private project so I can’t take a look. What is the exact error output you see?

EDIT: there is also another constructor option for that command which will output ChassisSpeeds and then you don’t need to supply your kinematics if you’d prefer doing it that way.

EDIT 2: if it works with the normal SwerveControllerCommand, that probably means that you’re using a ProfiledPIDController for the theta controller. The PPLib version uses a normal PIDController. Be aware you will likely need different PID values for this controller.

1 Like

Sorry fixed the link. Public now

It is saying the line with swervesubsystem::setModuleState needs to be actionable.

I am not in front of that computer right now and can copy it tomorrow. CAD guy by nature taking over programming team last year and this year so likely something simple🤦‍♂️

Yeah from looking at the code it looks like what I said in edit 2 above is correct. You need to use a normal PIDController for the PPLib version of the command.

1 Like

I missed that in the wiki sample code… I will look at that tomorrow.

Thanks for all the awesome work on his resource. It really is a huge help and great.

We are excited to implement it

Edit: should the robot have followed the holomonic rotation when using the wpi swerve command? Have I missed something else?

1 Like

No. Holonomic rotation is part of a PPLib path so the WPILib commands have no knowledge of this information. This is why the PPLib commands exist, so they can take advantage of that.

Awesome. Thank you again! First year with swerve so a bit of a learning curve

1 Like

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