Package com.marslib.swerve
Record Class SwerveConfig
java.lang.Object
java.lang.Record
com.marslib.swerve.SwerveConfig
public record SwerveConfig(edu.wpi.first.math.geometry.Translation2d[] moduleLocations, double maxLinearSpeedMps, double maxAngularSpeedRadPerSec, double wheelRadiusMeters, double turnKp, double nominalVoltage, double warningVoltage, double criticalVoltage, double driveGearRatio, double driveStatorCurrentLimit, double robotMassKg, double robotMoiKgM2, double bumperLengthMeters, double bumperWidthMeters, double wheelbaseMeters, double trackWidthMeters, double wheelCOFStatic, double loopPeriodSecs, double teleopLinearAccelLimit, double teleopOmegaAccelLimit, double headingKp, double autoTranslationKp, double autoTranslationKd, double autoRotationKp, double autoRotationKd, double alignTranslationKp, double alignTranslationIZoneMeters, double alignThetaKp, double alignThetaIZoneRad, double telemetryHz, double odometryHz, double turnGearRatio, double turnStatorCurrentLimit)
extends Record
Configuration record for the SwerveDrive subsystem.
This object encapsulates all physical, kinematic, and structural parameters, allowing the library to remain data-driven and independent of the robot's constant files.
-
Constructor Summary
ConstructorsConstructorDescriptionSwerveConfig(edu.wpi.first.math.geometry.Translation2d[] moduleLocations, double maxLinearSpeedMps, double maxAngularSpeedRadPerSec, double wheelRadiusMeters, double turnKp, double nominalVoltage, double warningVoltage, double criticalVoltage, double driveGearRatio, double driveStatorCurrentLimit, double robotMassKg, double robotMoiKgM2, double bumperLengthMeters, double bumperWidthMeters, double wheelbaseMeters, double trackWidthMeters, double wheelCOFStatic, double loopPeriodSecs, double teleopLinearAccelLimit, double teleopOmegaAccelLimit, double headingKp, double autoTranslationKp, double autoTranslationKd, double autoRotationKp, double autoRotationKd, double alignTranslationKp, double alignTranslationIZoneMeters, double alignThetaKp, double alignThetaIZoneRad, double telemetryHz, double odometryHz, double turnGearRatio, double turnStatorCurrentLimit) Creates an instance of aSwerveConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the value of thealignThetaIZoneRadrecord component.doubleReturns the value of thealignThetaKprecord component.doubleReturns the value of thealignTranslationIZoneMetersrecord component.doubleReturns the value of thealignTranslationKprecord component.doubleReturns the value of theautoRotationKdrecord component.doubleReturns the value of theautoRotationKprecord component.doubleReturns the value of theautoTranslationKdrecord component.doubleReturns the value of theautoTranslationKprecord component.doubleReturns the value of thebumperLengthMetersrecord component.doubleReturns the value of thebumperWidthMetersrecord component.doubleReturns the value of thecriticalVoltagerecord component.doubleReturns the value of thedriveGearRatiorecord component.doubleReturns the value of thedriveStatorCurrentLimitrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doubleReturns the value of theheadingKprecord component.doubleReturns the value of theloopPeriodSecsrecord component.doubleReturns the value of themaxAngularSpeedRadPerSecrecord component.doubleReturns the value of themaxLinearSpeedMpsrecord component.edu.wpi.first.math.geometry.Translation2d[]Returns the value of themoduleLocationsrecord component.doubleReturns the value of thenominalVoltagerecord component.doubleReturns the value of theodometryHzrecord component.doubleReturns the value of therobotMassKgrecord component.doubleReturns the value of therobotMoiKgM2record component.doubleReturns the value of thetelemetryHzrecord component.doubleReturns the value of theteleopLinearAccelLimitrecord component.doubleReturns the value of theteleopOmegaAccelLimitrecord component.final StringtoString()Returns a string representation of this record class.doubleReturns the value of thetrackWidthMetersrecord component.doubleReturns the value of theturnGearRatiorecord component.doubleturnKp()Returns the value of theturnKprecord component.doubleReturns the value of theturnStatorCurrentLimitrecord component.doubleReturns the value of thewarningVoltagerecord component.doubleReturns the value of thewheelbaseMetersrecord component.doubleReturns the value of thewheelCOFStaticrecord component.doubleReturns the value of thewheelRadiusMetersrecord component.
-
Constructor Details
-
SwerveConfig
public SwerveConfig(edu.wpi.first.math.geometry.Translation2d[] moduleLocations, double maxLinearSpeedMps, double maxAngularSpeedRadPerSec, double wheelRadiusMeters, double turnKp, double nominalVoltage, double warningVoltage, double criticalVoltage, double driveGearRatio, double driveStatorCurrentLimit, double robotMassKg, double robotMoiKgM2, double bumperLengthMeters, double bumperWidthMeters, double wheelbaseMeters, double trackWidthMeters, double wheelCOFStatic, double loopPeriodSecs, double teleopLinearAccelLimit, double teleopOmegaAccelLimit, double headingKp, double autoTranslationKp, double autoTranslationKd, double autoRotationKp, double autoRotationKd, double alignTranslationKp, double alignTranslationIZoneMeters, double alignThetaKp, double alignThetaIZoneRad, double telemetryHz, double odometryHz, double turnGearRatio, double turnStatorCurrentLimit) Creates an instance of aSwerveConfigrecord class.- Parameters:
moduleLocations- the value for themoduleLocationsrecord componentmaxLinearSpeedMps- the value for themaxLinearSpeedMpsrecord componentmaxAngularSpeedRadPerSec- the value for themaxAngularSpeedRadPerSecrecord componentwheelRadiusMeters- the value for thewheelRadiusMetersrecord componentturnKp- the value for theturnKprecord componentnominalVoltage- the value for thenominalVoltagerecord componentwarningVoltage- the value for thewarningVoltagerecord componentcriticalVoltage- the value for thecriticalVoltagerecord componentdriveGearRatio- the value for thedriveGearRatiorecord componentdriveStatorCurrentLimit- the value for thedriveStatorCurrentLimitrecord componentrobotMassKg- the value for therobotMassKgrecord componentrobotMoiKgM2- the value for therobotMoiKgM2record componentbumperLengthMeters- the value for thebumperLengthMetersrecord componentbumperWidthMeters- the value for thebumperWidthMetersrecord componentwheelbaseMeters- the value for thewheelbaseMetersrecord componenttrackWidthMeters- the value for thetrackWidthMetersrecord componentwheelCOFStatic- the value for thewheelCOFStaticrecord componentloopPeriodSecs- the value for theloopPeriodSecsrecord componentteleopLinearAccelLimit- the value for theteleopLinearAccelLimitrecord componentteleopOmegaAccelLimit- the value for theteleopOmegaAccelLimitrecord componentheadingKp- the value for theheadingKprecord componentautoTranslationKp- the value for theautoTranslationKprecord componentautoTranslationKd- the value for theautoTranslationKdrecord componentautoRotationKp- the value for theautoRotationKprecord componentautoRotationKd- the value for theautoRotationKdrecord componentalignTranslationKp- the value for thealignTranslationKprecord componentalignTranslationIZoneMeters- the value for thealignTranslationIZoneMetersrecord componentalignThetaKp- the value for thealignThetaKprecord componentalignThetaIZoneRad- the value for thealignThetaIZoneRadrecord componenttelemetryHz- the value for thetelemetryHzrecord componentodometryHz- the value for theodometryHzrecord componentturnGearRatio- the value for theturnGearRatiorecord componentturnStatorCurrentLimit- the value for theturnStatorCurrentLimitrecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
moduleLocations
public edu.wpi.first.math.geometry.Translation2d[] moduleLocations()Returns the value of themoduleLocationsrecord component.- Returns:
- the value of the
moduleLocationsrecord component
-
maxLinearSpeedMps
public double maxLinearSpeedMps()Returns the value of themaxLinearSpeedMpsrecord component.- Returns:
- the value of the
maxLinearSpeedMpsrecord component
-
maxAngularSpeedRadPerSec
public double maxAngularSpeedRadPerSec()Returns the value of themaxAngularSpeedRadPerSecrecord component.- Returns:
- the value of the
maxAngularSpeedRadPerSecrecord component
-
wheelRadiusMeters
public double wheelRadiusMeters()Returns the value of thewheelRadiusMetersrecord component.- Returns:
- the value of the
wheelRadiusMetersrecord component
-
turnKp
public double turnKp()Returns the value of theturnKprecord component.- Returns:
- the value of the
turnKprecord component
-
nominalVoltage
public double nominalVoltage()Returns the value of thenominalVoltagerecord component.- Returns:
- the value of the
nominalVoltagerecord component
-
warningVoltage
public double warningVoltage()Returns the value of thewarningVoltagerecord component.- Returns:
- the value of the
warningVoltagerecord component
-
criticalVoltage
public double criticalVoltage()Returns the value of thecriticalVoltagerecord component.- Returns:
- the value of the
criticalVoltagerecord component
-
driveGearRatio
public double driveGearRatio()Returns the value of thedriveGearRatiorecord component.- Returns:
- the value of the
driveGearRatiorecord component
-
driveStatorCurrentLimit
public double driveStatorCurrentLimit()Returns the value of thedriveStatorCurrentLimitrecord component.- Returns:
- the value of the
driveStatorCurrentLimitrecord component
-
robotMassKg
public double robotMassKg()Returns the value of therobotMassKgrecord component.- Returns:
- the value of the
robotMassKgrecord component
-
robotMoiKgM2
public double robotMoiKgM2()Returns the value of therobotMoiKgM2record component.- Returns:
- the value of the
robotMoiKgM2record component
-
bumperLengthMeters
public double bumperLengthMeters()Returns the value of thebumperLengthMetersrecord component.- Returns:
- the value of the
bumperLengthMetersrecord component
-
bumperWidthMeters
public double bumperWidthMeters()Returns the value of thebumperWidthMetersrecord component.- Returns:
- the value of the
bumperWidthMetersrecord component
-
wheelbaseMeters
public double wheelbaseMeters()Returns the value of thewheelbaseMetersrecord component.- Returns:
- the value of the
wheelbaseMetersrecord component
-
trackWidthMeters
public double trackWidthMeters()Returns the value of thetrackWidthMetersrecord component.- Returns:
- the value of the
trackWidthMetersrecord component
-
wheelCOFStatic
public double wheelCOFStatic()Returns the value of thewheelCOFStaticrecord component.- Returns:
- the value of the
wheelCOFStaticrecord component
-
loopPeriodSecs
public double loopPeriodSecs()Returns the value of theloopPeriodSecsrecord component.- Returns:
- the value of the
loopPeriodSecsrecord component
-
teleopLinearAccelLimit
public double teleopLinearAccelLimit()Returns the value of theteleopLinearAccelLimitrecord component.- Returns:
- the value of the
teleopLinearAccelLimitrecord component
-
teleopOmegaAccelLimit
public double teleopOmegaAccelLimit()Returns the value of theteleopOmegaAccelLimitrecord component.- Returns:
- the value of the
teleopOmegaAccelLimitrecord component
-
headingKp
public double headingKp()Returns the value of theheadingKprecord component.- Returns:
- the value of the
headingKprecord component
-
autoTranslationKp
public double autoTranslationKp()Returns the value of theautoTranslationKprecord component.- Returns:
- the value of the
autoTranslationKprecord component
-
autoTranslationKd
public double autoTranslationKd()Returns the value of theautoTranslationKdrecord component.- Returns:
- the value of the
autoTranslationKdrecord component
-
autoRotationKp
public double autoRotationKp()Returns the value of theautoRotationKprecord component.- Returns:
- the value of the
autoRotationKprecord component
-
autoRotationKd
public double autoRotationKd()Returns the value of theautoRotationKdrecord component.- Returns:
- the value of the
autoRotationKdrecord component
-
alignTranslationKp
public double alignTranslationKp()Returns the value of thealignTranslationKprecord component.- Returns:
- the value of the
alignTranslationKprecord component
-
alignTranslationIZoneMeters
public double alignTranslationIZoneMeters()Returns the value of thealignTranslationIZoneMetersrecord component.- Returns:
- the value of the
alignTranslationIZoneMetersrecord component
-
alignThetaKp
public double alignThetaKp()Returns the value of thealignThetaKprecord component.- Returns:
- the value of the
alignThetaKprecord component
-
alignThetaIZoneRad
public double alignThetaIZoneRad()Returns the value of thealignThetaIZoneRadrecord component.- Returns:
- the value of the
alignThetaIZoneRadrecord component
-
telemetryHz
public double telemetryHz()Returns the value of thetelemetryHzrecord component.- Returns:
- the value of the
telemetryHzrecord component
-
odometryHz
public double odometryHz()Returns the value of theodometryHzrecord component.- Returns:
- the value of the
odometryHzrecord component
-
turnGearRatio
public double turnGearRatio()Returns the value of theturnGearRatiorecord component.- Returns:
- the value of the
turnGearRatiorecord component
-
turnStatorCurrentLimit
public double turnStatorCurrentLimit()Returns the value of theturnStatorCurrentLimitrecord component.- Returns:
- the value of the
turnStatorCurrentLimitrecord component
-