Class PathPlannerUtil.PathPlannerConfig
java.lang.Object
com.stuypulse.robot.util.auton.PathPlannerUtil.PathPlannerConfig
- Enclosing class:
PathPlannerUtil
PathPlanner Configuration
Associates an autonomous routine name and one or more PathPlanner path names with a
factory method that creates the corresponding PathPlannerAuton. Create one
configuration for each routine, then call one of the register methods to add it to an
autonomous chooser.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPathPlannerConfig(String name, Function<com.pathplanner.lib.path.PathPlannerPath[], PathPlannerAuton> auton, String... paths) Constructor for a PathPlannerConfig -
Method Summary
Modifier and TypeMethodDescriptionprivate PathPlannerAutonLoads the configured paths and passes them to the routine factory.register()Registers this routine withAutonOpMode's internal chooser.Adds this routine to aLoggedNetworkChooserunder the configured name.Registers this routine as the default withAutonOpMode's internal chooser.registerDefault(org.littletonrobotics.junction.networktables.LoggedNetworkChooser<Auton> chooser) Adds this routine to aLoggedNetworkChooseras its default option.
-
Field Details
-
name
-
auton
-
paths
-
-
Constructor Details
-
PathPlannerConfig
public PathPlannerConfig(String name, Function<com.pathplanner.lib.path.PathPlannerPath[], PathPlannerAuton> auton, String... paths) Constructor for a PathPlannerConfig
Stores the routine name, path names, and factory. Checks if every path exists and reports missing paths and suggested closest matches to the Driver Station.
- Parameters:
name- The name to display for this autonomous routineauton- Factory that creates the routine from the loaded pathspaths- PathPlanner path names used by the routine, in the order expected by the factory
-
-
Method Details
-
buildPathPlannerAuton
Loads the configured paths and passes them to the routine factory.- Returns:
- The autonomous routine created from the configured paths
-
register
public PathPlannerUtil.PathPlannerConfig register(org.littletonrobotics.junction.networktables.LoggedNetworkChooser<Auton> chooser) Adds this routine to aLoggedNetworkChooserunder the configured name.- Parameters:
chooser- The chooser that will display this routine- Returns:
- This instance of the class, for method chaining
-
register
Registers this routine withAutonOpMode's internal chooser.- Returns:
- This instance of the class, for method chaining
-
registerDefault
public PathPlannerUtil.PathPlannerConfig registerDefault(org.littletonrobotics.junction.networktables.LoggedNetworkChooser<Auton> chooser) Adds this routine to aLoggedNetworkChooseras its default option.- Parameters:
chooser- The chooser that will display this routine.- Returns:
- This instance of the class, for method chaining
-
registerDefault
Registers this routine as the default withAutonOpMode's internal chooser.- Returns:
- This instance of the class, for method chaining
-