Class SwerveModuleSimulationConfig

java.lang.Object
org.ironmaple.simulation.drivesims.configs.SwerveModuleSimulationConfig
All Implemented Interfaces:
Supplier<SwerveModuleSimulation>

public class SwerveModuleSimulationConfig extends Object implements Supplier<SwerveModuleSimulation>
  • Field Details

    • driveMotorConfigs

      public final SimMotorConfigs driveMotorConfigs
    • steerMotorConfigs

      public final SimMotorConfigs steerMotorConfigs
    • DRIVE_GEAR_RATIO

      public final double DRIVE_GEAR_RATIO
    • STEER_GEAR_RATIO

      public final double STEER_GEAR_RATIO
    • WHEELS_COEFFICIENT_OF_FRICTION

      public final double WHEELS_COEFFICIENT_OF_FRICTION
    • DRIVE_FRICTION_VOLTAGE

      public final Voltage DRIVE_FRICTION_VOLTAGE
    • WHEEL_RADIUS

      public final Distance WHEEL_RADIUS
  • Constructor Details

    • SwerveModuleSimulationConfig

      public SwerveModuleSimulationConfig(DCMotor driveMotorModel, DCMotor steerMotorModel, double driveGearRatio, double steerGearRatio, Voltage driveFrictionVoltage, Voltage steerFrictionVoltage, Distance wheelRadius, MomentOfInertia steerRotationalInertia, double wheelsCoefficientOfFriction)

      Constructs a Configuration for Swerve Module Simulation.

      If you are using SimulatedArena.overrideSimulationTimings(Time, int) to use custom timings, you must call the method before constructing any swerve module simulations using this constructor.

      Parameters:
      driveMotorModel - the model of the driving motor
      steerMotorModel - ; the model of the steering motor
      driveGearRatio - the gear ratio for the driving motor, >1 is reduction
      steerGearRatio - the gear ratio for the steering motor, >1 is reduction
      driveFrictionVoltage - the measured minimum amount of voltage that can turn the driving rotter
      steerFrictionVoltage - the measured minimum amount of voltage that can turn the steering rotter
      wheelRadius - the radius of the wheels.
      steerRotationalInertia - the rotational inertia of the entire steering mechanism
      wheelsCoefficientOfFriction - the coefficient of friction of the tires, normally around 1.2 Units.inchesToMeters(double).
  • Method Details

    • get

      public SwerveModuleSimulation get()
      Specified by:
      get in interface Supplier<SwerveModuleSimulation>
    • getGrippingForceNewtons

      public double getGrippingForceNewtons(double gravityForceOnModuleNewtons)
    • maximumGroundSpeed

      public LinearVelocity maximumGroundSpeed()

      Obtains the theoretical speed that the module can achieve.

      Returns:
      the theoretical maximum ground speed that the module can achieve, in m/s
    • getTheoreticalPropellingForcePerModule

      public Force getTheoreticalPropellingForcePerModule(Mass robotMass, int modulesCount, Current statorCurrentLimit)

      Obtains the theoretical maximum propelling force of ONE module.

      Calculates the maximum propelling force with respect to the gripping force and the drive motor's torque under its current limit.

      Parameters:
      robotMass - the mass of the robot
      modulesCount - the amount of modules on the robot, assumed to be sharing the gravity force equally
      Returns:
      the maximum propelling force of EACH module
    • maxAcceleration

      public LinearAcceleration maxAcceleration(Mass robotMass, int modulesCount, Current statorCurrentLimit)

      Obtains the theatrical linear acceleration that the robot can achieve.

      Calculates the maximum linear acceleration of a robot, with respect to its mass and getTheoreticalPropellingForcePerModule(Mass, int, Current).

      Parameters:
      robotMass - the mass of the robot
      modulesCount - the amount of modules on the robot, assumed to be sharing the gravity force equally