Package com.pathplanner.lib.auto
Class CommandUtil
java.lang.Object
com.pathplanner.lib.auto.CommandUtil
Utility class for building commands used in autos
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Command
commandFromJson
(org.json.simple.JSONObject commandJson, boolean loadChoreoPaths) Builds a command from the given JSON object.static Command
wrappedEventCommand
(Command eventCommand) Wraps a command with a functional command that calls the command's initialize, execute, end, and isFinished methods.
-
Constructor Details
-
CommandUtil
public CommandUtil()
-
-
Method Details
-
wrappedEventCommand
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 fromloadChoreoPaths
- 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 readorg.json.simple.parser.ParseException
- If attempting to load a path with JSON that cannot be parsed
-