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.jsonstatic 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 TypeMethodDescriptionCreateSwerveDrivefrom JSON configuration directory.static SwerveModulegetModuleConfigurationByName(String name, SwerveDriveConfiguration driveConfiguration) Get the swerve module by the json name.
-
Field Details
-
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.
-
createSwerveDrive
CreateSwerveDrivefrom JSON configuration directory.- Returns:
SwerveDriveinstance.
-