Package swervelib.parser
Class SwerveParser
java.lang.Object
swervelib.parser.SwerveParser
Helper class used to parse the JSON directory with specified configuration options.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic ControllerPropertiesJsonParsed controllerproperties.jsonModule number mapped to the JSON name.static ModuleJson[]Array holding the module jsons given inSwerveDriveJson.static PhysicalPropertiesJsonParsed modules/physicalproperties.jsonstatic PIDFPropertiesJsonParsed modules/pidfproperties.jsonstatic SwerveDriveJsonParsed swervedrive.json -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheckDirectory(File directory) Check directory structure.CreateSwerveDrivefrom JSON configuration directory.static SwerveModulegetModuleConfigurationByName(String name, SwerveDriveConfiguration driveConfiguration) Get the swerve module by the json name.private com.fasterxml.jackson.databind.JsonNodeOpen JSON file.
-
Field Details
-
moduleConfigs
Module number mapped to the JSON name. -
swerveDriveJson
Parsed swervedrive.json -
controllerPropertiesJson
Parsed controllerproperties.json -
pidfPropertiesJson
Parsed modules/pidfproperties.json -
physicalPropertiesJson
Parsed modules/physicalproperties.json -
moduleJsons
Array holding the module jsons given inSwerveDriveJson.
-
-
Constructor Details
-
SwerveParser
Construct a swerve parser. Will throw an error if there is a missing file.- Parameters:
directory- Directory with swerve configurations.- Throws:
IOException- if a file doesn't exist.
-
-
Method Details
-
getModuleConfigurationByName
public static SwerveModule getModuleConfigurationByName(String name, SwerveDriveConfiguration driveConfiguration) Get the swerve module by the json name.- Parameters:
name- JSON name.driveConfiguration-SwerveDriveConfigurationto pull from.- Returns:
SwerveModuleConfigurationbased on the file.
-
openJson
Open JSON file.- Parameters:
file- JSON File to open.- Returns:
- JsonNode of file.
-
checkDirectory
Check directory structure.- Parameters:
directory- JSON Configuration Directory
-
createSwerveDrive
CreateSwerveDrivefrom JSON configuration directory.- Returns:
SwerveDriveinstance.
-