Skip to content

Lesson 5.13: Creating Paths and Named Commands

🎯 What You’ll Learn

By the end of this lesson you will be able to:

  • Create and edit paths in the PathPlanner GUI with waypoints and rotation targets
  • Register Named Commands in RobotContainer that PathPlanner auto routines can reference
  • Use event markers to trigger commands at specific points along a path
  • Configure path constraints (max velocity, max acceleration) for safe and efficient motion
  • Compose auto routines that chain paths and Named Commands together

From Reading Autos to Creating Them

In Unit 4 (Lessons 4.12 and Activity 4.13), you learned to read existing autonomous routines — opening PathPlanner, tracing paths, and connecting Named Commands to Java code. Now you’ll learn to create them.

The workflow for creating an autonomous routine has four parts:

  1. Create paths — design the trajectories the robot will follow
  2. Register Named Commands — write the Java commands that mechanisms will execute
  3. Add event markers — trigger commands at specific points along paths
  4. Compose the auto — chain paths and commands into a complete routine

Let’s go through each one.


Part 1: Creating Paths in PathPlanner

A path is a trajectory that the robot follows on the field. It’s defined by waypoints — points that the robot drives through.

Opening the Path Editor

  1. Open PathPlanner and load your team’s project
  2. Click “New Path” in the paths panel
  3. Give it a descriptive name (e.g., ScoreToPickup1, Pickup1ToScore)

Adding Waypoints

Click on the field to add waypoints. Each waypoint has:

PropertyWhat It Controls
Position (x, y)Where the robot drives through on the field (in meters)
HeadingThe direction the robot is traveling at this point (tangent to the path)
Rotation targetThe direction the robot should be facing at this point (independent of travel direction)

The distinction between heading and rotation target is important for swerve drive:

  • Heading = direction of travel (which way the robot is moving)
  • Rotation target = direction the robot faces (which way the front of the robot points)

With swerve drive, these can be different — the robot can drive sideways while facing forward, or drive forward while rotating to face a scoring target.

Path Design Tips

  1. Start simple — begin with 2-3 waypoints and add more only if needed
  2. Use smooth curves — avoid sharp turns that require the robot to slow down significantly
  3. Consider the robot’s size — leave clearance from field elements and walls
  4. Think about what comes next — end the path in a position that sets up the next action
  5. Name paths descriptivelyScoreToPickup1 is better than Path1

Part 2: Registering Named Commands

Named Commands are Java commands that PathPlanner auto routines reference by name. They’re the bridge between PathPlanner’s visual auto editor and your team’s Java code.

How Named Commands Work

  1. In Java code, you register a command with a string name:

    NamedCommands.registerCommand("StartIntake", intakeSubsystem.intakeCommand());
  2. In PathPlanner’s auto editor, you reference that name:

    Named Command: "StartIntake"
  3. When the auto runs, PathPlanner looks up “StartIntake” and executes the registered Java command.

Where to Register Named Commands

Named Commands are registered in RobotContainer.java, typically in the constructor or a dedicated configureNamedCommands() method. Look for NamedCommands.registerCommand() calls.

Writing Good Named Commands

Good PracticeWhy
Use descriptive names"StartIntake" is clearer than "cmd1"
Keep commands focusedOne Named Command = one action (start intake, shoot, stop intake)
Handle cleanupCommands should stop motors when they end (use finallyDo())
Test independentlyVerify each Named Command works via a button binding before using it in an auto
Match names exactlyPathPlanner is case-sensitive — "StartIntake""startintake"

Common Named Commands for FRC

NameWhat It DoesExample
"StartIntake"Deploys and runs the intakenew InstantCommand(() -> intake.deployAndRun())
"StopIntake"Retracts and stops the intakenew InstantCommand(() -> intake.stopAndRetract())
"ShootNote"Runs the full shooting sequencenew AutoShootCommand(shooter, turret, feeder)
"AimTurret"Starts turret auto-aimingnew InstantCommand(() -> turret.enableAutoAim())
"ResetPose"Resets odometry to a known positionnew InstantCommand(() -> drivetrain.resetPose(startPose))

You register a Named Command as NamedCommands.registerCommand('RunIntake', intakeCommand) in Java, but in PathPlanner you type 'runIntake' (lowercase 'r'). What happens when the auto runs?


Part 3: Event Markers

Event markers let you trigger a Named Command at a specific point along a path, rather than before or after the path. This is powerful for overlapping driving with mechanism actions.

When to Use Event Markers

ScenarioWithout Event MarkersWith Event Markers
Start intake while driving to a game pieceDrive to piece → stop → start intake → waitStart intake at 70% through the path → intake is running when robot arrives
Aim turret while approaching scoring positionDrive to position → stop → aim → shootStart aiming at 50% through the path → turret is aimed when robot arrives
Retract intake after picking upPick up → stop → retract → drive to scoreRetract at the end of the pickup path → retraction happens during the drive

Event markers save time by overlapping actions with driving. In a 15-second autonomous period, every fraction of a second matters.

