Class PathPlannerManager

java.lang.Object
frc.alotobots.library.subsystems.swervedrive.util.PathPlannerManager

public class PathPlannerManager extends Object
Manages PathPlanner integration for autonomous path following and path finding. Abstracts path planning functionality from the SwerveDriveSubsystem.
  • Constructor Details

    • PathPlannerManager

      public PathPlannerManager(SwerveDriveSubsystem driveSubsystem)
      Creates a new PathPlannerManager.
      Parameters:
      driveSubsystem - The swerve drive subsystem to control
  • Method Details

    • getPathFinderCommand

      public Command getPathFinderCommand(Pose2d target, LinearVelocity velocity)
      Creates a pathfinding command to the specified pose.
      Parameters:
      target - Target pose
      velocity - Target velocity
      Returns:
      Pathfinding command
    • getPathfindThenFollowPathCommand

      public Command getPathfindThenFollowPathCommand(String pathName)
      Parameters:
      pathName - The path name to follow after pathfinding to it
      Returns:
      The command to be scheduled
    • getPathfindThenFollowPathCommandWithOverride

      public Command getPathfindThenFollowPathCommandWithOverride(String pathName, Supplier<ChassisSpeeds> driverInput, boolean smoothTransition)
      Creates a command to pathfind to and then follow a path with driver override capability.
      Parameters:
      pathName - The path name to follow after pathfinding to it
      driverInput - Supplier for driver's requested chassis speeds
      smoothTransition - Whether to smoothly transition between autonomous and driver control
      Returns:
      The command to be scheduled
    • getAutoStartPose

      public Optional<Pose2d> getAutoStartPose(String autoName)
      Gets the starting pose from a PathPlanner auto.
      Parameters:
      autoName - The name of the auto to load
      Returns:
      Optional containing the starting pose, or empty if path cannot be loaded
    • getPathStartPose

      public Optional<Pose2d> getPathStartPose(String pathName)
      Gets the starting pose from a PathPlanner path.
      Parameters:
      pathName - The name of the path to load
      Returns:
      Optional containing the starting pose, or empty if path cannot be loaded
    • getPathEndPose

      public Optional<Pose2d> getPathEndPose(String pathName)
      Gets the final target pose from a PathPlanner path.
      Parameters:
      pathName - The name of the path to load
      Returns:
      Optional containing the final pose, or empty if path cannot be loaded
    • nearEndOfPath

      public boolean nearEndOfPath(String pathName, double translationalTolerance, double rotationalTolerance)
      Whether the current robot pose is near the end of a path
      Parameters:
      pathName - The path name to get the end pose from
      translationalTolerance - The translational tolerance in meters
      rotationalTolerance - The rotational tolerance in radians
      Returns:
      true if near the end of a path
    • nearStartOfPath

      public boolean nearStartOfPath(String pathName, double translationalTolerance, double rotationalTolerance)
      Whether the current robot pose is near the start of a path
      Parameters:
      pathName - The path name to get the end pose from
      translationalTolerance - The translational tolerance in meters
      rotationalTolerance - The rotational tolerance in radians
      Returns:
      true if near the start of a path
    • getPathTrajectory

      public Optional<List<Pose2d>> getPathTrajectory(String pathName)
      Gets the trajectory points for a given path name.
      Parameters:
      pathName - The name of the path to get the trajectory for
      Returns:
      Optional containing List of Pose2d points if path exists, empty Optional otherwise