Our team has been having plenty of issues trying to get Pathplanner working with our code. this is the closest we’ve gotten to and the only error we’re having is with one of the imports not being resolved:
The import com.pathplanner.lib.config cannot be resolved
for the line: import com.pathplanner.lib.config.RobotConfig;
everything else seems to be working minus this singular import.
pathplannerTest/MAIN-SwerveDriveBackup(Navx)/src/main/java/frc/robot/subsystems/DriveSubsystem.java at main · ForgottenRussian/pathplannerTest · GitHub
this is the test file for trying to integrate this into our project.
we have tried to delete and redownload the packages for pathplanner, however, when using the beta package on the site, it throws several more errors, including a gradle error. The only package that seems to be working is the base https://3015rangerrobotics.github.io/pathplannerlib/PathplannerLib.json
thank you in advance
The PathPlanner Docs were recently updated for the 2025 beta, and have new configuration methods/classes that do not exist in previous versions. Here’s what I found in our old robot code. You will need to define some things within the config sections such as the drive base radius and PID values.
AutoBuilder.configureHolonomic(
this::getPose, // Robot pose supplier
this::resetOdometry, // Method to reset odometry (will be called if your auto has a starting pose)
this::getRobotVelocity, // ChassisSpeeds supplier. MUST BE ROBOT RELATIVE
this::setChassisSpeeds, // Method that will drive the robot given ROBOT RELATIVE ChassisSpeeds
new HolonomicPathFollowerConfig( // HolonomicPathFollowerConfig, this should likely live in your Constants class
Constants.TRANSLATION_PID,
// Translation PID constants
Constants.ANGLE_PID,
// Rotation PID constants
1.0,
// Max module speed, in m/s
swerveDrive.swerveDriveConfiguration.getDriveBaseRadiusMeters(),
// Drive base radius in meters. Distance from robot center to furthest module.
new ReplanningConfig()
// Default path replanning config. See the API for the options here
),
() -> {
// Boolean supplier that controls when the path will be mirrored for the red alliance
// This will flip the path being followed to the red side of the field.
// THE ORIGIN WILL REMAIN ON THE BLUE SIDE
var alliance = DriverStation.getAlliance();
return alliance.isPresent() ? alliance.get() == DriverStation.Alliance.Red : false;
},
this // Reference to this subsystem to set requirements
);```
Here is the code updated for your subsystem - hope this helps:
AutoBuilder.configureHolonomic(
this::getPose, // Robot pose supplier
this::resetPose, // Method to reset odometry
this::getSpeeds, //ChassisSpeeds supplier. MUST BE ROBOT RELATIVE
this::driveRobotRelative, // Method that will drive the robot given ROBOT RELATIVE ChassisSpeeds
new HolonomicPathFollowerConfig( // HolonomicPathFollowerConfig, this should likely live in your Constants class
new PIDConstants(5.0, 0.0, 0.0), // Translation PID
new PIDConstants(5.0, 0.0, 0.0), // Angle PID
5, // Max speed in m/s
0, // <--CHANGE TO YOUR DRIVE BASE RADIUS (distance from center of robot to furthest module in meters)
new ReplanningConfig()
),
() -> {
// Boolean supplier that controls when the path will be mirrored for the red alliance
// This will flip the path being followed to the red side of the field.
// THE ORIGIN WILL REMAIN ON THE BLUE SIDE
var alliance = DriverStation.getAlliance();
return alliance.isPresent() ? alliance.get() == DriverStation.Alliance.Red : false;
},
this
);