Gray Matter LogoGray Matter Workshop

Adding PathPlanner

PathPlanner for Autonomous Navigation

PathPlanner is a motion profile generator for FRC robots, providing a GUI for creating complex autonomous paths and seamlessly integrating with your swerve drivetrain. The CTRE swerve generator automatically configures PathPlanner integration, making autonomous development straightforward.

Key Concept: PathPlanner enables visual path creation with constraints, events, and holonomic control for swerve drivetrains.

PathPlanner Integration

The swerve drivetrain generated by Phoenix Tuner X doesn't include the PathPlanner integration by default. The Workshop-Code repository includes this integration in Pull Request #7, which shows the complete swerve and PathPlanner setup.

Workshop Code Implementation

This is a simplified version of the swerve drivetrain subsystem that only includes the necessary methods for driving the robot. We based it off of the SwerveWithPathPlanner example project from CTRE. You should copy this code into your CommandSwerveDrivetrain.java file, as well as the RobotContainer.java file.

šŸ“ CommandSwerveDrivetrain.java

Loading file...

šŸŽ® RobotContainer.java

Loading file...

šŸ” Exploring the Swerve Implementation

The swerve code includes several key files generated by Phoenix Tuner X:

  • CommandSwerveDrivetrain: Main drivetrain subsystem with control methods
  • TunerConstants: All configuration values (CAN IDs, gear ratios, dimensions)
  • RobotContainer: Drive command bindings and controller setup
  • generated/ folder: Low-level module and drive train implementations

What is PathPlanner?

PathPlanner is a motion planning tool specifically designed for FRC robots. It provides a graphical interface for creating autonomous paths with velocity constraints, rotation control, and event markers.

Key Features

  • Visual Path Editor: Drag-and-drop waypoints on a field image
  • Holonomic Support: Independent control of translation and rotation
  • Constraints: Velocity, acceleration, and angular velocity limits
  • Event Markers: Trigger commands at specific points along the path
  • Named Commands: Reusable command definitions for autonomous
  • Auto Builder: Compose complex autos from multiple paths

Why PathPlanner?

  • FRC-Specific: Built for WPILib and FRC field layouts
  • Time-Saving: Visual editor is faster than manual tuning
  • Repeatable: Paths saved as JSON files in your repo
  • Team Friendly: Non-programmers can help create paths
  • Proven: Used by top FRC teams in competition
  • Active Development: Regular updates and FRC community support

Installing PathPlanner

Step 1: Download PathPlanner GUI

Download the PathPlanner desktop application for your operating system from the official releases page:

PathPlanner Releases

Step 2: Add PathPlanner as a Vendor Dependency

Follow the steps in the PathPlanner Getting Started Guide to add PathPlanner as a vendor dependency.

PathPlanner Installation Guide

Step 3: Configure AutoBuilder

The CommandSwerveDrivetrain generated by Phoenix Tuner X automatically configures PathPlanner's AutoBuilder. You can see this in the constructor:

CommandSwerveDrivetrain.javaJAVA

Creating Your First Path

Opening Your Project in PathPlanner

  1. 1. Launch the PathPlanner GUI application
  2. 2. Click "Open Project" and navigate to your robot project root directory
  3. 3. PathPlanner will create a src/main/deploy/pathplanner directory
  4. 4. Update robot configuration in the PathPlanner settings to match your robot's physical parameters
PathPlanner Settings

Path Creation Workflow

Add Waypoints:

Click on the field to place waypoints. The first point is your starting position, and subsequent points define the path.

Adjust Heading:

For swerve drive, you can independently control the robot's heading at each waypoint. Drag the rotation handle to set the desired orientation.

Set Constraints:

Define velocity and acceleration limits for different segments of the path. This is useful for slowing down around tight turns.

Add Event Markers:

Place markers along the path to trigger commands (e.g., intake game pieces, shoot, etc.)

NamedCommands

Register named commands that can be triggered by event markers in your paths:

Registered Named CommandsJAVA

PathPlanner Configuration & Tuning

PathPlanner uses PID controllers to follow autonomous paths accurately. Proper tuning ensures your robot tracks paths smoothly without oscillation or lag.

PathPlanner Configuration - Do in the GUI

Robot Config should be as accurate as possible to your robot, and many configs are available online. However, to significantly help path tracking, configure the App Settings, which contain the MotionMagic configurations for PathPlanner.

  • App Setting: Max Velocity: Set to 80-90% of your robot's maximum speed. This provides headroom for PID corrections.
  • App Setting: Max Acceleration: Conservative values (2-3 m/s²) prevent wheel slip. Increase gradually while testing.
  • App Setting: Max Angular Velocity: Limit rotational speed to prevent modules from fighting each other.
  • App Setting: Max Angular Acceleration: Limit rotational acceleration to prevent robot from rotating too quickly.

šŸŽÆ Tuning Strategy

Tune PathPlanner PID values like normal. However be aware that due to loop times these cannot be tuned as aggressively.

PathPlanner Tips & Best Practices

Path Creation

  • Start with simple paths and gradually add complexity
  • Use fewer waypoints for smoother paths (let PathPlanner interpolate)
  • Test paths in simulation before running on real robot
  • Save multiple versions of paths for testing different strategies

Common Pitfalls

  • Don't set constraints too aggressively - allow margins for error
  • Always verify starting pose matches path starting point
  • Remember to commit path files to git (in deploy/pathplanner)
  • Test event marker timing - they execute at specific path points

PathPlanner Integration Complete!

You now have PathPlanner integrated with your swerve drivetrain and understand how to create autonomous paths. Key takeaways:

  • PathPlanner provides visual path creation for autonomous routines
  • CTRE swerve generator automatically configures PathPlanner integration
  • Holonomic support allows independent translation and rotation
  • Event markers enable command execution at specific path points
  • Named commands create reusable actions for autonomous
  • Workshop Code PRs demonstrate progressive implementation
PathPlanner Official Documentation

What's Next?

Up Next: Swerve Calibration

With PathPlanner configured, you're ready to calibrate your swerve drive for maximum accuracy. You'll tune motor gains, configure slip current limits, and measure wheel radius for precise odometry.