Class SwerveDriveConfiguration

java.lang.Object
swervelib.parser.SwerveDriveConfiguration

public class SwerveDriveConfiguration extends Object
Swerve drive configurations used during SwerveDrive construction.
  • Field Details

    • moduleCount

      public final int moduleCount
      Number of modules on the robot.
    • moduleLocationsMeters

      public Translation2d[] moduleLocationsMeters
      Swerve Module locations.
    • imu

      public SwerveIMU imu
      Swerve IMU
    • modules

      public SwerveModule[] modules
      Swerve Modules.
    • physicalCharacteristics

      public SwerveModulePhysicalCharacteristics physicalCharacteristics
      Physical characteristics of the swerve drive from physicalproperties.json.
  • Constructor Details

  • Method Details

    • createModules

      public SwerveModule[] createModules(SwerveModuleConfiguration[] swerves)
      Create modules based off of the SwerveModuleConfiguration.
      Parameters:
      swerves - Swerve constants.
      Returns:
      Swerve Modules.
    • getDriveBaseRadiusMeters

      public double getDriveBaseRadiusMeters()
      Calculate the Drive Base Radius
      Returns:
      Drive base radius from center of robot to the farthest wheel in meters.
    • getTrackwidth

      public double getTrackwidth()
      Get the trackwidth of the swerve modules.
      Returns:
      Effective trackwdtih in Meters
    • getTracklength

      public double getTracklength()
      Get the tracklength of the swerve modules.
      Returns:
      Effective tracklength in Meters
    • getDriveMotorSim

      public DCMotor getDriveMotorSim()
      Get the DCMotor corresponding to the first module's configuration.
      Returns:
      DCMotor of the drive motor.
    • getAngleMotorSim

      public DCMotor getAngleMotorSim()
      Get the DCMotor corresponding to the first module configuration.
      Returns:
      DCMotor of the angle motor.
    • getGyroSim

      public Supplier<GyroSimulation> getGyroSim()
      Get the gyro simulation for the robot.
      Returns:
      GyroSimulation gyro simulation.