Package swervelib.parser
Class SwerveModuleConfiguration
java.lang.Object
swervelib.parser.SwerveModuleConfiguration
Swerve Module configuration class which is used to configure
SwerveModule
.-
Field Summary
Modifier and TypeFieldDescriptionThe Absolute Encoder for the swerve module.final boolean
Whether the absolute encoder is inverted.The drive motor and angle motor of this swerve module.final boolean
State of inversion of the angle motor.final double
Angle offset in degrees for the Swerve Module.PIDF configuration options for the angle motor closed-loop PID controller.final MotorConfigDouble
Conversion factor for drive motor onboard PID's and angle PID's.The drive motor and angle motor of this swerve module.final boolean
State of inversion of the drive motor.Swerve module location relative to the robot.Name for the swerve module for telemetry.Physical characteristics of the swerve module.boolean
Should do cosine compensation when not pointing correct direction;.PIDF configuration options for the drive motor closed-loop PID controller. -
Constructor Summary
ConstructorDescriptionSwerveModuleConfiguration
(SwerveMotor driveMotor, SwerveMotor angleMotor, MotorConfigDouble conversionFactors, SwerveAbsoluteEncoder absoluteEncoder, double angleOffset, double xMeters, double yMeters, PIDFConfig anglePIDF, PIDFConfig velocityPIDF, SwerveModulePhysicalCharacteristics physicalCharacteristics, boolean absoluteEncoderInverted, boolean driveMotorInverted, boolean angleMotorInverted, String name, boolean useCosineCompensator) Construct a configuration object for swerve modules.SwerveModuleConfiguration
(SwerveMotor driveMotor, SwerveMotor angleMotor, MotorConfigDouble conversionFactors, SwerveAbsoluteEncoder absoluteEncoder, double angleOffset, double xMeters, double yMeters, PIDFConfig anglePIDF, PIDFConfig velocityPIDF, SwerveModulePhysicalCharacteristics physicalCharacteristics, String name, boolean useCosineCompensator) Construct a configuration object for swerve modules. -
Method Summary
-
Field Details
-
conversionFactors
Conversion factor for drive motor onboard PID's and angle PID's. UseSwerveMath.calculateMetersPerRotation(double, double, double)
andSwerveMath.calculateDegreesPerSteeringRotation(double, double)
respectively to calculate the conversion factors. -
angleOffset
public final double angleOffsetAngle offset in degrees for the Swerve Module. -
absoluteEncoderInverted
public final boolean absoluteEncoderInvertedWhether the absolute encoder is inverted. -
driveMotorInverted
public final boolean driveMotorInvertedState of inversion of the drive motor. -
angleMotorInverted
public final boolean angleMotorInvertedState of inversion of the angle motor. -
anglePIDF
PIDF configuration options for the angle motor closed-loop PID controller. -
velocityPIDF
PIDF configuration options for the drive motor closed-loop PID controller. -
moduleLocation
Swerve module location relative to the robot. -
physicalCharacteristics
Physical characteristics of the swerve module. -
driveMotor
The drive motor and angle motor of this swerve module. -
angleMotor
The drive motor and angle motor of this swerve module. -
absoluteEncoder
The Absolute Encoder for the swerve module. -
name
Name for the swerve module for telemetry. -
useCosineCompensator
public boolean useCosineCompensatorShould do cosine compensation when not pointing correct direction;.
-
-
Constructor Details
-
SwerveModuleConfiguration
public SwerveModuleConfiguration(SwerveMotor driveMotor, SwerveMotor angleMotor, MotorConfigDouble conversionFactors, SwerveAbsoluteEncoder absoluteEncoder, double angleOffset, double xMeters, double yMeters, PIDFConfig anglePIDF, PIDFConfig velocityPIDF, SwerveModulePhysicalCharacteristics physicalCharacteristics, boolean absoluteEncoderInverted, boolean driveMotorInverted, boolean angleMotorInverted, String name, boolean useCosineCompensator) Construct a configuration object for swerve modules.- Parameters:
driveMotor
- DriveSwerveMotor
.angleMotor
- AngleSwerveMotor
absoluteEncoder
- Absolute encoderSwerveAbsoluteEncoder
.angleOffset
- Absolute angle offset to 0.absoluteEncoderInverted
- Absolute encoder inverted.angleMotorInverted
- State of inversion of the angle motor.driveMotorInverted
- Drive motor inverted.xMeters
- Module location in meters from the center horizontally.yMeters
- Module location in meters from center vertically.anglePIDF
- Angle PIDF configuration.velocityPIDF
- Velocity PIDF configuration.physicalCharacteristics
- Physical characteristics of the swerve module.name
- The name for the swerve module.conversionFactors
- Conversion factors to be applied to the drive and angle motors.useCosineCompensator
- Should use cosineCompensation.
-
SwerveModuleConfiguration
public SwerveModuleConfiguration(SwerveMotor driveMotor, SwerveMotor angleMotor, MotorConfigDouble conversionFactors, SwerveAbsoluteEncoder absoluteEncoder, double angleOffset, double xMeters, double yMeters, PIDFConfig anglePIDF, PIDFConfig velocityPIDF, SwerveModulePhysicalCharacteristics physicalCharacteristics, String name, boolean useCosineCompensator) Construct a configuration object for swerve modules. Assumes the absolute encoder and drive motor are not inverted.- Parameters:
driveMotor
- DriveSwerveMotor
.angleMotor
- AngleSwerveMotor
conversionFactors
- Conversion factors for angle/azimuth motors drive factors.absoluteEncoder
- Absolute encoderSwerveAbsoluteEncoder
.angleOffset
- Absolute angle offset to 0.xMeters
- Module location in meters from the center horizontally.yMeters
- Module location in meters from center vertically.anglePIDF
- Angle PIDF configuration.velocityPIDF
- Velocity PIDF configuration.physicalCharacteristics
- Physical characteristics of the swerve module.name
- Name for the module.useCosineCompensator
- Should use cosineCompensation.
-