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 Summary
FieldsModifier and TypeFieldDescriptionfinal Voltage
final double
final SimMotorConfigs
final double
final SimMotorConfigs
final Distance
final double
-
Constructor Summary
ConstructorsConstructorDescriptionSwerveModuleSimulationConfig
(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. -
Method Summary
Modifier and TypeMethodDescriptionget()
double
getGrippingForceNewtons
(double gravityForceOnModuleNewtons) getTheoreticalPropellingForcePerModule
(Mass robotMass, int modulesCount, Current statorCurrentLimit) Obtains the theoretical maximum propelling force of ONE module.maxAcceleration
(Mass robotMass, int modulesCount, Current statorCurrentLimit) Obtains the theatrical linear acceleration that the robot can achieve.Obtains the theoretical speed that the module can achieve.
-
Field Details
-
driveMotorConfigs
-
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
-
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 motorsteerMotorModel
- ; the model of the steering motordriveGearRatio
- the gear ratio for the driving motor, >1 is reductionsteerGearRatio
- the gear ratio for the steering motor, >1 is reductiondriveFrictionVoltage
- the measured minimum amount of voltage that can turn the driving rottersteerFrictionVoltage
- the measured minimum amount of voltage that can turn the steering rotterwheelRadius
- the radius of the wheels.steerRotationalInertia
- the rotational inertia of the entire steering mechanismwheelsCoefficientOfFriction
- the coefficient of friction of the tires, normally around 1.2Units.inchesToMeters(double)
.
-
-
Method Details
-
get
- Specified by:
get
in interfaceSupplier<SwerveModuleSimulation>
-
getGrippingForceNewtons
public double getGrippingForceNewtons(double gravityForceOnModuleNewtons) -
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 robotmodulesCount
- 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 robotmodulesCount
- the amount of modules on the robot, assumed to be sharing the gravity force equally
-