Qustion of AutoBuilder of PathPlanner

I’m trying to use AutoBuilder by follow PathPlanner document, but there is something wrong. Could anyone help me to slove this problem?

I guess the problem is “s_Swerve::setModuleState”, so below is code of that part.

public void setModuleStates(SwerveModuleState desiredStates) {

    SwerveDriveKinematics.desaturateWheelSpeeds(desiredStates, Constants.Swerve.maxSpeed);
    
    for(SwerveModule mod : mSwerveMods){
        mod.setDesiredState(desiredStates[mod.moduleNumber], false);
    }
}

One issue is likely that you are passing a PIDController instead of the PIDConstants object that the SwerveAutoBuilder constructor takes.

The PathPlanner auto builder creates the PIDController itself using the PIDConstants passed.

1 Like

What does VSCode tell you the issue is? You can hover over the red squiggly line and it should tell you.

That said, @ohowe is probably right.

1 Like

You are right, thank you.
I didn’t know they are totally different before.

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