Class BLineUtil

java.lang.Object
com.stuypulse.robot.util.auton.BLineUtil

public final class BLineUtil extends Object

BLine Utility

Loads BLine path (.json) files from the deploy directory and builds named autonomous routines from those paths.

Usage

For example, inside Robot.configureAutons(), you can create a BLineUtil.BLineConfig, pass in the auton name, factory method, and path names, then register it with AutonOpMode via BLineUtil.BLineConfig.register().

AutonFactory factory = new AutonFactory(swerve);

BLineConfig scoreAutonConfig = new BLineConfig(
                "Score",
                factory::score,
                "Score Path");

scoreAutonConfig.register();

The factory method receives the loaded paths in the order listed and returns a BLineAuton. Use BLineUtil.BLineConfig.register() for a regular option, or BLineUtil.BLineConfig.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.

  • Constructor Details

  • Method Details

    • loadPaths

      public static bline.path.Path[] loadPaths(String... names)
      Loads multiple BLine paths in the order given. Each name is passed to load(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 - BLine path names to load
      Returns:
      The corresponding paths where entries that fail to load are null
    • load

      public static bline.path.Path load(String name)
      Loads a BLine path by name.

      If the path cannot be loaded or found, an error is reported to the Driver Station, and null is returned.

      Parameters:
      name - BLine path name
      Returns:
      The loaded path, or null if not found