Class CommandUtil

java.lang.Object
com.pathplanner.lib.auto.CommandUtil

public class CommandUtil extends Object
Utility class for building commands used in autos
  • Constructor Details

    • CommandUtil

      public CommandUtil()
  • Method Details

    • wrappedEventCommand

      public static Command wrappedEventCommand(Command eventCommand)
      Wraps a command with a functional command that calls the command's initialize, execute, end, and isFinished methods. This allows a command in the event map to be reused multiple times in different command groups
      Parameters:
      eventCommand - the command to wrap
      Returns:
      a functional command that wraps the given command
    • commandFromJson

      public static Command commandFromJson(org.json.simple.JSONObject commandJson, boolean loadChoreoPaths) throws IOException, org.json.simple.parser.ParseException
      Builds a command from the given JSON object.
      Parameters:
      commandJson - the JSON object to build the command from
      loadChoreoPaths - Load path commands using choreo trajectories
      Returns:
      a command built from the JSON object
      Throws:
      IOException - if attempting to load a path file that does not exist or cannot be read
      org.json.simple.parser.ParseException - If attempting to load a path with JSON that cannot be parsed