Class FollowPathCommand

java.lang.Object
edu.wpi.first.wpilibj2.command.Command
com.pathplanner.lib.commands.FollowPathCommand
All Implemented Interfaces:
Sendable

public class FollowPathCommand extends Command
Base command for following a path
  • Constructor Details

    • FollowPathCommand

      public FollowPathCommand(PathPlannerPath path, Supplier<Pose2d> poseSupplier, Supplier<ChassisSpeeds> speedsSupplier, BiConsumer<ChassisSpeeds,DriveFeedforwards> output, PathFollowingController controller, RobotConfig robotConfig, BooleanSupplier shouldFlipPath, Subsystem... requirements)
      Construct a base path following command
      Parameters:
      path - The path to follow
      poseSupplier - Function that supplies the current field-relative pose of the robot
      speedsSupplier - Function that supplies the current robot-relative chassis speeds
      output - Output function that accepts robot-relative ChassisSpeeds and feedforwards for each drive motor. If using swerve, these feedforwards will be in FL, FR, BL, BR order. If using a differential drive, they will be in L, R order.

      NOTE: These feedforwards are assuming unoptimized module states. When you optimize your module states, you will need to reverse the feedforwards for modules that have been flipped

      controller - Path following controller that will be used to follow the path
      robotConfig - The robot configuration
      shouldFlipPath - Should the path be flipped to the other side of the field? This will maintain a global blue alliance origin.
      requirements - Subsystems required by this command, usually just the drive subsystem
  • Method Details

    • initialize

      public void initialize()
      Overrides:
      initialize in class Command
    • execute

      public void execute()
      Overrides:
      execute in class Command
    • isFinished

      public boolean isFinished()
      Overrides:
      isFinished in class Command
    • end

      public void end(boolean interrupted)
      Overrides:
      end in class Command
    • warmupCommand

      public static Command warmupCommand()
      Create a command to warmup on-the-fly generation, replanning, and the path following command
      Returns:
      Path following warmup command