Package frc.robot
Class SwerveConstants
java.lang.Object
frc.robot.SwerveConstants
Central constants for the MARSLib swerve drivetrain.
Students: Modify these values to match your physical robot. All distances are in meters, all angles are in radians, and all speeds are in m/s or rad/s.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleDerivative gain for autonomous rotation path following.static final doubleProportional gain for autonomous rotation path following.static final doubleDerivative gain for autonomous translation path following.static final doubleProportional gain for autonomous translation path following.static final doubleOuter dimensions of the robot with bumpers, used for bounding boxes and MoI approximation (m)static final doublestatic final doubleDrive motor gear ratio (motor rotations per output rotation).static final doubleNominal stator current limit for drive motors (amps).static final doubleStandard gravitational acceleration (m/s²).static final doubleLateral slip relaxation length (m/s).static final doubleMaximum achievable angular robot speed (rad/s).static final doubleMaximum achievable linear robot speed (m/s).static final doubleMinimum current limit during load shedding (amps).static final edu.wpi.first.math.geometry.Translation2d[]Positions of each swerve module relative to robot center (FL, FR, BL, BR).static final doubleNominal battery voltage used for drive feedforward normalization (V).static final doubleMass of the robot inclusive of battery and bumpers (kg).static final doubleApproximate moment of inertia of the robot based on a solid block model (kg*m^2)static final doubleSlip velocity threshold (m/s) at which static friction transitions to kinetic.static final doubleDistance between left and right module centers (meters).static final doubleTurn motor gear ratio (motor rotations per module rotation).static final doubleProportional gain for the module turn voltage controller.static final doubleNominal stator current limit for turn motors (amps).static final doubleCoefficient of friction for robot bumpers scraping against field walls.static final doubleCoefficient of restitution (bounciness) for robot-to-wall collisions.static final doubleKinetic coefficient of friction once the wheel breaks traction (wheel slip/burnout).static final doubleStatic coefficient of friction of the tread against standard FRC carpet.static final doubleEffective rotational inertia of a single driven wheel assembly including the Kraken X60 rotor reflected through theDRIVE_GEAR_RATIO(kg·m²).static final doubleRadius of the swerve drive wheels (meters).static final doubleDistance between front and rear module centers (meters). -
Method Summary
-
Field Details
-
TRACK_WIDTH_METERS
public static final double TRACK_WIDTH_METERSDistance between left and right module centers (meters).- See Also:
-
WHEELBASE_METERS
public static final double WHEELBASE_METERSDistance between front and rear module centers (meters).- See Also:
-
MODULE_LOCATIONS
public static final edu.wpi.first.math.geometry.Translation2d[] MODULE_LOCATIONSPositions of each swerve module relative to robot center (FL, FR, BL, BR). -
ROBOT_MASS_KG
public static final double ROBOT_MASS_KGMass of the robot inclusive of battery and bumpers (kg). 140lbs.- See Also:
-
BUMPER_LENGTH_METERS
public static final double BUMPER_LENGTH_METERSOuter dimensions of the robot with bumpers, used for bounding boxes and MoI approximation (m)- See Also:
-
BUMPER_WIDTH_METERS
public static final double BUMPER_WIDTH_METERS- See Also:
-
ROBOT_MOI_KG_M2
public static final double ROBOT_MOI_KG_M2Approximate moment of inertia of the robot based on a solid block model (kg*m^2) -
WHEEL_COF_STATIC
public static final double WHEEL_COF_STATICStatic coefficient of friction of the tread against standard FRC carpet.- See Also:
-
WHEEL_COF_KINETIC
public static final double WHEEL_COF_KINETICKinetic coefficient of friction once the wheel breaks traction (wheel slip/burnout).- See Also:
-
SLIP_TRANSITION_VELOCITY_MPS
public static final double SLIP_TRANSITION_VELOCITY_MPSSlip velocity threshold (m/s) at which static friction transitions to kinetic.Below this velocity, wheel grip uses
WHEEL_COF_STATIC. Above it, grip drops toWHEEL_COF_KINETIC, modeling the Stribeck/Coulomb friction curve.- See Also:
-
LATERAL_SLIP_RELAXATION
public static final double LATERAL_SLIP_RELAXATIONLateral slip relaxation length (m/s). Controls the viscous ramp region for sideways tire friction to prevent numerical jitter at low lateral velocities.- See Also:
-
WHEEL_MOI_KG_M2
public static final double WHEEL_MOI_KG_M2Effective rotational inertia of a single driven wheel assembly including the Kraken X60 rotor reflected through theDRIVE_GEAR_RATIO(kg·m²).- See Also:
-
GRAVITY_M_PER_S2
public static final double GRAVITY_M_PER_S2Standard gravitational acceleration (m/s²).- See Also:
-
WALL_FRICTION
public static final double WALL_FRICTIONCoefficient of friction for robot bumpers scraping against field walls.- See Also:
-
WALL_RESTITUTION
public static final double WALL_RESTITUTIONCoefficient of restitution (bounciness) for robot-to-wall collisions.- See Also:
-
WHEEL_RADIUS_METERS
public static final double WHEEL_RADIUS_METERSRadius of the swerve drive wheels (meters). Standard 2-inch colson = 0.0508m.- See Also:
-
MAX_LINEAR_SPEED_MPS
public static final double MAX_LINEAR_SPEED_MPSMaximum achievable linear robot speed (m/s).- See Also:
-
MAX_ANGULAR_SPEED_RAD_PER_SEC
public static final double MAX_ANGULAR_SPEED_RAD_PER_SECMaximum achievable angular robot speed (rad/s).- See Also:
-
NOMINAL_BATTERY_VOLTAGE
public static final double NOMINAL_BATTERY_VOLTAGENominal battery voltage used for drive feedforward normalization (V).This is the true battery nominal (12.0V), NOT the load-shedding trigger threshold (
PowerConstants.NOMINAL_VOLTAGE). Used inSwerveModule.setDesiredState(edu.wpi.first.math.kinematics.SwerveModuleState)to scale desired speed into voltage.- See Also:
-
DRIVE_GEAR_RATIO
public static final double DRIVE_GEAR_RATIODrive motor gear ratio (motor rotations per output rotation). L1 = 6.75:1.- See Also:
-
TURN_GEAR_RATIO
public static final double TURN_GEAR_RATIOTurn motor gear ratio (motor rotations per module rotation).- See Also:
-
DRIVE_STATOR_CURRENT_LIMIT
public static final double DRIVE_STATOR_CURRENT_LIMITNominal stator current limit for drive motors (amps).- See Also:
-
TURN_STATOR_CURRENT_LIMIT
public static final double TURN_STATOR_CURRENT_LIMITNominal stator current limit for turn motors (amps).- See Also:
-
MIN_LOAD_SHED_CURRENT
public static final double MIN_LOAD_SHED_CURRENTMinimum current limit during load shedding (amps).- See Also:
-
TURN_KP
public static final double TURN_KPProportional gain for the module turn voltage controller.- See Also:
-
AUTO_TRANSLATION_KP
public static final double AUTO_TRANSLATION_KPProportional gain for autonomous translation path following.- See Also:
-
AUTO_TRANSLATION_KD
public static final double AUTO_TRANSLATION_KDDerivative gain for autonomous translation path following.- See Also:
-
AUTO_ROTATION_KP
public static final double AUTO_ROTATION_KPProportional gain for autonomous rotation path following.- See Also:
-
AUTO_ROTATION_KD
public static final double AUTO_ROTATION_KDDerivative gain for autonomous rotation path following.- See Also:
-