Class PathPlannerUtil
PathPlanner Utility
Loads PathPlanner path (.path) files from the deploy directory and builds named autonomous routines from those paths.
Usage
For example, inside Robot.configureAutons(), you can create a
PathPlannerUtil.PathPlannerConfig, pass in the auton name, factory method, and path names, then register
it with AutonOpMode via PathPlannerUtil.PathPlannerConfig.register().
AutonFactory factory = new AutonFactory(swerve);
PathPlannerConfig scoreAutonConfig = new PathPlannerConfig(
"Score",
factory::score,
"Score Path");
scoreAutonConfig.register();
The factory method receives the loaded paths in the order listed and returns a PathPlannerAuton. Use PathPlannerUtil.PathPlannerConfig.register() for a regular option, or PathPlannerUtil.PathPlannerConfig.registerDefault() for the chooser's default option. A config can also register
directly with a LoggedNetworkChooser when a custom chooser is used. The methods without a
chooser register the routine with AutonOpMode.
Path names are checked when the configuration is created. Missing paths are reported to the Driver Station with a suggested closest match when one is available.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPathPlanner Configuration -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
PathPlannerUtil
private PathPlannerUtil()
-
-
Method Details
-
loadPaths
Loads multiple PathPlanner paths in the order given. Each name is passed toload(String).If a path cannot be loaded or found, an error is reported to the Driver Station, and null is returned in the corresponding position.
- Parameters:
names- PathPlanner path names to load- Returns:
- The corresponding paths where entries that fail to load are
null
-
load
-