Package swervelib.parser.json
Class ModuleJson
java.lang.Object
swervelib.parser.json.ModuleJson
SwerveModule
JSON parsed class. Used to access the JSON data.-
Field Summary
Modifier and TypeFieldDescriptionboolean
Absolute encoder inversion state.double
Absolute encoder offset from 0 in degrees.Angle motor device configuration.Conversion factor for the module, if different from the one in swervedrive.jsonConversion Factors composition.Drive motor device configuration.Absolute encoder device configuration.Defines which motors are inverted.The location of the swerve module from the center of the robot in inches.boolean
Should do cosine compensation when not pointing correct direction;. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateModuleConfiguration
(PIDFConfig anglePIDF, PIDFConfig velocityPIDF, SwerveModulePhysicalCharacteristics physicalCharacteristics, String name) Create the swerve module configuration based off of parsed data.
-
Field Details
-
drive
Drive motor device configuration. -
angle
Angle motor device configuration. -
conversionFactor
Conversion factor for the module, if different from the one in swervedrive.jsonConversion factor applied to the motor controllers PID loops. Can be calculated with
SwerveMath.calculateDegreesPerSteeringRotation(double, double)
for angle motors orSwerveMath.calculateMetersPerRotation(double, double, double)
for drive motors. -
conversionFactors
Conversion Factors composition. Auto-calculates the conversion factors. -
encoder
Absolute encoder device configuration. -
inverted
Defines which motors are inverted. -
absoluteEncoderOffset
public double absoluteEncoderOffsetAbsolute encoder offset from 0 in degrees. -
absoluteEncoderInverted
public boolean absoluteEncoderInvertedAbsolute encoder inversion state. -
location
The location of the swerve module from the center of the robot in inches. -
useCosineCompensator
public boolean useCosineCompensatorShould do cosine compensation when not pointing correct direction;.
-
-
Constructor Details
-
ModuleJson
public ModuleJson()
-
-
Method Details
-
createModuleConfiguration
public SwerveModuleConfiguration createModuleConfiguration(PIDFConfig anglePIDF, PIDFConfig velocityPIDF, SwerveModulePhysicalCharacteristics physicalCharacteristics, String name) Create the swerve module configuration based off of parsed data.- Parameters:
anglePIDF
- The PIDF values for the angle motor.velocityPIDF
- The velocity PIDF values for the drive motor.physicalCharacteristics
- Physical characteristics of the swerve module.name
- Module json filename.- Returns:
SwerveModuleConfiguration
based on the provided data and parsed data.
-