Help with differential drive pathplanner

Hey yall, I had a quick question about how to use PathPlanner with a differential drive. I couldn’t find anything that really helped me through the documentation or anything I looked up. if anyone could send me their code of pathplanner with differential drive in java or any documentation that’s better than what is mainstream that would help me a lot.
Thank you so much!

I think what you’re looking for is the Ramsete controller example at the bottom of the documentation:

We have a simple command that we use to quickly test paths on our differential drive (typically for testing in simulation):

    private Command buildAutoPath(DriveTrain drive, String pathName) {
        Trajectory trajectory = PathPlanner.loadPath(pathName, new PathConstraints(
                Constants.Auto.MaxSpeedMetersPerSecond, Constants.Auto.MaxAccelerationMetersPerSecondSquared));

        RamseteCommand ramseteCommand = new RamseteCommand(
                new RamseteController(Constants.Auto.RamseteB, Constants.Auto.RamseteZ),
                new SimpleMotorFeedforward(
                new PIDController(Constants.DriveTrain.PDriveVelocity, 0, 0),
                new PIDController(Constants.DriveTrain.PDriveVelocity, 0, 0),
                // RamseteCommand passes volts to the callback

        // Reset odometry to the starting pose of the trajectory.

        // Run path following command, then stop at the end.
        return ramseteCommand.andThen(() -> drive.tankDriveVolts(0, 0));
1 Like

Is there some documentation for the ramsete controller because this all looks crazy to me right now? Thanks!

I hear that. The gist of it is that it uses the various PID and feedforward settings to smooth out the changes over time and account for error.

The Ramsete command is like a helpful wrapper around it. You could probably glean a lot from its implementation:

Did you read through and follow the Trajectory tutorial in the WPILib documentation?

You should start with that, then try to move to PathPlanner.


ill take a look at that as well as the things posted above. Thanks!

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