Skip to content
learnFRC.org
programminglesson45 min

PathPlanner Autonomous Routines

Designing Bézier paths in the PathPlanner GUI, registering Named Commands, configuring Event Markers, and building full autonomous routines.

What you will learn

  • Configure PathPlanner AutoBuilder with drive, reset-pose, and chassis-speed callbacks.
  • Register NamedCommands before loading paths to prevent missing-command crashes.
  • Create multi-waypoint Bézier curves and schedule mechanism event markers along the path.

Prerequisites:Swerve Kinematics & Field-Oriented Drive

Scoring multiple game pieces during the 15-second autonomous period requires synchronizing holonomic path following with mechanism commands.

PathPlanner is the standard tool for designing trajectories and sequencing commands in FRC.


PathPlannerLib requires configuring an AutoBuilder in your swerve subsystem. This connects PathPlanner’s path-following algorithms to your physical drivetrain:

package frc.robot.subsystems;
import com.pathplanner.lib.auto.AutoBuilder;
import com.pathplanner.lib.config.PIDConstants;
import com.pathplanner.lib.config.RobotConfig;
import com.pathplanner.lib.controllers.PPHolonomicDriveController;
public class CommandSwerveDrivetrain extends SubsystemBase {
// ... swerve hardware handles ...
public void configurePathPlanner() {
try {
RobotConfig config = RobotConfig.fromGUISettings();
AutoBuilder.configure(
this::getPose, // Pose2d supplier
this::resetPose, // Pose2d consumer to reset odometry
this::getRobotRelativeSpeeds, // Current ChassisSpeeds supplier
(speeds, feedforwards) -> driveRobotRelative(speeds), // Output consumer
new PPHolonomicDriveController(
new PIDConstants(5.0, 0.0, 0.0), // Translation PID (meters)
new PIDConstants(5.0, 0.0, 0.0) // Rotation PID (radians)
),
config,
() -> isRedAlliance(), // Flips paths for Red Alliance
this
);
} catch (Exception e) {
e.printStackTrace();
}
}
}

To trigger mechanism actions (like deploying an intake or firing a shooter) along a path, you must register Named Commands in Java:

// Inside RobotContainer.java
public void configureNamedCommands() {
// Map text strings in the PathPlanner GUI to Java commands
NamedCommands.registerCommand("IntakePiece", m_intake.intakeCommand());
NamedCommands.registerCommand("ShootHigh", m_shooter.shootCommand());
NamedCommands.registerCommand("StowArm", m_arm.moveToAngleCommand(Degrees.of(0.0)));
NamedCommands.registerCommand("PrepareScore", m_arm.moveToAngleCommand(Degrees.of(80.0)));
}
Registration Order

Always call configureNamedCommands() before building any autonomous routines from files. If PathPlanner encounters a named command during auto construction that has not been registered in Java, it throws a runtime exception and aborts autonomous mode.


  1. Open the PathPlanner application.
  2. Select your robot project directory (PathPlanner loads settings from src/main/deploy/pathplanner/).
  3. Click New Path:
    • Set the initial waypoint: X, Y, and robot heading.
    • Add end waypoints to form a smooth Bézier curve.
    • Adjust control points to navigate around field obstacles.
  4. Insert Event Markers:
    • Click along the curve to add an event marker at a specific timestamp or position.
    • Assign a Named Command (e.g., IntakePiece). The command will trigger while the robot is driving at full speed!
  5. Create an Auto Routine:
    • In the Autos tab, create a new auto (e.g., FourPieceCenter).
    • Sequence paths and commands: [ScorePreload] -> [PathToPiece1] -> [ScorePiece1].

Expose your PathPlanner routines to the Driver Station dashboard:

public class RobotContainer {
private final SendableChooser<Command> m_autoChooser;
public RobotContainer() {
// Register named commands FIRST
configureNamedCommands();
// Build auto chooser from PathPlanner project files
m_autoChooser = AutoBuilder.buildAutoChooser();
SmartDashboard.putData("Auto Mode", m_autoChooser);
}
public Command getAutonomousCommand() {
return m_autoChooser.getSelected();
}
}

  • Symptom: On the blue alliance, the robot drives forward; on red alliance, the robot drives backward or off the field.
  • Cause: The alliance flip supplier was implemented improperly or flipped gyro angles twice.
  • Fix: Verify () -> isRedAlliance() accurately reflects DriverStation.getAlliance().
  • Symptom: Robot begins tracking the path, but gradually drifts 20-30 cm off course.
  • Cause: Translation PID constants are too low (PIDConstants(1.0, 0, 0)), or wheel scrub is not compensated.
  • Fix: Increase translation kP to 5.0 or 6.0 to tighten trajectory tracking.

  1. Create a simple 2-meter straight path in PathPlanner GUI (TestStraight2M).
  2. Run simulation (F5) and select TestStraight2M in SmartDashboard.
  3. Enable Autonomous in SimGUI.
  4. Verify the robot drives exactly 2 meters on the simulated field map and stops cleanly.

Verified Sources & Standards

Evergreen Standard Verified: Sep 25, 2026