Class PathPlannerManager
java.lang.Object
frc.alotobots.library.subsystems.swervedrive.util.PathPlannerManager
Manages PathPlanner integration for autonomous path following and path finding. Abstracts path
planning functionality from the SwerveDriveSubsystem.
-
Constructor Summary
ConstructorsConstructorDescriptionPathPlannerManager
(SwerveDriveSubsystem driveSubsystem) Creates a new PathPlannerManager. -
Method Summary
Modifier and TypeMethodDescriptiongetAutoStartPose
(String autoName) Gets the starting pose from a PathPlanner auto.getPathEndPose
(String pathName) Gets the final target pose from a PathPlanner path.getPathFinderCommand
(Pose2d target, LinearVelocity velocity) Creates a pathfinding command to the specified pose.getPathfindThenFollowPathCommand
(String pathName) getPathfindThenFollowPathCommandWithOverride
(String pathName, Supplier<ChassisSpeeds> driverInput, boolean smoothTransition) Creates a command to pathfind to and then follow a path with driver override capability.getPathStartPose
(String pathName) Gets the starting pose from a PathPlanner path.getPathTrajectory
(String pathName) Gets the trajectory points for a given path name.boolean
nearEndOfPath
(String pathName, double translationalTolerance, double rotationalTolerance) Whether the current robot pose is near the end of a pathboolean
nearStartOfPath
(String pathName, double translationalTolerance, double rotationalTolerance) Whether the current robot pose is near the start of a path
-
Constructor Details
-
PathPlannerManager
Creates a new PathPlannerManager.- Parameters:
driveSubsystem
- The swerve drive subsystem to control
-
-
Method Details
-
getPathFinderCommand
Creates a pathfinding command to the specified pose.- Parameters:
target
- Target posevelocity
- Target velocity- Returns:
- Pathfinding command
-
getPathfindThenFollowPathCommand
- 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 itdriverInput
- Supplier for driver's requested chassis speedssmoothTransition
- Whether to smoothly transition between autonomous and driver control- Returns:
- The command to be scheduled
-
getAutoStartPose
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
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
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 fromtranslationalTolerance
- The translational tolerance in metersrotationalTolerance
- 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 fromtranslationalTolerance
- The translational tolerance in metersrotationalTolerance
- The rotational tolerance in radians- Returns:
- true if near the start of a path
-
getPathTrajectory
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
-