Class DriveConstants

java.lang.Object
frc.robot.subsystems.drive.DriveConstants

public class DriveConstants extends Object
Hardware and tuning constants for the drive subsystem.

Contains physical dimensions, CAN IDs, gear ratios, motor current limits, and PID tuning values for both real and simulated hardware.

  • Field Details

    • MAX_LINEAR_VELOCITY

      public static final LinearVelocity MAX_LINEAR_VELOCITY
      The maximum achievable linear velocity of the robot in meters per second.
    • MAX_LINEAR_ACCELERATION

      public static final LinearAcceleration MAX_LINEAR_ACCELERATION
      The maximum achievable linear acceleration of the robot in meters per second squared.
    • ODOMETRY_FREQUENCY

      public static final Frequency ODOMETRY_FREQUENCY
      The frequency at which odometry calculations are updated.
    • TRACK_WIDTH

      public static final Distance TRACK_WIDTH
      The distance between the left and right wheels.
    • WHEEL_BASE

      public static final Distance WHEEL_BASE
      The distance between the front and back wheels.
    • DRIVE_BASE_RADIUS

      public static final Distance DRIVE_BASE_RADIUS
      The radius of the circle defined by the module locations.
    • HEADING_ALIGNMENT_TOLERANCE

      public static final Angle HEADING_ALIGNMENT_TOLERANCE
      Maximum heading error allowed when determining if the robot is aligned to shoot.
    • MODULE_CONFIGS

      public static final DriveConstants.SwerveModuleConfig[] MODULE_CONFIGS
      Hardware configurations for all four swerve modules.

      Index Order: Front Left (0), Front Right (1), Back Left (2), Back Right (3)

    • MODULE_TRANSLATIONS

      public static final Translation2d[] MODULE_TRANSLATIONS
      The locations of the modules relative to the center of the robot.

      Order: Front Left, Front Right, Back Left, Back Right

    • IMU_CAN_ID

      public static final int IMU_CAN_ID
      CAN ID for the IMU (gyroscope).
      See Also:
    • DRIFT_GAIN

      public static final double DRIFT_GAIN
      The gain for correcting drift based on the secondary gyro.
      See Also:
    • ERROR_THRESHOLD

      public static final Angle ERROR_THRESHOLD
      The threshold for angular error before correction is applied.
    • MAX_CORRECTION_PER_FRAME

      public static final Angle MAX_CORRECTION_PER_FRAME
      The maximum angular correction allowed per control frame.
    • VELOCITY_GATE

      public static final AngularVelocity VELOCITY_GATE
      The velocity threshold below which the robot is considered stationary.
    • CANANDGYRO_LATENCY_SEC

      public static final Time CANANDGYRO_LATENCY_SEC
      Latency compensation for Canandgyro over CAN (seconds).
    • DRIVE_INVERTED

      public static final boolean DRIVE_INVERTED
      Whether the drive motor is inverted.
      See Also:
    • DRIVE_MOTOR_CURRENT_LIMIT

      public static final Current DRIVE_MOTOR_CURRENT_LIMIT
      Maximum current limit for the drive motors.
    • DRIVE_MOTOR_SECONDARY_CURRENT_LIMIT

      public static final Current DRIVE_MOTOR_SECONDARY_CURRENT_LIMIT
      Secondary current limit for the drive motors.
    • WHEEL_RADIUS

      public static final Distance WHEEL_RADIUS
      The radius of the drive wheels.
    • DRIVE_MOTOR_REDUCTION

      public static final double DRIVE_MOTOR_REDUCTION
      The gear reduction between the drive motor and the wheel.
      See Also:
    • DRIVE_GEARBOX

      public static final DCMotor DRIVE_GEARBOX
      The gearbox model for the drive motor.
    • DRIVE_ENCODER_POSITION_FACTOR

      public static final double DRIVE_ENCODER_POSITION_FACTOR
      Conversion factor for drive position from motor rotations to meters.
      See Also:
    • DRIVE_ENCODER_VELOCITY_FACTOR

      public static final double DRIVE_ENCODER_VELOCITY_FACTOR
      Conversion factor for drive velocity from motor RPM to meters per second.
      See Also:
    • DRIVE_KP

      public static final double DRIVE_KP
      Proportional gain for the drive motor PID controller.
      See Also:
    • DRIVE_KD

      public static final double DRIVE_KD
      Derivative gain for the drive motor PID controller.
      See Also:
    • DRIVE_KS

      public static final double DRIVE_KS
      Static friction feedforward gain for the drive motor.
      See Also:
    • DRIVE_KV

      public static final double DRIVE_KV
      Velocity feedforward gain for the drive motor.
      See Also:
    • DRIVE_KA

      public static final double DRIVE_KA
      Acceleration feedforward gain for the drive motor.
      See Also:
    • TURN_INVERTED

      public static final boolean TURN_INVERTED
      Whether the turn motor is inverted.
      See Also:
    • TURN_MOTOR_CURRENT_LIMIT

      public static final Current TURN_MOTOR_CURRENT_LIMIT
      Maximum current limit for the turn motors.
    • TURN_MOTOR_SECONDARY_CURRENT_LIMIT

      public static final Current TURN_MOTOR_SECONDARY_CURRENT_LIMIT
      Secondary current limit for the turn motors.
    • TURN_MOTOR_REDUCTION

      public static final double TURN_MOTOR_REDUCTION
      The gear reduction between the turn motor and the module.
      See Also:
    • TURN_GEARBOX

      public static final DCMotor TURN_GEARBOX
      The gearbox model for the turn motor.
    • TURN_ENCODER_INVERTED

      public static final boolean TURN_ENCODER_INVERTED
      Whether the turn encoder is inverted.
      See Also:
    • TURN_ENCODER_POSITION_FACTOR

      public static final double TURN_ENCODER_POSITION_FACTOR
      Conversion factor for turn position from encoder rotations to radians.
      See Also:
    • TURN_ENCODER_VELOCITY_FACTOR

      public static final double TURN_ENCODER_VELOCITY_FACTOR
      Conversion factor for turn velocity from encoder RPM to radians per second.
      See Also:
    • TURN_KP

      public static final double TURN_KP
      Proportional gain for the turn motor PID controller.
      See Also:
    • TURN_KD

      public static final double TURN_KD
      Derivative gain for the turn motor PID controller.
      See Also:
    • TURN_PID_MIN_INPUT

      public static final double TURN_PID_MIN_INPUT
      Minimum input range for turn PID (in radians).
      See Also:
    • TURN_PID_MAX_INPUT

      public static final double TURN_PID_MAX_INPUT
      Maximum input range for turn PID (in radians).
      See Also:
    • ROBOT_MASS

      public static final Mass ROBOT_MASS
      Total mass of the robot.
    • JOYSTICK_DEADBAND

      public static final double JOYSTICK_DEADBAND
      Joystick deadband for linear and rotational inputs.
      See Also:
    • ANGLE_KP

      public static final double ANGLE_KP
      Proportional gain for rotational PID control.
      See Also:
    • ANGLE_KD

      public static final double ANGLE_KD
      Derivative gain for rotational PID control.
      See Also:
    • MAX_ANGULAR_VELOCITY

      public static final AngularVelocity MAX_ANGULAR_VELOCITY
      Maximum angular velocity for the rotation motion profile in radians per second.
    • MAX_ANGULAR_ACCELERATION

      public static final AngularAcceleration MAX_ANGULAR_ACCELERATION
      Maximum angular acceleration for the rotation motion profile in radians per second squared.
    • FF_START_DELAY

      public static final Time FF_START_DELAY
      Delay in seconds before feedforward characterization starts ramping voltage.
    • FF_RAMP_RATE

      public static final double FF_RAMP_RATE
      Voltage ramp rate in volts per second for feedforward characterization.
      See Also:
    • WHEEL_RADIUS_MAX_VELOCITY

      public static final AngularVelocity WHEEL_RADIUS_MAX_VELOCITY
      Maximum angular velocity in radians per second for wheel radius characterization.
    • WHEEL_RADIUS_RAMP_RATE

      public static final AngularAcceleration WHEEL_RADIUS_RAMP_RATE
      Angular velocity ramp rate in radians per second squared for wheel radius characterization.
    • ROBOT_MOI

      public static final MomentOfInertia ROBOT_MOI
      Moment of inertia of the robot in kilogram-square meters.
    • WHEEL_COF

      public static final double WHEEL_COF
      Coefficient of friction for the wheels.
      See Also:
    • PP_CONFIG

      public static final RobotConfig PP_CONFIG
      PathPlanner configuration object.
  • Constructor Details

    • DriveConstants

      public DriveConstants()