Adding Event Markers in PathPlanner

  1. Open a path in the PathPlanner editor
  2. Click on the path at the point where you want the command to trigger
  3. Select “Add Event Marker”
  4. Enter the Named Command name (must match your Java registration exactly)
  5. Set the trigger position (percentage along the path or specific waypoint)

Part 4: Path Constraints

Path constraints control how fast the robot can drive along a path. They’re critical for safety and reliability.

Constraint Types

ConstraintWhat It ControlsTypical Values
Max velocityMaximum speed along the path (m/s)2.0 – 4.5 m/s
Max accelerationMaximum speed change rate (m/s²)2.0 – 4.0 m/s²
Max angular velocityMaximum rotation speed (rad/s)2π – 4π rad/s
Max angular accelerationMaximum rotation speed change (rad/s²)4π – 8π rad/s²

Setting Constraints

In PathPlanner, you can set constraints at two levels:

  1. Global constraints — apply to the entire path (set in the path properties)
  2. Constraint zones — apply to a specific section of the path (useful for slowing down near obstacles or scoring positions)

Constraint Tips

  • Start conservative — use lower speeds until you verify the path works, then increase
  • Slow down near game pieces — the robot needs to be precise when picking up, not fast
  • Slow down near scoring — accuracy matters more than speed when scoring
  • Match your robot’s capabilities — don’t set max velocity higher than your robot can actually achieve
  • Account for carpet friction — paths that work on smooth floors may slip on competition carpet

Composing an Auto Routine

An auto routine chains paths and Named Commands into a complete autonomous sequence. In PathPlanner’s auto editor:

  1. Click “New Auto” in the autos panel
  2. Set the starting pose — where the robot begins on the field
  3. Add actions in sequence:
    • Follow Path — the robot drives along a path
    • Named Command — the robot executes a registered command
    • Wait — pause for a specified time
  4. Name the auto descriptively (e.g., TwoNoteCenter, ThreeNoteAmp)

Example Auto Structure

A typical two-note auto might look like:

1. Starting Pose: Center of the field, facing the speaker
2. Named Command: "ShootPreload" (score the preloaded note)
3. Follow Path: "ScoreToPickup1" (drive to the first game piece)
4. Named Command: "StartIntake" (begin intaking)
5. Wait: 0.5s (give the intake time to grab the piece)
6. Named Command: "StopIntake"
7. Follow Path: "Pickup1ToScore" (drive back to scoring position)
8. Named Command: "ShootNote" (score the second note)

Auto Chooser

PathPlanner’s AutoBuilder creates a SendableChooser that appears in the Driver Station. This lets the drive team select which auto to run before each match without redeploying code.

Your team’s auto chooser is set up in RobotContainer.java — look for AutoBuilder.buildAutoChooser() or similar.


You create a new auto routine in PathPlanner with a Named Command 'ShootNote', but when you run the auto, the robot drives the paths correctly but never shoots. The Named Command is registered in RobotContainer. What should you check?


Checkpoint: Creating Paths and Named Commands
Design a simple two-note auto routine on paper (or in PathPlanner). Describe: (1) The starting pose and why you chose it. (2) The paths you'd create (names, start/end positions). (3) The Named Commands you'd need to register. (4) Where you'd place event markers to save time. (5) What constraints you'd set and why.

A strong auto design includes:

  1. Starting pose: “Center of the field, facing the speaker at (1.4, 5.5) with 0° heading. This position gives the shortest path to the center game pieces.”

  2. Paths: “ScoreToCenter1 — from scoring position to the first center game piece. Center1ToScore — from the game piece back to the scoring position.”

  3. Named Commands: “ShootPreload (score the starting note), StartIntake (deploy and run intake), StopIntake (retract intake), ShootNote (full shooting sequence).”

  4. Event markers: “Place StartIntake at 80% through ScoreToCenter1 so the intake is running before the robot reaches the game piece. Place StopIntake at 20% through Center1ToScore so the intake retracts while driving back.”

  5. Constraints: “Max velocity 3.0 m/s (conservative for first test), max acceleration 2.5 m/s². Add a constraint zone at the end of ScoreToCenter1 that slows to 1.5 m/s for precise game piece pickup.”


Key Terms

📖 All terms below are also in the full glossary for quick reference.

TermDefinition
PathA trajectory defined by waypoints that the robot follows during autonomous, created in the PathPlanner GUI
Named CommandA Java command registered with a string name via NamedCommands.registerCommand() that PathPlanner auto routines can reference
Event MarkerA trigger point along a path that executes a Named Command at a specific position, enabling overlapped driving and mechanism actions
Path ConstraintsLimits on maximum velocity, acceleration, and angular rates that control how fast the robot drives along a path
Constraint ZoneA section of a path with different constraints than the rest, used to slow down near obstacles or precision-required areas
Auto RoutineA complete autonomous sequence composed of paths, Named Commands, and waits in PathPlanner’s auto editor
Auto ChooserA NetworkTables-based dropdown in the Driver Station that lets the drive team select which auto routine to run before a match

What’s Next?

You now know how to create paths, register Named Commands, and compose auto routines. In Activity 5.14: Build an Auto Routine, you’ll put this knowledge into practice — creating a new path, registering a Named Command, composing an auto, and verifying it loads in the auto chooser.