Skip to content
learnFRC.org
programminglesson35 min

Event Markers & Action Choreography

Multi-subsystem autonomous choreography using PathPlanner event markers, NamedCommands, and non-blocking parallel command compositions.

What you will learn

  • Register NamedCommands to decouple subsystem implementations from path planning files.
  • Configure spatial and time-offset event markers along autonomous trajectories.
  • Build non-blocking parallel command compositions that run mechanisms while driving.
  • Implement intake auto-retract sequences triggered by game piece beam-break sensors.

Prerequisites:Kinodynamic Trajectory Optimization

In basic autonomous programming, teams often execute a sequence of discrete steps: drive to location, stop, deploy intake, run rollers, retract intake, drive to goal, stop, spin up shooter, shoot. This stop-and-go architecture limits scoring throughput to 2 or 3 game pieces in 15 seconds.

Top-tier teams use Event Markers and NamedCommands to run mechanisms concurrently with drivetrain translation, saving 0.5 to 1.5 seconds on every game piece cycle.


Before configuring event markers:

  1. Ensure individual mechanism commands have well-defined termination criteria (isFinished()) and safe interrupt handling (end(boolean interrupted)) as covered in Writing Commands.
  2. Verify mechanism current limits to prevent stalling when deploying intakes at high transit speeds.

PathPlanner allows paths to reference commands by string identifier (such as "deployIntake" or "spinUpFlywheel"). These string names are mapped to actual WPILib command factories in code using NamedCommands.registerCommand():

package frc.robot;
import com.pathplanner.lib.auto.NamedCommands;
import edu.wpi.first.wpilibj2.command.Commands;
import frc.robot.subsystems.IntakeSubsystem;
import frc.robot.subsystems.ShooterSubsystem;
import frc.robot.subsystems.ElevatorSubsystem;
import static edu.wpi.first.units.Units.*;
public class AutonomousCommandRegistrar {
public static void registerAll(
IntakeSubsystem intake,
ShooterSubsystem shooter,
ElevatorSubsystem elevator
) {
// Register intake command: runs rollers until game piece trips internal beam break
NamedCommands.registerCommand(
"intakePiece",
intake.intakeUntilAcquiredCommand()
);
// Register shooter pre-spool: spins wheels up to 4500 RPM
NamedCommands.registerCommand(
"preSpoolShooter",
shooter.spinUpCommand(RPM.of(4500))
);
// Register scoring sequence: feeds piece into shooter once up to speed
NamedCommands.registerCommand(
"scorePiece",
Commands.sequence(
shooter.waitUntilAtSpeedCommand(RPM.of(4500), RPM.of(50)),
intake.feedToShooterCommand().withTimeout(0.35)
)
);
// Register elevator preset position
NamedCommands.registerCommand(
"elevatorToMid",
elevator.setHeightCommand(Meters.of(0.75))
);
}
}
Register Before Building Autos

All NamedCommands.registerCommand() calls must execute before any PathPlannerAuto or PathPlannerPath is loaded. If an auto references an unregistered command name, PathPlanner throws an exception or substitutes a dummy command.


In the PathPlanner GUI, event markers can be placed along any trajectory:

1. Position-Based Markers (Waypoint Offsets)

Section titled “1. Position-Based Markers (Waypoint Offsets)”
  • Placed relative to a specific waypoint (e.g., 0.5 meters before Waypoint 2).
  • Use Case: Lowering the intake right before reaching a note, regardless of actual velocity or acceleration.
  • Placed relative to time elapsed or time remaining (e.g., 0.8 seconds before reaching the end of the path).
  • Use Case: Spooling up a heavy flywheel shooter. If a flywheel requires 0.75 seconds to accelerate from idle to 5000 RPM, trigger "preSpoolShooter" at timeRemaining <= 0.80s so the shooter reaches full speed the exact instant the drivetrain stops at the scoring position.

4. Building Safe Non-Blocking Compositions

Section titled “4. Building Safe Non-Blocking Compositions”

When mechanisms run concurrently with swerve drive commands, commands must not block the drivetrain if a mechanism fails:

// Example: Safe intake command with timeout guard
public Command intakeUntilAcquiredCommand() {
return Commands.sequence(
deployIntakeCommand(),
runRollersCommand()
.raceWith(Commands.waitUntil(this::hasGamePiece))
.withTimeout(2.5), // Safety guard: abort if piece not acquired in 2.5s
retractIntakeCommand()
);
}

By wrapping the sensor wait in withTimeout(2.5), the robot will not remain frozen on the field if a game piece was bumped away by another robot during the match.


  1. Continuous Drivetrain Motion in AdvantageScope:
    • Check the swerve chassis velocity graph. The robot should not decelerate to zero while deploying the intake or raising the elevator.
  2. Flywheel Ready at Arrival:
    • In AdvantageScope, plot Shooter/RPM and Swerve/LinearVelocity.
    • The flywheel RPM must reach the setpoint tolerance band within ±0.1seconds±0.1 seconds of the robot coming to a stop at the goal pose.
  3. Sensor-Triggered Advance:
    • When the beam break detects a game piece, the intake must retract immediately without waiting for a fixed timer.

Now proceed to Field Pose Correction & Terminal Alignment to learn how to keep trajectories repeatable under carpet wear and wheel scrub.

Verified Sources & Standards

Evergreen Standard Verified: Sep 25, 2026